Bug 361326 Address book directories obtained through RDF aren't always initialised properly (ldap part) r=iann_bugzilla,sr=bienvenu

This commit is contained in:
bugzilla%standard8.demon.co.uk 2007-01-21 18:49:58 +00:00
Родитель ff16df90e0
Коммит 40ab464980
2 изменённых файлов: 21 добавлений и 1 удалений

Просмотреть файл

@ -84,7 +84,13 @@ protected:
nsString m_ListNickName;
nsString m_Description;
PRBool m_IsMailList;
/*
* Note that any derived implementations should ensure that this item
* (m_DirPrefId) is correctly initialised correctly
*/
nsCString m_DirPrefId; // ie,"ldap_2.servers.pab"
nsCOMPtr<nsIPrefBranch> m_DirectoryPrefs;
nsCOMPtr<nsISupportsArray> m_AddressList;
};

Просмотреть файл

@ -84,6 +84,21 @@ NS_IMPL_ISUPPORTS_INHERITED4(nsAbLDAPDirectory, nsAbDirectoryRDFResource, nsIAbD
NS_IMETHODIMP nsAbLDAPDirectory::Init(const char* aURI)
{
mInitialized = PR_FALSE;
// We need to ensure that the m_DirPrefId is initialized properly
nsCAutoString uri(aURI);
// Find the first ? (of the search params) if there is one.
// We know we can start at the end of the moz-abldapdirectory:// because
// that's the URI we should have been passed.
PRInt32 searchCharLocation = uri.FindChar('?', kLDAPDirectoryRootLen);
if (searchCharLocation == kNotFound)
uri.Right(m_DirPrefId, uri.Length() - kLDAPDirectoryRootLen);
else
uri.Mid(m_DirPrefId, kLDAPDirectoryRootLen,
searchCharLocation - kLDAPDirectoryRootLen);
return nsAbDirectoryRDFResource::Init(aURI);
}
@ -623,4 +638,3 @@ NS_IMETHODIMP nsAbLDAPDirectory::SetDataVersion(const nsACString &aDataVersion)
{
return SetStringValue("dataVersion", aDataVersion);
}