Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsSeamonkeyProfileMigrator.cpp File Reference
#include "nsMailProfileMigratorUtils.h"
#include "nsCRT.h"
#include "nsDirectoryServiceDefs.h"
#include "nsIObserverService.h"
#include "nsIPasswordManagerInternal.h"
#include "nsIPrefLocalizedString.h"
#include "nsIPrefService.h"
#include "nsIServiceManager.h"
#include "nsISupportsArray.h"
#include "nsISupportsPrimitives.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsSeamonkeyProfileMigrator.h"
#include "nsIRelativeFilePref.h"
#include "nsAppDirectoryServiceDefs.h"
#include "prprf.h"
#include "nsVoidArray.h"

Go to the source code of this file.

Classes

struct  PrefBranchStruct
union  PrefBranchStruct.__unnamed__

Defines

#define MAIL_DIR_50_NAME   NS_LITERAL_STRING("Mail")
#define IMAP_MAIL_DIR_50_NAME   NS_LITERAL_STRING("ImapMail")
#define NEWS_DIR_50_NAME   NS_LITERAL_STRING("News")
#define FILE_NAME_JUNKTRAINING   NS_LITERAL_STRING("training.dat")
#define FILE_NAME_PERSONALDICTIONARY   NS_LITERAL_STRING("persdict.dat")
#define FILE_NAME_PERSONAL_ADDRESSBOOK   NS_LITERAL_STRING("abook.mab")
#define FILE_NAME_MAILVIEWS   NS_LITERAL_STRING("mailviews.dat")
#define FILE_NAME_CERT8DB   NS_LITERAL_STRING("cert8.db")
#define FILE_NAME_KEY3DB   NS_LITERAL_STRING("key3.db")
#define FILE_NAME_SECMODDB   NS_LITERAL_STRING("secmod.db")
#define FILE_NAME_MIMETYPES   NS_LITERAL_STRING("mimeTypes.rdf")
#define FILE_NAME_PREFS   NS_LITERAL_STRING("prefs.js")
#define FILE_NAME_USER_PREFS   NS_LITERAL_STRING("user.js")
#define F(a)   nsSeamonkeyProfileMigrator::a
#define MAKEPREFTRANSFORM(pref, newpref, getmethod, setmethod)   { pref, newpref, F(Get##getmethod), F(Set##setmethod), PR_FALSE, -1 }
#define MAKESAMETYPEPREFTRANSFORM(pref, method)   { pref, 0, F(Get##method), F(Set##method), PR_FALSE, -1 }

Functions

static PRUint32 StringHash (const char *ubuf)
nsresult NS_MsgHashIfNecessary (nsCString &name)

Variables

static
nsSeamonkeyProfileMigrator::PrefTransform 
gTransforms []

Class Documentation

struct PrefBranchStruct

Definition at line 216 of file nsDogbertProfileMigrator.cpp.

Class Members
union PrefBranchStruct __unnamed__
union PrefBranchStruct __unnamed__
char * prefName
PRInt32 type
union PrefBranchStruct.__unnamed__

Definition at line 82 of file nsSeamonkeyProfileMigrator.cpp.

Class Members
PRBool boolValue
PRInt32 intValue
char * stringValue
PRUnichar * wstringValue

Define Documentation

Definition at line 392 of file nsSeamonkeyProfileMigrator.cpp.

Definition at line 72 of file nsSeamonkeyProfileMigrator.cpp.

Definition at line 68 of file nsSeamonkeyProfileMigrator.cpp.

Definition at line 73 of file nsSeamonkeyProfileMigrator.cpp.

Definition at line 71 of file nsSeamonkeyProfileMigrator.cpp.

Definition at line 75 of file nsSeamonkeyProfileMigrator.cpp.

Definition at line 70 of file nsSeamonkeyProfileMigrator.cpp.

Definition at line 69 of file nsSeamonkeyProfileMigrator.cpp.

Definition at line 76 of file nsSeamonkeyProfileMigrator.cpp.

Definition at line 74 of file nsSeamonkeyProfileMigrator.cpp.

Definition at line 77 of file nsSeamonkeyProfileMigrator.cpp.

Definition at line 62 of file nsSeamonkeyProfileMigrator.cpp.

Definition at line 61 of file nsSeamonkeyProfileMigrator.cpp.

#define MAKEPREFTRANSFORM (   pref,
  newpref,
  getmethod,
  setmethod 
)    { pref, newpref, F(Get##getmethod), F(Set##setmethod), PR_FALSE, -1 }

Definition at line 394 of file nsSeamonkeyProfileMigrator.cpp.

#define MAKESAMETYPEPREFTRANSFORM (   pref,
  method 
)    { pref, 0, F(Get##method), F(Set##method), PR_FALSE, -1 }

Definition at line 397 of file nsSeamonkeyProfileMigrator.cpp.

Definition at line 63 of file nsSeamonkeyProfileMigrator.cpp.


Function Documentation

Definition at line 889 of file nsSeamonkeyProfileMigrator.cpp.

{
#if defined(XP_MAC)
  const PRUint32 MAX_LEN = 25;
#elif defined(XP_UNIX) || defined(XP_BEOS)
  const PRUint32 MAX_LEN = 55;
#elif defined(XP_WIN32)
  const PRUint32 MAX_LEN = 55;
#elif defined(XP_OS2)
  const PRUint32 MAX_LEN = 55;
#else
  #error need_to_define_your_max_filename_length
#endif
  nsCAutoString illegalChars(FILE_PATH_SEPARATOR FILE_ILLEGAL_CHARACTERS);
  nsCAutoString str(name);

  // Given a filename, make it safe for filesystem
  // certain filenames require hashing because they 
  // are too long or contain illegal characters
  PRInt32 illegalCharacterIndex = str.FindCharInSet(illegalChars);
  char hashedname[MAX_LEN + 1];
  if (illegalCharacterIndex == kNotFound) 
  {
    // no illegal chars, it's just too long
    // keep the initial part of the string, but hash to make it fit
    if (str.Length() > MAX_LEN) 
    {
      PL_strncpy(hashedname, str.get(), MAX_LEN + 1);
      PR_snprintf(hashedname + MAX_LEN - 8, 9, "%08lx",
                (unsigned long) StringHash(str.get()));
      name = hashedname;
    }
  }
  else 
  {
      // found illegal chars, hash the whole thing
      // if we do substitution, then hash, two strings
      // could hash to the same value.
      // for example, on mac:  "foo__bar", "foo:_bar", "foo::bar"
      // would map to "foo_bar".  this way, all three will map to
      // different values
      PR_snprintf(hashedname, 9, "%08lx",
                (unsigned long) StringHash(str.get()));
      name = hashedname;
  }
  
  return NS_OK;
}

Here is the caller graph for this function:

static PRUint32 StringHash ( const char *  ubuf) [static]

Definition at line 878 of file nsSeamonkeyProfileMigrator.cpp.

{
  unsigned char * buf = (unsigned char*) ubuf;
  PRUint32 h=1;
  while(*buf) {
    h = 0x63c63cd9*h + 0x9c39c33d + (int32)*buf;
    buf++;
  }
  return h;
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 402 of file nsSeamonkeyProfileMigrator.cpp.