Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions
nsComm4xProfile Class Reference

#include <nsComm4xProfile.h>

Inheritance diagram for nsComm4xProfile:
Inheritance graph
[legend]
Collaboration diagram for nsComm4xProfile:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsComm4xProfile ()
virtual ~nsComm4xProfile ()
nsresult Get4xProfileInfo (const char *registryName)
nsresult GetPrefValue (nsILocalFile *filePath, const char *prefName, const char *prefEnd, PRUnichar **value)
void getProfileList (out unsigned long length,[array, size_is(length), retval] out wstring selectList)
 Parses the 4.x registry file and returns a list of profiles.
wstring getMailDir (in wstring profileName)
 Searches the preferences file of the given profile for the pref mail.directory If the pref does not exist it, returns the default value.

Detailed Description

Definition at line 55 of file nsComm4xProfile.h.


Constructor & Destructor Documentation

Definition at line 77 of file nsComm4xProfile.cpp.

{
}

Definition at line 81 of file nsComm4xProfile.cpp.

{
}

Member Function Documentation

wstring nsIComm4xProfile::getMailDir ( in wstring  profileName) [inherited]

Searches the preferences file of the given profile for the pref mail.directory If the pref does not exist it, returns the default value.

Parameters:
profileNamename of the profile in the profiles array
Returns:
The path to the mail directory for the profile with the name profileName
nsresult nsComm4xProfile::GetPrefValue ( nsILocalFile filePath,
const char *  prefName,
const char *  prefEnd,
PRUnichar **  value 
)

Definition at line 238 of file nsComm4xProfile.cpp.

{
   nsString buffer;
   PRBool more = PR_TRUE;
   nsresult rv;
   nsCOMPtr<nsIFileInputStream> fileStream(do_CreateInstance(NS_LOCALFILEINPUTSTREAM_CONTRACTID, &rv));
   if (NS_FAILED(rv))
     return rv;
   rv = fileStream->Init(filePath, -1, -1, PR_FALSE);
   if (NS_FAILED(rv))
     return rv;
 
   nsCOMPtr<nsILineInputStream> lineStream(do_QueryInterface(fileStream, &rv));
   if (NS_FAILED(rv)) {
     return rv;
   }
   PRBool found = PR_FALSE;
   PRInt32 offset;
   PRInt32 endOffset;
   while (!found && more) {
      nsCAutoString cLine;
       rv = lineStream->ReadLine(cLine, &more);
       if (NS_FAILED(rv))
           break;
       CopyASCIItoUTF16(cLine, buffer);
       offset = buffer.Find(prefName,PR_FALSE, 0, -1);
       if (offset != kNotFound) {
           endOffset = buffer.Find(prefEnd,PR_FALSE, 0, -1);
           if (endOffset != kNotFound) {
               nsAutoString prefValue;
               buffer.Mid(prefValue, offset + PREF_LENGTH, endOffset-(offset + PREF_LENGTH));
               found = PR_TRUE;
               *retval = ToNewUnicode(prefValue);
               break;
           }
       }
  }

  fileStream->Close(); 
  return rv; 
}

Here is the call graph for this function:

void nsIComm4xProfile::getProfileList ( out unsigned long  length,
[array, size_is(length), retval] out wstring  selectList 
) [inherited]

Parses the 4.x registry file and returns a list of profiles.


The documentation for this class was generated from the following files: