Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions
nsMailProfileMigratorUtils.h File Reference
#include "nsIPrefBranch.h"
#include "nsIFile.h"
#include "nsString.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


struct  MigrationData


#define MIGRATION_ITEMBEFOREMIGRATE   "Migration:ItemBeforeMigrate"
#define MIGRATION_ITEMAFTERMIGRATE   "Migration:ItemAfterMigrate"
#define MIGRATION_STARTED   "Migration:Started"
#define MIGRATION_ENDED   "Migration:Ended"
#define MIGRATION_PROGRESS   "Migration:Progress"
#define NOTIFY_OBSERVERS(message, item)   mObserverService->NotifyObservers(nsnull, message, item)
#define COPY_DATA(func, replace, itemIndex)


void ParseOverrideServers (const char *aServers, nsIPrefBranch *aBranch)
void SetProxyPref (const nsACString &aHostPort, const char *aPref, const char *aPortPref, nsIPrefBranch *aPrefs)
void GetMigrateDataFromArray (MigrationData *aDataArray, PRInt32 aDataArrayLength, PRBool aReplace, nsIFile *aSourceProfile, PRUint16 *aResult)
void GetProfilePath (nsIProfileStartup *aStartup, nsCOMPtr< nsIFile > &aProfileDir)

Class Documentation

struct MigrationData

Definition at line 69 of file nsMailProfileMigratorUtils.h.

Class Members
PRUnichar * fileName
PRBool replaceOnly
PRUint32 sourceFlag

Define Documentation

#define COPY_DATA (   func,
if (NS_SUCCEEDED(rv) && (aItems & itemIndex || !aItems)) { \
    nsAutoString index; \
    index.AppendInt(itemIndex); \
    rv = func(replace); \

Definition at line 50 of file nsMailProfileMigratorUtils.h.

#define MIGRATION_ENDED   "Migration:Ended"

Definition at line 44 of file nsMailProfileMigratorUtils.h.

#define MIGRATION_ITEMAFTERMIGRATE   "Migration:ItemAfterMigrate"

Definition at line 42 of file nsMailProfileMigratorUtils.h.

#define MIGRATION_ITEMBEFOREMIGRATE   "Migration:ItemBeforeMigrate"

Definition at line 41 of file nsMailProfileMigratorUtils.h.

#define MIGRATION_PROGRESS   "Migration:Progress"

Definition at line 45 of file nsMailProfileMigratorUtils.h.

#define MIGRATION_STARTED   "Migration:Started"

Definition at line 43 of file nsMailProfileMigratorUtils.h.

#define NOTIFY_OBSERVERS (   message,
)    mObserverService->NotifyObservers(nsnull, message, item)

Definition at line 47 of file nsMailProfileMigratorUtils.h.

Function Documentation

void GetMigrateDataFromArray ( MigrationData aDataArray,
PRInt32  aDataArrayLength,
PRBool  aReplace,
nsIFile aSourceProfile,
PRUint16 aResult 

Definition at line 89 of file nsMailProfileMigratorUtils.cpp.

  nsCOMPtr<nsIFile> sourceFile; 
  PRBool exists;
  MigrationData* cursor;
  MigrationData* end = aDataArray + aDataArrayLength;
  for (cursor = aDataArray; cursor < end && cursor->fileName; ++cursor) {
    // When in replace mode, all items can be imported. 
    // When in non-replace mode, only items that do not require file replacement
    // can be imported.
    if (aReplace || !cursor->replaceOnly) {
      if (exists)
        *aResult |= cursor->sourceFlag;
    cursor->fileName = nsnull;

Here is the call graph for this function:

void GetProfilePath ( nsIProfileStartup aStartup,
nsCOMPtr< nsIFile > &  aProfileDir 

Definition at line 114 of file nsMailProfileMigratorUtils.cpp.

  if (aStartup) {
  else {
    nsCOMPtr<nsIProperties> dirSvc
    if (dirSvc) {
      dirSvc->Get(NS_APP_USER_PROFILE_50_DIR, NS_GET_IID(nsIFile),
                  (void**) getter_AddRefs(aProfileDir));

Here is the call graph for this function:

void ParseOverrideServers ( const char *  aServers,
nsIPrefBranch aBranch 

Definition at line 67 of file nsMailProfileMigratorUtils.cpp.

  // Windows (and Opera) formats its proxy override list in the form:
  // server;server;server where server is a server name or ip address, 
  // or "<local>". Mozilla's format is server,server,server, and <local>
  // must be translated to "localhost,"
  nsCAutoString override(aServers);
  PRInt32 left = 0, right = 0;
  for (;;) {
    right = override.FindChar(';', right);
    const nsACString& host = Substring(override, left, 
                                       (right < 0 ? override.Length() : right) - left);
    if (host.Equals("<local>"))
      override.Replace(left, 7, NS_LITERAL_CSTRING("localhost,"));
    if (right < 0)
    left = right + 1;
    override.Replace(right, 1, NS_LITERAL_CSTRING(","));
  aBranch->SetCharPref("network.proxy.no_proxies_on", override.get());

Here is the call graph for this function:

void SetProxyPref ( const nsACString &  aHostPort,
const char *  aPref,
const char *  aPortPref,
nsIPrefBranch aPrefs 

Definition at line 48 of file nsMailProfileMigratorUtils.cpp.

  nsCAutoString hostPort(aHostPort);  
  PRInt32 portDelimOffset = hostPort.RFindChar(':');
  if (portDelimOffset > 0) {
    nsCAutoString host(Substring(hostPort, 0, portDelimOffset));
    nsCAutoString port(Substring(hostPort, portDelimOffset + 1, 
                                 hostPort.Length() - (portDelimOffset + 1)));
    aPrefs->SetCharPref(aPref, host.get());
    PRInt32 stringErr;
    PRInt32 portValue = port.ToInteger(&stringErr);
    aPrefs->SetIntPref(aPortPref, portValue);
    aPrefs->SetCharPref(aPref, hostPort.get());

Here is the call graph for this function: