mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-26 18:31:29 +00:00
Bug 331557 Remove nsIAbDirectoryProperties (Remove c++ uses of GetDirectoryProperties). r=Neil,sr=bienvenu
This commit is contained in:
parent
baadb38d0a
commit
1c4d5b51ed
@ -72,147 +72,171 @@ interface nsIAbDirectoryProperties : nsISupports {
|
||||
attribute long position;
|
||||
};
|
||||
|
||||
[scriptable, uuid(d6d55de3-261d-4149-987d-3a88ceb5f2a9)]
|
||||
[scriptable, uuid(93d8e498-7c03-4ad0-9cd4-933d43e3724a)]
|
||||
interface nsIAbDirectory : nsISupports {
|
||||
|
||||
// Types of operation
|
||||
// Perform linear reading of directory card
|
||||
// content
|
||||
const long opRead = 0x1;
|
||||
// Perform modification and deletion on a
|
||||
// directories content
|
||||
const long opWrite = 0x2;
|
||||
// Perform searching on a directory card
|
||||
// content via the uri format:
|
||||
// scheme://path?query
|
||||
const long opSearch = 0x4;
|
||||
// Types of operation
|
||||
// Perform linear reading of directory card
|
||||
// content
|
||||
const long opRead = 0x1;
|
||||
// Perform modification and deletion on a
|
||||
// directories content
|
||||
const long opWrite = 0x2;
|
||||
// Perform searching on a directory card
|
||||
// content via the uri format:
|
||||
// scheme://path?query
|
||||
const long opSearch = 0x4;
|
||||
|
||||
// The supported operations
|
||||
readonly attribute long operations;
|
||||
// The supported operations
|
||||
readonly attribute long operations;
|
||||
|
||||
// The description of the directory
|
||||
attribute wstring dirName;
|
||||
|
||||
// will be used for LDAP replication
|
||||
attribute unsigned long lastModifiedDate;
|
||||
// The description of the directory
|
||||
attribute wstring dirName;
|
||||
|
||||
// Defines whether this directory is a mail
|
||||
// list or not
|
||||
attribute PRBool isMailList;
|
||||
// XXX This should really be replaced by a QI or something better
|
||||
readonly attribute long dirType;
|
||||
|
||||
// XXX These are readonly for now, until we get nsIAbDirectoryProperties
|
||||
// eliminated a bit more.
|
||||
|
||||
// The filename for address books within this directory.
|
||||
// XXX This needs to be a ACString when Get*StringValue change
|
||||
readonly attribute string fileName;
|
||||
|
||||
// The URI of the address book
|
||||
readonly attribute ACString URI;
|
||||
|
||||
// The position of the directory on the display.
|
||||
readonly attribute long position;
|
||||
|
||||
// The palm sync category id.
|
||||
readonly attribute long palmSyncCategoryId;
|
||||
|
||||
// The palm sync time stamp
|
||||
readonly attribute unsigned long palmSyncTimeStamp;
|
||||
|
||||
// XXX End "readonly XXX"
|
||||
|
||||
// will be used for LDAP replication
|
||||
attribute unsigned long lastModifiedDate;
|
||||
|
||||
// Defines whether this directory is a mail
|
||||
// list or not
|
||||
attribute PRBool isMailList;
|
||||
|
||||
// Get the directory properties
|
||||
readonly attribute nsIAbDirectoryProperties directoryProperties;
|
||||
|
||||
// Get the children directories
|
||||
readonly attribute nsISimpleEnumerator childNodes;
|
||||
// Get the children directories
|
||||
readonly attribute nsISimpleEnumerator childNodes;
|
||||
|
||||
/**
|
||||
* Get the cards associated with the directory. This will return the cards
|
||||
* associated with the mailing lists too.
|
||||
*/
|
||||
readonly attribute nsISimpleEnumerator childCards;
|
||||
readonly attribute nsISimpleEnumerator childCards;
|
||||
|
||||
// Modifies a top level directory,
|
||||
// which also updates the preferences
|
||||
void modifyDirectory(in nsIAbDirectory directory, in nsIAbDirectoryProperties aProperties);
|
||||
|
||||
// Deletes either a mailing list or a top
|
||||
// level directory, which also updates the
|
||||
// preferences
|
||||
void deleteDirectory(in nsIAbDirectory dierctory);
|
||||
// Deletes either a mailing list or a top
|
||||
// level directory, which also updates the
|
||||
// preferences
|
||||
void deleteDirectory(in nsIAbDirectory dierctory);
|
||||
|
||||
// Delete the array of cards
|
||||
void deleteCards(in nsISupportsArray cards);
|
||||
// Delete the array of cards
|
||||
void deleteCards(in nsISupportsArray cards);
|
||||
|
||||
// Check if directory contains card
|
||||
// If the implementation is asynchronous the card
|
||||
// may not yet have arrived. If it is in the process
|
||||
// of obtaining cards the method will throw an
|
||||
// NS_ERROR_NOT_AVAILABLE exception if the card
|
||||
// cannot be found.
|
||||
boolean hasCard(in nsIAbCard cards);
|
||||
// Check if directory contains card
|
||||
// If the implementation is asynchronous the card
|
||||
// may not yet have arrived. If it is in the process
|
||||
// of obtaining cards the method will throw an
|
||||
// NS_ERROR_NOT_AVAILABLE exception if the card
|
||||
// cannot be found.
|
||||
boolean hasCard(in nsIAbCard cards);
|
||||
|
||||
// Check if directory contains directory
|
||||
boolean hasDirectory(in nsIAbDirectory dir);
|
||||
// Check if directory contains directory
|
||||
boolean hasDirectory(in nsIAbDirectory dir);
|
||||
|
||||
/**
|
||||
* return value is the card that got added
|
||||
* we need to do this, as the card we pass in might
|
||||
* be an abstract nsIAbCard, and the caller might need
|
||||
* the "real" card (the mdbcard) to get / set
|
||||
* non-standard card values
|
||||
*/
|
||||
nsIAbCard addCard(in nsIAbCard card);
|
||||
/**
|
||||
* return value is the card that got added
|
||||
* we need to do this, as the card we pass in might
|
||||
* be an abstract nsIAbCard, and the caller might need
|
||||
* the "real" card (the mdbcard or similar) to get / set
|
||||
* non-standard card values
|
||||
*/
|
||||
nsIAbCard addCard(in nsIAbCard card);
|
||||
|
||||
void dropCard(in nsIAbCard card, in boolean needToCopyCard);
|
||||
void dropCard(in nsIAbCard card, in boolean needToCopyCard);
|
||||
|
||||
/**
|
||||
* directory is local (example, mork based) or remote (example, LDAP)
|
||||
*/
|
||||
readonly attribute boolean isRemote;
|
||||
/**
|
||||
* directory is local (example, mork based) or remote (example, LDAP)
|
||||
*/
|
||||
readonly attribute boolean isRemote;
|
||||
|
||||
/**
|
||||
* directory is secure (as in LDAP over SSL)
|
||||
*/
|
||||
readonly attribute boolean isSecure;
|
||||
/**
|
||||
* directory is secure (as in LDAP over SSL)
|
||||
*/
|
||||
readonly attribute boolean isSecure;
|
||||
|
||||
/**
|
||||
* directory should be searched when doing local autocomplete
|
||||
*/
|
||||
readonly attribute boolean searchDuringLocalAutocomplete;
|
||||
/**
|
||||
* directory should be searched when doing local autocomplete
|
||||
*/
|
||||
readonly attribute boolean searchDuringLocalAutocomplete;
|
||||
|
||||
// Mail list specific
|
||||
readonly attribute boolean supportsMailingLists;
|
||||
// Mail list specific
|
||||
readonly attribute boolean supportsMailingLists;
|
||||
|
||||
// XXX todo
|
||||
// fix this, ugh
|
||||
// This attribute servers two purposes
|
||||
// depending if the directory is a mail list.
|
||||
// If not mail list directories are stored here
|
||||
// If so mail list card entries are stored here
|
||||
attribute nsISupportsArray addressLists;
|
||||
// XXX todo
|
||||
// fix this, ugh
|
||||
// This attribute servers two purposes
|
||||
// depending if the directory is a mail list.
|
||||
// If not mail list directories are stored here
|
||||
// If so mail list card entries are stored here
|
||||
attribute nsISupportsArray addressLists;
|
||||
|
||||
// Specific to a directory which stores mail lists
|
||||
// Specific to a directory which stores mail lists
|
||||
|
||||
// Creates a new mailing list in the directory
|
||||
// with the properties defined by list
|
||||
void addMailList (in nsIAbDirectory list);
|
||||
// Creates a new mailing list in the directory
|
||||
// with the properties defined by list
|
||||
void addMailList (in nsIAbDirectory list);
|
||||
|
||||
// Creates a new mailing list in the directory with
|
||||
// the properties defined by list and return a db key
|
||||
void addMailListWithKey (in nsIAbDirectory list, out PRUint32 key);
|
||||
|
||||
// Specific to a directory which is a mail list
|
||||
attribute wstring listNickName;
|
||||
attribute wstring description;
|
||||
// Specific to a directory which is a mail list
|
||||
attribute wstring listNickName;
|
||||
attribute wstring description;
|
||||
|
||||
/**
|
||||
* Edits an existing mailing list (specified as listCard)
|
||||
* into the directory specified by the uri
|
||||
* XXX javadoc me
|
||||
*/
|
||||
void editMailListToDatabase(in string uri, in nsIAbCard listCard);
|
||||
/**
|
||||
* Edits an existing mailing list (specified as listCard)
|
||||
* into the directory specified by the uri
|
||||
* XXX javadoc me
|
||||
*/
|
||||
void editMailListToDatabase(in string uri, in nsIAbCard listCard);
|
||||
|
||||
// Copies mail list properties from the srcList
|
||||
void copyMailList(in nsIAbDirectory srcList);
|
||||
// Copies mail list properties from the srcList
|
||||
void copyMailList(in nsIAbDirectory srcList);
|
||||
|
||||
/*
|
||||
Only creates a top level address book
|
||||
which is stored in the preferences
|
||||
/*
|
||||
Only creates a top level address book
|
||||
which is stored in the preferences
|
||||
|
||||
Need to change to factory based approach
|
||||
to create new address books
|
||||
Need to change to factory based approach
|
||||
to create new address books
|
||||
|
||||
This method should become redundant or
|
||||
be only associated with card folders
|
||||
*/
|
||||
void createNewDirectory(in nsIAbDirectoryProperties aProperties);
|
||||
This method should become redundant or
|
||||
be only associated with card folders
|
||||
*/
|
||||
void createNewDirectory(in nsIAbDirectoryProperties aProperties);
|
||||
|
||||
/* create a directory by passing the display name and address book uri */
|
||||
void createDirectoryByURI(in wstring displayName, in string uri, in boolean migrating);
|
||||
/* create a directory by passing the display name and address book uri */
|
||||
void createDirectoryByURI(in wstring displayName, in string uri, in boolean migrating);
|
||||
|
||||
wstring getValueForCard(in nsIAbCard card, in string name);
|
||||
void setValueForCard(in nsIAbCard card, in string name, in wstring value);
|
||||
wstring getValueForCard(in nsIAbCard card, in string name);
|
||||
void setValueForCard(in nsIAbCard card, in string name, in wstring value);
|
||||
|
||||
/**
|
||||
* The id of the directory used in prefs e.g. "ldap_2.servers.pab"
|
||||
@ -240,7 +264,9 @@ interface nsIAbDirectory : nsISupports {
|
||||
//@{
|
||||
long getIntValue(in string aName, in long aDefaultValue);
|
||||
boolean getBoolValue(in string aName, in boolean aDefaultValue);
|
||||
// XXX to do, convert Get*StringValue & users to use nsACString for result
|
||||
string getStringValue(in string aName, in string aDefaultValue);
|
||||
string getLocalizedStringValue(in string aName, in string aDefaultValue);
|
||||
//@}
|
||||
|
||||
/**
|
||||
|
@ -42,11 +42,16 @@
|
||||
#include "nsIAbCard.h"
|
||||
#include "nsDirPrefs.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefLocalizedString.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "prmem.h"
|
||||
#include "nsCRT.h"
|
||||
#include "rdf.h"
|
||||
|
||||
// From nsDirPrefs
|
||||
#define kDefaultMaxHits 100
|
||||
#define kDefaultPosition 1
|
||||
|
||||
nsAbDirProperty::nsAbDirProperty(void)
|
||||
: m_LastModifiedDate(0)
|
||||
{
|
||||
@ -106,6 +111,39 @@ NS_IMETHODIMP nsAbDirProperty::SetDirName(const PRUnichar * aDirName)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbDirProperty::GetDirType(PRInt32 *aDirType)
|
||||
{
|
||||
return GetIntValue("dirType", LDAPDirectory, aDirType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbDirProperty::GetFileName(char* *aFileName)
|
||||
{
|
||||
return GetStringValue("filename", "", aFileName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbDirProperty::GetURI(nsACString &aURI)
|
||||
{
|
||||
// XXX Should we complete this for Mailing Lists?
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbDirProperty::GetPosition(PRInt32 *aPosition)
|
||||
{
|
||||
return GetIntValue("position", kDefaultPosition, aPosition);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbDirProperty::GetPalmSyncCategoryId(PRInt32 *aPalmSyncCategoryId)
|
||||
{
|
||||
return GetIntValue("PalmCategoryId", -1, aPalmSyncCategoryId);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbDirProperty::GetPalmSyncTimeStamp(PRUint32 *aPalmSyncTimeStamp)
|
||||
{
|
||||
// Prefs only accept unsigned longs, but we need time stamp as a unsigned
|
||||
// int, so unfortunately we have to do this conversion
|
||||
return GetIntValue("PalmSyncTimeStamp", 0, (PRInt32*)aPalmSyncTimeStamp);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbDirProperty::GetLastModifiedDate(PRUint32 *aLastModifiedDate)
|
||||
{
|
||||
if (aLastModifiedDate)
|
||||
@ -318,60 +356,82 @@ NS_IMETHODIMP nsAbDirProperty::GetDirectoryProperties(nsIAbDirectoryProperties *
|
||||
NS_ENSURE_ARG_POINTER(aDirectoryProperties);
|
||||
|
||||
nsresult rv;
|
||||
DIR_Server *server = (DIR_Server *)PR_Malloc(sizeof(DIR_Server));
|
||||
if (!server)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
DIR_InitServer(server);
|
||||
nsCAutoString prefId;
|
||||
rv = GetDirPrefId(prefId);
|
||||
nsCOMPtr<nsIAbDirectoryProperties> properties = do_CreateInstance(NS_ABDIRECTORYPROPERTIES_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
server->prefName = ToNewCString(prefId);
|
||||
DIR_GetPrefsForOneServer(server, PR_FALSE, PR_FALSE);
|
||||
rv = properties->SetPrefName(m_DirPrefId.get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Now create the obj and move info in DIR_Server to it.
|
||||
nsCOMPtr<nsIAbDirectoryProperties> properties = do_CreateInstance(NS_ABDIRECTORYPROPERTIES_CONTRACTID, &rv);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
NS_ConvertUTF8toUTF16 description (server->description);
|
||||
|
||||
rv = properties->SetDescription(description);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = properties->SetFileName(server->fileName);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = properties->SetPrefName(server->prefName);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = properties->SetURI(server->uri);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = properties->SetDirType(server->dirType);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = properties->SetMaxHits(server->maxHits);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = properties->SetAuthDn(server->authDn);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = properties->SetCategoryId(server->PalmCategoryId);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = properties->SetSyncTimeStamp(server->PalmSyncTimeStamp);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = properties->SetPosition(server->position);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
NS_ADDREF(*aDirectoryProperties = properties);
|
||||
}
|
||||
nsXPIDLCString prefStringValue;
|
||||
PRInt32 prefIntValue;
|
||||
if (m_DirPrefId.EqualsLiteral("ldap_2.servers.pab") ||
|
||||
m_DirPrefId.EqualsLiteral("ldap_2.servers.history"))
|
||||
{
|
||||
// get default address book name from addressbook.properties
|
||||
rv = GetLocalizedStringValue("description", "", getter_Copies(prefStringValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = GetStringValue("description", "", getter_Copies(prefStringValue));
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = properties->SetDescription(NS_ConvertUTF8toUTF16(prefStringValue));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = GetDirType(&prefIntValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = properties->SetDirType(prefIntValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = GetFileName(getter_Copies(prefStringValue));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = properties->SetFileName(prefStringValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// the string "s" is the default uri ( <scheme> + "://" + <filename> )
|
||||
rv = GetURI(prefStringValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = properties->SetURI(prefStringValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = GetIntValue("maxHits", kDefaultMaxHits, &prefIntValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = properties->SetMaxHits(prefIntValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = GetStringValue("auth.dn", nsnull, getter_Copies(prefStringValue));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = properties->SetAuthDn(prefStringValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = GetPalmSyncCategoryId(&prefIntValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = properties->SetCategoryId(prefIntValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRUint32 timeStamp;
|
||||
rv = GetPalmSyncTimeStamp(&timeStamp);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = properties->SetSyncTimeStamp(timeStamp);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = GetPosition(&prefIntValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = properties->SetPosition(prefIntValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_ADDREF(*aDirectoryProperties = properties);
|
||||
|
||||
DIR_DeleteServer(server);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "nsAbDirProperty::GetDirPrefId failed!");
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -442,6 +502,41 @@ NS_IMETHODIMP nsAbDirProperty::GetStringValue(const char *aName,
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
/*
|
||||
* Get localized unicode string pref from properties file, convert into an
|
||||
* UTF8 string since address book prefs store as UTF8 strings. So far there
|
||||
* are 2 default prefs stored in addressbook.properties.
|
||||
* "ldap_2.servers.pab.description"
|
||||
* "ldap_2.servers.history.description"
|
||||
*/
|
||||
NS_IMETHODIMP nsAbDirProperty::GetLocalizedStringValue(const char *aName,
|
||||
const char *aDefaultValue,
|
||||
char * *aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
if (!m_DirectoryPrefs && NS_FAILED(InitDirectoryPrefs()))
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsXPIDLString wvalue;
|
||||
nsCOMPtr<nsIPrefLocalizedString> locStr;
|
||||
|
||||
nsresult rv = m_DirectoryPrefs->GetComplexValue(aName,
|
||||
NS_GET_IID(nsIPrefLocalizedString),
|
||||
getter_AddRefs(locStr));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = locStr->ToString(getter_Copies(wvalue));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (wvalue.IsEmpty())
|
||||
*aResult = aDefaultValue ? nsCRT::strdup(aDefaultValue) : nsnull;
|
||||
else
|
||||
*aResult = ToNewUTF8String(wvalue);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbDirProperty::SetIntValue(const char *aName,
|
||||
PRInt32 aValue)
|
||||
|
@ -206,6 +206,25 @@ nsresult nsAbLDAPDirectory::InitiateConnection ()
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHODIMP nsAbLDAPDirectory::GetURI(nsACString &aURI)
|
||||
{
|
||||
// XXX to do, convert GetStringValue & users to use nsACString for result
|
||||
nsXPIDLCString result;
|
||||
nsresult rv = GetStringValue("uri", "", getter_Copies(result));
|
||||
|
||||
if (result.IsEmpty())
|
||||
{
|
||||
rv = GetFileName(getter_Copies(result));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
result.Insert(kLDAPDirectoryRoot, 0);
|
||||
}
|
||||
|
||||
aURI = result;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbLDAPDirectory::GetOperations(PRInt32 *aOperations)
|
||||
{
|
||||
*aOperations = nsIAbDirectory::opSearch;
|
||||
|
@ -64,7 +64,8 @@ public:
|
||||
|
||||
NS_IMETHOD Init(const char *aUri);
|
||||
|
||||
// nsIAbDirectory methods
|
||||
// nsIAbDirectory methods
|
||||
NS_IMETHOD GetURI(nsACString &aURI);
|
||||
NS_IMETHOD GetOperations(PRInt32 *aOperations);
|
||||
NS_IMETHOD GetChildNodes(nsISimpleEnumerator* *result);
|
||||
NS_IMETHOD GetChildCards(nsISimpleEnumerator* *result);
|
||||
|
@ -109,12 +109,8 @@ nsresult nsAbLDAPReplicationQuery::InitLDAPData()
|
||||
nsCOMPtr<nsIAbDirectory> abDirectory(do_QueryInterface(mDirectory, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAbDirectoryProperties> dirProperties;
|
||||
rv = abDirectory->GetDirectoryProperties(getter_AddRefs(dirProperties));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsXPIDLCString uri;
|
||||
rv = dirProperties->GetURI(getter_Copies(uri));
|
||||
nsCAutoString uri;
|
||||
rv = abDirectory->GetURI(uri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mURL->SetSpec(uri);
|
||||
|
@ -317,6 +317,25 @@ NS_IMETHODIMP nsAbMDBDirectory::GetDirUri(char **uri)
|
||||
|
||||
// nsIAbDirectory methods
|
||||
|
||||
NS_IMETHODIMP nsAbMDBDirectory::GetURI(nsACString &aURI)
|
||||
{
|
||||
// XXX to do, convert GetStringValue & users to use nsACString for result
|
||||
nsXPIDLCString result;
|
||||
nsresult rv = GetStringValue("uri", "", getter_Copies(result));
|
||||
|
||||
if (result.IsEmpty())
|
||||
{
|
||||
rv = GetFileName(getter_Copies(result));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
result.Insert(kMDBDirectoryRoot, 0);
|
||||
}
|
||||
|
||||
aURI = result;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbMDBDirectory::GetChildNodes(nsISimpleEnumerator* *aResult)
|
||||
{
|
||||
if (mIsQueryURI)
|
||||
|
@ -75,6 +75,7 @@ public:
|
||||
NS_DECL_NSIADDRDBLISTENER
|
||||
|
||||
// nsIAbMDBDirectory methods
|
||||
NS_IMETHOD GetURI(nsACString &aURI);
|
||||
NS_IMETHOD ClearDatabase();
|
||||
NS_IMETHOD NotifyDirItemAdded(nsISupports *item) { return NotifyItemAdded(item);}
|
||||
NS_IMETHOD RemoveElementsFromAddressList();
|
||||
|
@ -148,6 +148,26 @@ NS_IMETHODIMP nsAbOutlookDirectory::Init(const char *aUri)
|
||||
}
|
||||
|
||||
// nsIAbDirectory methods
|
||||
|
||||
NS_IMETHODIMP nsAbOutlookDirectory::GetURI(nsACString &aURI)
|
||||
{
|
||||
// XXX to do, convert GetStringValue & users to use nsACString for result
|
||||
nsXPIDLCString result;
|
||||
nsresult rv = GetStringValue("uri", "", getter_Copies(result));
|
||||
|
||||
if (result.IsEmpty())
|
||||
{
|
||||
rv = GetFileName(getter_Copies(result));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
result.Insert(kMDBDirectoryRoot);
|
||||
}
|
||||
|
||||
aURI = result;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbOutlookDirectory::GetChildNodes(nsISimpleEnumerator **aNodes)
|
||||
{
|
||||
if (!aNodes) { return NS_ERROR_NULL_POINTER ; }
|
||||
|
@ -124,6 +124,7 @@ static DIR_Server *dir_MatchServerPrefToServer(nsVoidArray *wholeList, const cha
|
||||
static PRBool dir_ValidateAndAddNewServer(nsVoidArray *wholeList, const char *fullprefname);
|
||||
static void DIR_DeleteServerList(nsVoidArray *wholeList);
|
||||
static char *dir_CreateServerPrefName(DIR_Server *server);
|
||||
static void DIR_GetPrefsForOneServer (DIR_Server *server, PRBool reinitialize, PRBool oldstyle /* 4.0 Branch */);
|
||||
|
||||
|
||||
static PRInt32 dir_UserId = 0;
|
||||
@ -1624,7 +1625,7 @@ static char *dir_CreateServerPrefName (DIR_Server *server)
|
||||
return prefName;
|
||||
}
|
||||
|
||||
void DIR_GetPrefsForOneServer (DIR_Server *server, PRBool reinitialize, PRBool oldstyle /* 4.0 Branch */)
|
||||
static void DIR_GetPrefsForOneServer (DIR_Server *server, PRBool reinitialize, PRBool oldstyle /* 4.0 Branch */)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPrefBranch> pPref(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||
|
@ -181,7 +181,6 @@ PRBool DIR_SetServerPosition(nsVoidArray *wholeList, DIR_Server *server, PRInt32
|
||||
*/
|
||||
nsresult DIR_GetServerPreferences(nsVoidArray** list);
|
||||
nsresult DIR_SaveServerPreferences(nsVoidArray *wholeList);
|
||||
void DIR_GetPrefsForOneServer(DIR_Server *server, PRBool reinitialize, PRBool oldstyle);
|
||||
void DIR_SavePrefsForOneServer(DIR_Server *server);
|
||||
|
||||
void DIR_SetServerFileName(DIR_Server* pServer);
|
||||
|
@ -706,16 +706,12 @@ nsAbDirectoryDataSource::createDirectoryTreeNameSortNode(nsIAbDirectory* directo
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// Get directory type.
|
||||
nsCOMPtr <nsIAbDirectoryProperties> properties;
|
||||
rv = directory->GetDirectoryProperties(getter_AddRefs(properties));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRUint32 dirType;
|
||||
rv = properties->GetDirType(&dirType);
|
||||
PRInt32 dirType;
|
||||
rv = directory->GetDirType(&dirType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 position;
|
||||
rv = properties->GetPosition(&position);
|
||||
rv = directory->GetPosition(&position);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// top level sort will be by position. Sort by type under that...
|
||||
|
@ -157,20 +157,21 @@ STDMETHODIMP CPalmSyncImp::nsGetABList(BOOL aIsUnicode, short * aABListCount,
|
||||
nsCOMPtr <nsIAbDirectory> subDirectory = do_QueryInterface(item, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr <nsIAbDirectoryProperties> properties;
|
||||
nsXPIDLCString fileName;
|
||||
rv = subDirectory->GetDirectoryProperties(getter_AddRefs(properties));
|
||||
rv = subDirectory->GetFileName(getter_Copies(fileName));
|
||||
if(NS_FAILED(rv))
|
||||
continue;
|
||||
rv = properties->GetFileName(getter_Copies(fileName));
|
||||
PRInt32 dirType;
|
||||
rv = subDirectory->GetDirType(&dirType);
|
||||
if(NS_FAILED(rv))
|
||||
continue;
|
||||
PRUint32 dirType;
|
||||
rv = properties->GetDirType(&dirType);
|
||||
nsCAutoString prefName;
|
||||
subDirectory->GetDirPrefId(prefName);
|
||||
prefName.Append(".disablePalmSync");
|
||||
PRBool disableThisAB = GetBoolPref(prefName.get(), PR_FALSE);
|
||||
|
||||
PRBool disableThisAB;
|
||||
rv = subDirectory->GetBoolValue("disablePalmSync",
|
||||
PR_FALSE, &disableThisAB);
|
||||
if (NS_FAILED(rv))
|
||||
continue;
|
||||
|
||||
// Skip/Ignore 4.X addrbooks (ie, with ".na2" extension), and non personal AB's
|
||||
if (disableThisAB || ((fileName.Length() > kABFileName_PreviousSuffixLen) &&
|
||||
strcmp(fileName.get() + fileName.Length() - kABFileName_PreviousSuffixLen, kABFileName_PreviousSuffix) == 0) ||
|
||||
@ -203,31 +204,29 @@ STDMETHODIMP CPalmSyncImp::nsGetABList(BOOL aIsUnicode, short * aABListCount,
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
// We don't have to skip mailing list since there's no mailing lists at the top level.
|
||||
nsCOMPtr <nsIAbDirectoryProperties> properties;
|
||||
rv = directory->GetDirectoryProperties(getter_AddRefs(properties));
|
||||
if(NS_FAILED(rv)) return E_FAIL;
|
||||
|
||||
nsXPIDLCString fileName, uri;
|
||||
nsXPIDLCString fileName;
|
||||
nsAutoCString uri;
|
||||
nsAutoString description;
|
||||
PRUint32 dirType, palmSyncTimeStamp;
|
||||
PRInt32 palmCategoryIndex;
|
||||
PRUint32 palmSyncTimeStamp;
|
||||
PRInt32 dirType, palmCategoryIndex;
|
||||
|
||||
rv = properties->GetDescription(description);
|
||||
rv = directory->GetDescription(description);
|
||||
if(NS_FAILED(rv)) return E_FAIL;
|
||||
rv = properties->GetFileName(getter_Copies(fileName));
|
||||
rv = directory->GetFileName(getter_Copies(fileName));
|
||||
if(NS_FAILED(rv)) return E_FAIL;
|
||||
rv = properties->GetURI(getter_Copies(uri));
|
||||
rv = directory->GetURI(uri);
|
||||
if(NS_FAILED(rv)) return E_FAIL;
|
||||
rv = properties->GetDirType(&dirType);
|
||||
rv = directory->GetDirType(&dirType);
|
||||
if(NS_FAILED(rv)) return E_FAIL;
|
||||
rv = properties->GetSyncTimeStamp(&palmSyncTimeStamp);
|
||||
rv = directory->GetSyncTimeStamp(&palmSyncTimeStamp);
|
||||
if(NS_FAILED(rv)) return E_FAIL;
|
||||
rv = properties->GetCategoryId(&palmCategoryIndex);
|
||||
rv = directory->GetCategoryId(&palmCategoryIndex);
|
||||
if(NS_FAILED(rv)) return E_FAIL;
|
||||
nsCAutoString prefName;
|
||||
directory->GetDirPrefId(prefName);
|
||||
prefName.Append(".disablePalmSync");
|
||||
PRBool disableThisAB = GetBoolPref(prefName.get(), PR_FALSE);
|
||||
|
||||
PRBool disableThisAB;
|
||||
rv = directory->GetBoolValue("disablePalmSync", PR_FALSE, &disableThisAB);
|
||||
if (NS_FAILED(rv)) return E_FAIL;
|
||||
|
||||
// Skip/Ignore 4.X addrbooks (ie, with ".na2" extension), and non personal AB's
|
||||
if (disableThisAB || ((fileName.Length() > kABFileName_PreviousSuffixLen) &&
|
||||
strcmp(fileName.get() + fileName.Length() - kABFileName_PreviousSuffixLen, kABFileName_PreviousSuffix) == 0) ||
|
||||
@ -266,7 +265,12 @@ STDMETHODIMP CPalmSyncImp::nsGetABList(BOOL aIsUnicode, short * aABListCount,
|
||||
if (palmSyncTimeStamp <= 0)
|
||||
dirFlag |= kFirstTimeSyncDirFlag;
|
||||
// was this the pab?
|
||||
if (prefName.Equals("ldap_2.servers.pab.disablePalmSync"))
|
||||
nsCAutoString prefName;
|
||||
rv = directory->GetDirPrefId(prefName);
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
|
||||
if (prefName.Equals("ldap_2.servers.pab"))
|
||||
dirFlag |= kIsPabDirFlag;
|
||||
*dirFlagsList = (BOOL) dirFlag;
|
||||
dirFlagsList++;
|
||||
|
Loading…
Reference in New Issue
Block a user