зеркало из https://github.com/mozilla/pjs.git
Bug #395701 --> migrate the address book to glue code.
Patch by Prasad Sunkari <prasad@medhas.org> r=standard8 sr=mscott
This commit is contained in:
Родитель
74472285e6
Коммит
88089cfe22
|
@ -39,8 +39,6 @@
|
|||
|
||||
#include "msgCore.h" // for pre-compiled headers
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#include "nsIAbCard.h"
|
||||
#include "nsAbBaseCID.h"
|
||||
#include "nsAbAddressCollecter.h"
|
||||
|
@ -50,9 +48,10 @@
|
|||
#include "nsIMsgHeaderParser.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "prmem.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIAbMDBDirectory.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsAbAddressCollecter, nsIAbAddressCollecter, nsIObserver)
|
||||
|
@ -227,8 +226,7 @@ nsresult nsAbAddressCollecter::AutoCollectScreenName(nsIAbCard *aCard, const nsA
|
|||
if (atPos == -1)
|
||||
return NS_OK;
|
||||
|
||||
nsCString domain;
|
||||
email.Right(domain, aEmail.Length() - (atPos + 1));
|
||||
nsCString domain(Substring(email, atPos + 1));
|
||||
if (domain.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
|
@ -239,8 +237,7 @@ nsresult nsAbAddressCollecter::AutoCollectScreenName(nsIAbCard *aCard, const nsA
|
|||
// are all AIM screennames. autocollect that info.
|
||||
if (domain.Equals("aol.com") ||
|
||||
domain.Equals("cs.com") || domain.Equals("netscape.net")) {
|
||||
nsCString userName;
|
||||
email.Left(userName, atPos);
|
||||
nsCString userName(Substring(email, 0, atPos));
|
||||
|
||||
rv = aCard->SetAimScreenName(NS_ConvertUTF8toUTF16(userName));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
@ -284,18 +281,11 @@ nsAbAddressCollecter::SetNamesForCard(nsIAbCard *aSenderCard, const nsACString &
|
|||
|
||||
nsresult nsAbAddressCollecter::SplitFullName(const nsACString &aFullName, nsACString &aFirstName, nsACString &aLastName)
|
||||
{
|
||||
nsCString lastName;
|
||||
nsCString firstName;
|
||||
|
||||
int index = nsCString(aFullName).RFindChar(' ');
|
||||
if (index != -1)
|
||||
{
|
||||
nsCString(aFullName).Right(lastName, aFullName.Length() - (index + 1));
|
||||
nsCString(aFullName).Left(firstName, index);
|
||||
|
||||
aLastName = lastName;
|
||||
aFirstName = firstName;
|
||||
|
||||
aLastName = Substring(aFullName, index + 1);
|
||||
aFirstName = Substring(aFullName, 0, index);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -38,12 +38,11 @@
|
|||
|
||||
#include "msgCore.h"
|
||||
#include "nsAbAutoCompleteSession.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsIAbDirectory.h"
|
||||
#include "nsIAbCard.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsMsgI18N.h"
|
||||
|
@ -54,6 +53,8 @@
|
|||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIAbMDBDirectory.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsAbAutoCompleteSession, nsIAbAutoCompleteSession, nsIAutoCompleteSession)
|
||||
|
||||
|
@ -92,8 +93,13 @@ PRBool nsAbAutoCompleteSession::ItsADuplicate(PRUnichar* fullAddrStr, PRInt32 aP
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = resultItem->GetValue(valueStr);
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
if (NS_SUCCEEDED(rv) && !valueStr.IsEmpty()
|
||||
&& nsDependentString(fullAddrStr).Equals(valueStr, nsCaseInsensitiveStringComparator()))
|
||||
#else
|
||||
if (NS_SUCCEEDED(rv) && !valueStr.IsEmpty()
|
||||
&& nsDependentString(fullAddrStr).Equals(valueStr, CaseInsensitiveCompare))
|
||||
#endif
|
||||
{
|
||||
// ok, we have a duplicate, but before we ignore the dupe, check the popularity index
|
||||
// and use the card that is the most popular so it gets sorted correctly
|
||||
|
@ -144,7 +150,7 @@ nsAbAutoCompleteSession::AddToResult(const PRUnichar* pNickNameStr,
|
|||
return;
|
||||
|
||||
nsAutoString aStr(pDisplayNameStr);
|
||||
if (aStr.FindChar('@') == kNotFound)
|
||||
if (aStr.FindChar('@') == -1)
|
||||
{
|
||||
aStr.Append(PRUnichar('@'));
|
||||
aStr += mDefaultDomain;
|
||||
|
@ -277,9 +283,15 @@ static PRBool CommonPrefix(const PRUnichar *aString, const PRUnichar *aSubstr, P
|
|||
if (!aSubstrLen || (NS_strlen(aString) < static_cast<PRUint32>(aSubstrLen)))
|
||||
return PR_FALSE;
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
return (Substring(aString,
|
||||
aString+aSubstrLen).Equals(Substring(aSubstr, aSubstr+aSubstrLen),
|
||||
nsCaseInsensitiveStringComparator()));
|
||||
#else
|
||||
return (Substring(aString,
|
||||
aString+aSubstrLen).Equals(Substring(aSubstr, aSubstr+aSubstrLen),
|
||||
CaseInsensitiveCompare));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -309,6 +321,7 @@ nsAbAutoCompleteSession::CheckEntry(nsAbAutoCompleteSearchString* searchStr,
|
|||
nsDependentString fullStringStr(fullString, fullStringLen);
|
||||
|
||||
// Compare various properties looking for a match (exact or partial)
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
if ( (nickName &&
|
||||
fullStringStr.Equals(nsDependentString(nickName), nsCaseInsensitiveStringComparator())) ||
|
||||
(displayName &&
|
||||
|
@ -324,6 +337,24 @@ nsAbAutoCompleteSession::CheckEntry(nsAbAutoCompleteSearchString* searchStr,
|
|||
(firstName && CommonPrefix(firstName, fullString, fullStringLen)) ||
|
||||
(lastName && CommonPrefix(lastName, fullString, fullStringLen)) ||
|
||||
(emailAddress && CommonPrefix(emailAddress, fullString, fullStringLen)) )
|
||||
#else
|
||||
if ( (nickName &&
|
||||
fullStringStr.Equals(nsDependentString(nickName), CaseInsensitiveCompare)) ||
|
||||
(displayName &&
|
||||
fullStringStr.Equals(nsDependentString(displayName), CaseInsensitiveCompare)) ||
|
||||
(firstName &&
|
||||
fullStringStr.Equals(nsDependentString(firstName), CaseInsensitiveCompare)) ||
|
||||
(lastName &&
|
||||
fullStringStr.Equals(nsDependentString(lastName), CaseInsensitiveCompare)) ||
|
||||
(emailAddress &&
|
||||
fullStringStr.Equals(nsDependentString(emailAddress), CaseInsensitiveCompare)) ||
|
||||
(nickName && CommonPrefix(nickName, fullString, fullStringLen)) ||
|
||||
(displayName && CommonPrefix(displayName, fullString, fullStringLen)) ||
|
||||
(firstName && CommonPrefix(firstName, fullString, fullStringLen)) ||
|
||||
(lastName && CommonPrefix(lastName, fullString, fullStringLen)) ||
|
||||
(emailAddress && CommonPrefix(emailAddress, fullString, fullStringLen)) )
|
||||
#endif
|
||||
|
||||
isAMatch = PR_TRUE;
|
||||
//If we have a muti-part search string, look for a partial match with first name and last name or reverse
|
||||
else if (searchStr->mFirstPartLen && searchStr->mSecondPartLen)
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
#include "msgCore.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsIMsgHeaderParser.h"
|
||||
#include "nsIAbDirectory.h"
|
||||
#include "nsIAbAutoCompleteSession.h"
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
#include "nsIAbLDAPAttributeMap.h"
|
||||
#include "nsAbBoolExprToLDAPFilter.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
const int nsAbBoolExprToLDAPFilter::TRANSLATE_CARD_PROPERTY = 1 << 0 ;
|
||||
const int nsAbBoolExprToLDAPFilter::ALLOW_NON_CONVERTABLE_CARD_PROPERTY = 1 << 1 ;
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
#include "nsIAbBooleanExpression.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
class nsIAbLDAPAttributeMap;
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAbBooleanExpression.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsAbBooleanConditionString, nsIAbBooleanConditionString)
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
#include "nsIAbBooleanExpression.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
class nsAbBooleanConditionString : public nsIAbBooleanConditionString
|
||||
{
|
||||
|
|
|
@ -40,10 +40,9 @@
|
|||
|
||||
#include "nsAbCardProperty.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsAbBaseCID.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
|
@ -59,6 +58,8 @@
|
|||
#include "nsRDFCID.h"
|
||||
#include "nsMsgUtils.h"
|
||||
#include "nsINetUtil.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "nsVCardObj.h"
|
||||
|
||||
|
@ -1228,7 +1229,7 @@ NS_IMETHODIMP nsAbCardProperty::ConvertToXMLPrintData(nsAString &aXMLSubstr)
|
|||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsString xmlStr;
|
||||
xmlStr.SetCapacity(4096); // to reduce allocations. should be enough for most cards
|
||||
xmlStr.SetLength(4096); // to reduce allocations. should be enough for most cards
|
||||
xmlStr.AssignLiteral("<GeneratedName>\n");
|
||||
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
#include "nsIAbCard.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
class nsIStringBundle;
|
||||
class mozITXTToHTMLConv;
|
||||
|
|
|
@ -38,13 +38,12 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "plstr.h"
|
||||
|
||||
#include "nsAbBaseCID.h"
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "nsIPrefLocalizedString.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "prmem.h"
|
||||
#include "nsCRT.h"
|
||||
#include "rdf.h"
|
||||
#include "nsIAddrBookSession.h"
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsDirPrefs.h"
|
||||
#include "nsIAddrDatabase.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
|
||||
/*
|
||||
|
|
|
@ -44,8 +44,7 @@
|
|||
|
||||
#include "nsIRDFResource.h"
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsIAbDirSearchListener.h"
|
||||
|
||||
|
@ -490,14 +489,19 @@ nsresult nsAbDirectoryQuery::matchCardCondition (nsIAbCard* card,
|
|||
*matchFound = PR_TRUE;
|
||||
break;
|
||||
case nsIAbBooleanConditionTypes::Contains:
|
||||
// When we move to frozen linkage, this should be:
|
||||
// *matchFound = value.Find(matchValue, CaseInsensitiveCompare) >= 0;
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
*matchFound = FindInReadable(matchValue, value, nsCaseInsensitiveStringComparator());
|
||||
#else
|
||||
*matchFound = value.Find(matchValue, CaseInsensitiveCompare) >= 0;
|
||||
#endif
|
||||
|
||||
break;
|
||||
case nsIAbBooleanConditionTypes::DoesNotContain:
|
||||
// When we move to frozen linkage, this should be:
|
||||
// *matchFound = value.Find(matchValue, CaseInsensitiveCompare) == -1;
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
*matchFound = !FindInReadable(matchValue, value, nsCaseInsensitiveStringComparator());
|
||||
#else
|
||||
*matchFound = value.Find(matchValue, CaseInsensitiveCompare) == -1;
|
||||
#endif
|
||||
break;
|
||||
case nsIAbBooleanConditionTypes::Is:
|
||||
*matchFound = value.Equals(matchValue, nsCaseInsensitiveStringComparator());
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsIAbDirectoryQuery.h"
|
||||
#include "nsIAbDirectory.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
class nsAbDirectoryQuerySimpleBooleanExpression : public nsIAbBooleanExpression
|
||||
|
|
|
@ -39,7 +39,8 @@
|
|||
#include "nsAbDirectoryRDFResource.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
nsAbDirectoryRDFResource::nsAbDirectoryRDFResource () :
|
||||
nsRDFResource (),
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#define nsAbDirectoryRDFResource_h__
|
||||
|
||||
#include "nsRDFResource.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
class nsAbDirectoryRDFResource : public nsRDFResource
|
||||
{
|
||||
|
|
|
@ -39,14 +39,15 @@
|
|||
|
||||
#include "nsAbLDAPAutoCompFormatter.h"
|
||||
#include "nsIAutoCompleteResults.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIMsgHeaderParser.h"
|
||||
#include "nsILDAPMessage.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsNetError.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsILDAPErrors.h"
|
||||
|
||||
#define LDAP_ERROR_BUNDLE "chrome://mozldap/locale/ldap.properties"
|
||||
|
@ -443,9 +444,8 @@ nsAbLDAPAutoCompFormatter::ProcessFormat(const nsAString & aFormat,
|
|||
|
||||
// get some iterators to parse aFormat
|
||||
//
|
||||
nsReadingIterator<PRUnichar> iter, iterEnd;
|
||||
aFormat.BeginReading(iter);
|
||||
aFormat.EndReading(iterEnd);
|
||||
const PRUnichar *iter = aFormat.BeginReading();
|
||||
const PRUnichar *iterEnd = aFormat.EndReading();
|
||||
|
||||
// get the console service for error logging
|
||||
//
|
||||
|
@ -473,8 +473,8 @@ nsAbLDAPAutoCompFormatter::ProcessFormat(const nsAString & aFormat,
|
|||
|
||||
case PRUnichar('['):
|
||||
|
||||
rv = ParseAttrName(iter, iterEnd, attrRequired, consoleSvc,
|
||||
attrName);
|
||||
rv = ParseAttrName(iter, iterEnd, attrRequired,
|
||||
consoleSvc, attrName);
|
||||
if ( NS_FAILED(rv) ) {
|
||||
|
||||
// something unrecoverable happened; stop parsing and
|
||||
|
@ -486,8 +486,22 @@ nsAbLDAPAutoCompFormatter::ProcessFormat(const nsAString & aFormat,
|
|||
// if we're building an array
|
||||
if ( aAttrs ) {
|
||||
|
||||
// see if the string is already present in the array
|
||||
int i = 0, found = -1;
|
||||
while ( i < aAttrs->Count() ) {
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
if (aAttrs->CStringAt(i)->Equals(attrName, nsCaseInsensitiveCStringComparator())) {
|
||||
#else
|
||||
if (aAttrs->CStringAt(i)->Equals(attrName, CaseInsensitiveCompare)) {
|
||||
#endif
|
||||
found = i;
|
||||
break;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
// and it doesn't already contain this string
|
||||
if (aAttrs->IndexOfIgnoreCase(attrName) == -1) {
|
||||
if (found == -1) {
|
||||
|
||||
// add it
|
||||
if (!aAttrs->AppendCString(attrName)) {
|
||||
|
@ -556,7 +570,7 @@ nsAbLDAPAutoCompFormatter::ProcessFormat(const nsAString & aFormat,
|
|||
|
||||
// this character gets treated as a literal
|
||||
//
|
||||
aValue->Append(NS_ConvertUTF16toUTF8(nsDependentString(iter.get(),1)));
|
||||
aValue->Append(NS_ConvertUTF16toUTF8(nsDependentString(iter,1)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -568,8 +582,8 @@ nsAbLDAPAutoCompFormatter::ProcessFormat(const nsAString & aFormat,
|
|||
|
||||
nsresult
|
||||
nsAbLDAPAutoCompFormatter::ParseAttrName(
|
||||
nsReadingIterator<PRUnichar> &aIter, // iterators for mOutputString
|
||||
nsReadingIterator<PRUnichar> &aIterEnd,
|
||||
const PRUnichar *aIter, // iterators for mOutputString
|
||||
const PRUnichar *aIterEnd,
|
||||
PRBool aAttrRequired, // required? or just optional?
|
||||
nsCOMPtr<nsIConsoleService> &aConsoleSvc, // no need to reacquire this
|
||||
nsACString &aAttrName) // attribute token
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsIAbLDAPAutoCompFormatter.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
@ -65,8 +65,8 @@ class nsAbLDAPAutoCompFormatter : public nsIAbLDAPAutoCompFormatter
|
|||
nsCStringArray *aAttrs);
|
||||
|
||||
// process a single attribute while parsing format
|
||||
nsresult ParseAttrName(nsReadingIterator<PRUnichar> & aIter,
|
||||
nsReadingIterator<PRUnichar> & aIterEnd,
|
||||
nsresult ParseAttrName(const PRUnichar *aIter,
|
||||
const PRUnichar *aIterEnd,
|
||||
PRBool aAttrRequired,
|
||||
nsCOMPtr<nsIConsoleService> & aConsoleSvc,
|
||||
nsACString & aAttrName);
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#define nsAbLDAPChangeLogQuery_h__
|
||||
|
||||
#include "nsAbLDAPReplicationQuery.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
class nsAbLDAPChangeLogQuery : public nsIAbLDAPChangeLogQuery,
|
||||
public nsAbLDAPReplicationQuery
|
||||
|
|
|
@ -46,6 +46,10 @@
|
|||
#include "nsIProxyObjectManager.h"
|
||||
#include "nsIAbLDAPDirectory.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsXPCOMCIDInternal.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
class nsAbModifyLDAPMessageListener : public nsAbLDAPListenerBase
|
||||
{
|
||||
|
@ -231,8 +235,11 @@ nsresult nsAbModifyLDAPMessageListener::DoTask()
|
|||
mModifyOperation = do_CreateInstance(NS_LDAPOPERATION_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIProxyObjectManager> proxyObjMgr = do_CreateInstance(NS_XPCOMPROXY_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsILDAPMessageListener> proxyListener;
|
||||
rv = NS_GetProxyForObject( NS_PROXY_TO_MAIN_THREAD,
|
||||
rv = proxyObjMgr->GetProxyForObject( NS_PROXY_TO_MAIN_THREAD,
|
||||
NS_GET_IID(nsILDAPMessageListener),
|
||||
this, NS_PROXY_SYNC | NS_PROXY_ALWAYS,
|
||||
getter_AddRefs(proxyListener));
|
||||
|
|
|
@ -49,12 +49,11 @@
|
|||
#include "nsIAbLDAPCard.h"
|
||||
#include "nsAbUtils.h"
|
||||
#include "nsAbBaseCID.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsAutoLock.h"
|
||||
#include "nsIProxyObjectManager.h"
|
||||
#include "prprf.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsCategoryManagerUtils.h"
|
||||
#include "nsAbLDAPDirectory.h"
|
||||
#include "nsAbLDAPListenerBase.h"
|
||||
|
@ -400,7 +399,7 @@ NS_IMETHODIMP nsAbLDAPDirectoryQuery::DoQuery(nsIAbDirectory *aDirectory,
|
|||
rv = mDirectoryUrl->Equals(currentUrl, &equal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsXPIDLCString spec;
|
||||
nsCString spec;
|
||||
mDirectoryUrl->GetSpec(spec);
|
||||
currentUrl->GetSpec(spec);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "nsILDAPURL.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsCOMArray.h"
|
||||
|
||||
|
|
|
@ -43,11 +43,13 @@
|
|||
#include "nsIDOMWindow.h"
|
||||
#include "nsIAuthPrompt.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIProxyObjectManager.h"
|
||||
#include "nsILDAPMessage.h"
|
||||
#include "nsILDAPErrors.h"
|
||||
#include "nsCategoryManagerUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsXPCOMCIDInternal.h"
|
||||
|
||||
nsAbLDAPListenerBase::nsAbLDAPListenerBase(nsILDAPURL* url,
|
||||
nsILDAPConnection* connection,
|
||||
|
@ -267,9 +269,12 @@ NS_IMETHODIMP nsAbLDAPListenerBase::OnLDAPInit(nsILDAPConnection *aConn, nsresul
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIProxyObjectManager> proxyObjMgr = do_CreateInstance(NS_XPCOMPROXY_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsILDAPMessageListener> proxyListener;
|
||||
rv = NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
|
||||
NS_GET_IID(nsILDAPMessageListener),
|
||||
rv = proxyObjMgr->GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
|
||||
NS_GET_IID(nsILDAPMessageListener),
|
||||
static_cast<nsILDAPMessageListener *>(this),
|
||||
NS_PROXY_SYNC | NS_PROXY_ALWAYS,
|
||||
getter_AddRefs(proxyListener));
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "nsILDAPURL.h"
|
||||
#include "nsILDAPConnection.h"
|
||||
#include "nsILDAPOperation.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
class nsAbLDAPListenerBase : public nsILDAPMessageListener
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#include "nsDirPrefs.h"
|
||||
#include "nsIAbLDAPAttributeMap.h"
|
||||
#include "nsIAbLDAPDirectory.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
class nsAbLDAPProcessReplicationData : public nsIAbLDAPProcessReplicationData,
|
||||
public nsAbLDAPListenerBase
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "nsProxiedService.h"
|
||||
#include "nsAbUtils.h"
|
||||
#include "nsDirPrefs.h"
|
||||
#include "nsCRT.h"
|
||||
#include "prmem.h"
|
||||
#include "nsIRDFService.h"
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "nsILDAPOperation.h"
|
||||
#include "nsILDAPURL.h"
|
||||
#include "nsDirPrefs.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
class nsAbLDAPReplicationQuery : public nsIAbLDAPReplicationQuery
|
||||
{
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#include "nsAbLDAPReplicationQuery.h"
|
||||
#include "nsAbBaseCID.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
// XXX Change log replication doesn't work. Bug 311632 should fix it.
|
||||
//#include "nsAbLDAPChangeLogQuery.h"
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
#include "nsIAbLDAPReplicationService.h"
|
||||
#include "nsIAbLDAPReplicationQuery.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
class nsAbLDAPReplicationService : public nsIAbLDAPReplicationService
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsIAddrDatabase.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsAbLDIFService.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsILineInputStream.h"
|
||||
|
@ -49,6 +49,8 @@
|
|||
#include "prprf.h"
|
||||
#include "nsCRTGlue.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsAbLDIFService, nsIAbLDIFService)
|
||||
|
||||
// If we get a line longer than 32K it's just toooooo bad!
|
||||
|
@ -124,7 +126,7 @@ NS_IMETHODIMP nsAbLDIFService::ImportLDIFFile(nsIAddrDatabase *aDb, nsIFile *aSr
|
|||
|
||||
while (NS_SUCCEEDED(GetLdifStringRecord(buf, len, startPos)))
|
||||
{
|
||||
if (mLdifLine.Find("groupOfNames") == kNotFound)
|
||||
if (mLdifLine.Find("groupOfNames") == -1)
|
||||
AddLdifRowToDatabase(PR_FALSE);
|
||||
else
|
||||
{
|
||||
|
@ -141,7 +143,7 @@ NS_IMETHODIMP nsAbLDIFService::ImportLDIFFile(nsIAddrDatabase *aDb, nsIFile *aSr
|
|||
}
|
||||
}
|
||||
//last row
|
||||
if (!mLdifLine.IsEmpty() && mLdifLine.Find("groupOfNames") == kNotFound)
|
||||
if (!mLdifLine.IsEmpty() && mLdifLine.Find("groupOfNames") == -1)
|
||||
AddLdifRowToDatabase(PR_FALSE);
|
||||
|
||||
// mail Lists
|
||||
|
@ -170,7 +172,7 @@ NS_IMETHODIMP nsAbLDIFService::ImportLDIFFile(nsIAddrDatabase *aDb, nsIFile *aSr
|
|||
|
||||
while (NS_SUCCEEDED(GetLdifStringRecord(listBuf, len, startPos)))
|
||||
{
|
||||
if (mLdifLine.Find("groupOfNames") != kNotFound)
|
||||
if (mLdifLine.Find("groupOfNames") != -1)
|
||||
{
|
||||
AddLdifRowToDatabase(PR_TRUE);
|
||||
if (NS_SUCCEEDED(seekableStream->Seek(nsISeekableStream::NS_SEEK_SET, 0)))
|
||||
|
@ -585,9 +587,9 @@ void nsAbLDIFService::AddLdifColToDatabase(nsIMdbRow* newRow, char* typeSlot, ch
|
|||
else if (colType.EqualsLiteral("mozillausehtmlmail"))
|
||||
{
|
||||
ToLowerCase(column);
|
||||
if (kNotFound != column.Find("true"))
|
||||
if (-1 != column.Find("true"))
|
||||
mDatabase->AddPreferMailFormat(newRow, nsIAbPreferMailFormat::html);
|
||||
else if (kNotFound != column.Find("false"))
|
||||
else if (-1 != column.Find("false"))
|
||||
mDatabase->AddPreferMailFormat(newRow, nsIAbPreferMailFormat::plaintext);
|
||||
else
|
||||
mDatabase->AddPreferMailFormat(newRow, nsIAbPreferMailFormat::unknown);
|
||||
|
@ -723,9 +725,9 @@ void nsAbLDIFService::AddLdifColToDatabase(nsIMdbRow* newRow, char* typeSlot, ch
|
|||
else if (colType.EqualsLiteral("xmozillausehtmlmail"))
|
||||
{
|
||||
ToLowerCase(column);
|
||||
if (kNotFound != column.Find("true"))
|
||||
if (-1 != column.Find("true"))
|
||||
mDatabase->AddPreferMailFormat(newRow, nsIAbPreferMailFormat::html);
|
||||
else if (kNotFound != column.Find("false"))
|
||||
else if (-1 != column.Find("false"))
|
||||
mDatabase->AddPreferMailFormat(newRow, nsIAbPreferMailFormat::plaintext);
|
||||
else
|
||||
mDatabase->AddPreferMailFormat(newRow, nsIAbPreferMailFormat::unknown);
|
||||
|
@ -871,10 +873,10 @@ NS_IMETHODIMP nsAbLDIFService::IsLDIFFile(nsIFile *pSrc, PRBool *_retval)
|
|||
void nsAbLDIFService::SplitCRLFAddressField(nsCString &inputAddress, nsCString &outputLine1, nsCString &outputLine2) const
|
||||
{
|
||||
PRInt32 crlfPos = inputAddress.Find("\r\n");
|
||||
if (crlfPos != kNotFound)
|
||||
if (crlfPos != -1)
|
||||
{
|
||||
inputAddress.Left(outputLine1, crlfPos);
|
||||
inputAddress.Right(outputLine2, inputAddress.Length() - (crlfPos + 2));
|
||||
outputLine1 = Substring(inputAddress, 0, crlfPos);
|
||||
outputLine2 = Substring(inputAddress, crlfPos + 2);
|
||||
}
|
||||
else
|
||||
outputLine1.Assign(inputAddress);
|
||||
|
|
|
@ -38,10 +38,9 @@
|
|||
|
||||
#include "nsAbMDBCard.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAbBaseCID.h"
|
||||
|
||||
|
|
|
@ -40,8 +40,7 @@
|
|||
#include "nsIRDFService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsAbBaseCID.h"
|
||||
#include "rdf.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "nsIRDFResource.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAbBaseCID.h"
|
||||
#include "nsAddrDatabase.h"
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "nsIRDFService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAbBaseCID.h"
|
||||
#include "nsAddrDatabase.h"
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsIAbDirectory.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "rdf.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsAbOSXDirectory.h"
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAbOSXUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsAbOSXCard.h"
|
||||
|
||||
#include <AddressBook/AddressBook.h>
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsAbOutlookCard.h"
|
||||
#include "nsCRT.h"
|
||||
#include "prlog.h"
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "nsAbBaseCID.h"
|
||||
#include "nsIAbCard.h"
|
||||
#include "nsAbOutlookCard.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsAbDirectoryQuery.h"
|
||||
#include "nsIAbBooleanExpression.h"
|
||||
#include "nsIAddressBook.h"
|
||||
|
@ -129,7 +129,7 @@ NS_IMETHODIMP nsAbOutlookDirectory::Init(const char *aUri)
|
|||
|
||||
// Get just the basic uri without the search params.
|
||||
if (searchCharLocation != kNotFound)
|
||||
uri.Left(uri, searchCharLocation);
|
||||
uri = Substring(uri, 0, searchCharLocation);
|
||||
|
||||
// Get the pref servers and the address book directory branch
|
||||
nsresult rv;
|
||||
|
@ -163,7 +163,7 @@ NS_IMETHODIMP nsAbOutlookDirectory::Init(const char *aUri)
|
|||
if (dotOffset != -1)
|
||||
{
|
||||
nsCAutoString prefName;
|
||||
child.Left(prefName, dotOffset);
|
||||
prefName = Substring(child, 0, dotOffset);
|
||||
m_DirPrefId.AssignLiteral(PREF_LDAP_SERVER_TREE_NAME ".");
|
||||
m_DirPrefId.Append(prefName);
|
||||
}
|
||||
|
|
|
@ -38,10 +38,10 @@
|
|||
|
||||
#include "nsAbQueryStringToExpression.h"
|
||||
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsITextToSubURI.h"
|
||||
#include "nsAbBooleanExpression.h"
|
||||
|
|
|
@ -51,10 +51,11 @@
|
|||
#include "nsIProxyObjectManager.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsAutoLock.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsXPCOMCIDInternal.h"
|
||||
|
||||
// this is used for notification of observers using nsVoidArray
|
||||
typedef struct _nsAbRDFNotification {
|
||||
|
@ -135,7 +136,10 @@ nsresult nsAbRDFDataSource::CreateProxyObserver (nsIRDFObserver* observer,
|
|||
* events.
|
||||
* This causes the UI to pause.
|
||||
*/
|
||||
rv = NS_GetProxyForObject (
|
||||
nsCOMPtr<nsIProxyObjectManager> proxyObjMgr = do_CreateInstance(NS_XPCOMPROXY_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = proxyObjMgr->GetProxyForObject (
|
||||
NS_PROXY_TO_MAIN_THREAD,
|
||||
NS_GET_IID(nsIRDFObserver),
|
||||
observer,
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "nsIRDFDataSource.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,18 +40,20 @@
|
|||
#define _nsAbView_H_
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsIAbView.h"
|
||||
#include "nsITreeView.h"
|
||||
#include "nsITreeBoxObject.h"
|
||||
#include "nsITreeSelection.h"
|
||||
#include "nsString.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIAbDirectory.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsICollation.h"
|
||||
#include "nsIAbListener.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsMemory.h"
|
||||
|
||||
typedef struct AbCard
|
||||
{
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include <windows.h>
|
||||
#include <mapix.h>
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
struct nsMapiEntry
|
||||
|
|
|
@ -37,8 +37,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "msgCore.h" // precompiled header...
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsIIOService.h"
|
||||
|
||||
#include "nsIStreamListener.h"
|
||||
|
@ -223,7 +222,7 @@ nsAddbookProtocolHandler::GeneratePrintOutput(nsIAddbookUrl *addbookUrl,
|
|||
into "moz-abmdbdirectory/abook.mab"
|
||||
*/
|
||||
PRInt32 pos = uri.Find("?action=print");
|
||||
if (pos == kNotFound)
|
||||
if (pos == -1)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
uri.SetLength(pos);
|
||||
|
@ -233,7 +232,7 @@ nsAddbookProtocolHandler::GeneratePrintOutput(nsIAddbookUrl *addbookUrl,
|
|||
into "moz-abmdbdirectory://abook.mab"
|
||||
*/
|
||||
pos = uri.Find("/");
|
||||
if (pos == kNotFound)
|
||||
if (pos == -1)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
uri.Insert('/', pos);
|
||||
|
|
|
@ -38,8 +38,9 @@
|
|||
#include "nsIURI.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsAddbookUrl.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsAbBaseCID.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
// addbook url definition
|
||||
|
|
|
@ -42,8 +42,9 @@
|
|||
#include "nsIAddrBookSession.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsIDirectoryService.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsAddrBookSession, nsIAddrBookSession)
|
||||
|
||||
|
@ -262,7 +263,7 @@ NS_IMETHODIMP nsAddrBookSession::GenerateNameFromCard(nsIAbCard *card, PRInt32 g
|
|||
// it is better than nothing.
|
||||
card->GetPrimaryEmail(name);
|
||||
PRInt32 index = name.FindChar('@');
|
||||
if (index != kNotFound)
|
||||
if (index != -1)
|
||||
name.SetLength(index);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,7 @@
|
|||
|
||||
#include "nsAddrDatabase.h"
|
||||
#include "nsIEnumerator.h"
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
|
@ -54,12 +53,12 @@
|
|||
#include "nsIAbMDBDirectory.h"
|
||||
#include "nsIAddrBookSession.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsRDFCID.h"
|
||||
|
||||
#include "nsMorkCID.h"
|
||||
#include "nsIMdbFactoryFactory.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsIProxyObjectManager.h"
|
||||
#include "nsProxiedService.h"
|
||||
|
@ -72,6 +71,7 @@
|
|||
#include "nsAddressBook.h" // for the map
|
||||
|
||||
#include "nsEmbedCID.h"
|
||||
#include "nsXPCOMCIDInternal.h"
|
||||
|
||||
#define ID_PAB_TABLE 1
|
||||
#define ID_DELETEDCARDS_TABLE 2
|
||||
|
@ -2353,7 +2353,7 @@ NS_IMETHODIMP nsAddrDatabase::AddLdifListMember(nsIMdbRow* listRow, const char*
|
|||
nsCAutoString email;
|
||||
PRInt32 emailPos = valueString.Find("mail=");
|
||||
emailPos += strlen("mail=");
|
||||
valueString.Right(email, valueString.Length() - emailPos);
|
||||
email = Substring(valueString, emailPos);
|
||||
nsCOMPtr <nsIMdbRow> cardRow;
|
||||
// Please DO NOT change the 3rd param of GetRowFromAttribute() call to
|
||||
// PR_TRUE (ie, case insensitive) without reading bugs #128535 and #121478.
|
||||
|
@ -3599,7 +3599,10 @@ NS_IMETHODIMP nsAddrDatabase::AddListDirNode(nsIMdbRow * listRow)
|
|||
|
||||
rv = rdfService->GetResource(NS_ConvertUTF16toUTF8(parentURI), getter_AddRefs(parentResource));
|
||||
nsCOMPtr<nsIAbDirectory> parentDir;
|
||||
rv = NS_GetProxyForObject( NS_PROXY_TO_MAIN_THREAD,
|
||||
|
||||
nsCOMPtr<nsIProxyObjectManager> proxyObjMgr = do_CreateInstance(NS_XPCOMPROXY_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = proxyObjMgr->GetProxyForObject( NS_PROXY_TO_MAIN_THREAD,
|
||||
NS_GET_IID( nsIAbDirectory),
|
||||
parentResource,
|
||||
NS_PROXY_SYNC | NS_PROXY_ALWAYS,
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsIAddrDatabase.h"
|
||||
#include "mdb.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsIAddrDBListener.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
|
|
@ -67,8 +67,7 @@
|
|||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsIFilePicker.h"
|
||||
#include "nsIPrefService.h"
|
||||
|
@ -361,8 +360,9 @@ NS_IMETHODIMP nsAddressBook::ExportAddressBook(nsIDOMWindow *aParentWin, nsIAbDi
|
|||
default:
|
||||
case LDIF_EXPORT_TYPE: // ldif
|
||||
// If filename does not have the correct ext, add one.
|
||||
if ((fileName.RFind(LDIF_FILE_EXTENSION, PR_TRUE, -1, sizeof(LDIF_FILE_EXTENSION)-1) == kNotFound) &&
|
||||
(fileName.RFind(LDIF_FILE_EXTENSION2, PR_TRUE, -1, sizeof(LDIF_FILE_EXTENSION2)-1) == kNotFound)) {
|
||||
if ((fileName.Find(LDIF_FILE_EXTENSION, fileName.Length() - strlen(LDIF_FILE_EXTENSION), PR_TRUE) == -1) &&
|
||||
(fileName.Find(LDIF_FILE_EXTENSION2, fileName.Length() - strlen(LDIF_FILE_EXTENSION2), PR_TRUE) == -1)) {
|
||||
|
||||
|
||||
// Add the extenstion and build a new localFile.
|
||||
fileName.AppendLiteral(LDIF_FILE_EXTENSION2);
|
||||
|
@ -373,7 +373,7 @@ NS_IMETHODIMP nsAddressBook::ExportAddressBook(nsIDOMWindow *aParentWin, nsIAbDi
|
|||
|
||||
case CSV_EXPORT_TYPE: // csv
|
||||
// If filename does not have the correct ext, add one.
|
||||
if (fileName.RFind(CSV_FILE_EXTENSION, PR_TRUE, -1, sizeof(CSV_FILE_EXTENSION)-1) == kNotFound) {
|
||||
if (fileName.Find(CSV_FILE_EXTENSION, fileName.Length() - strlen(CSV_FILE_EXTENSION), PR_TRUE) == -1) {
|
||||
|
||||
// Add the extenstion and build a new localFile.
|
||||
fileName.AppendLiteral(CSV_FILE_EXTENSION);
|
||||
|
@ -384,8 +384,8 @@ NS_IMETHODIMP nsAddressBook::ExportAddressBook(nsIDOMWindow *aParentWin, nsIAbDi
|
|||
|
||||
case TAB_EXPORT_TYPE: // tab & text
|
||||
// If filename does not have the correct ext, add one.
|
||||
if ( (fileName.RFind(TXT_FILE_EXTENSION, PR_TRUE, -1, sizeof(TXT_FILE_EXTENSION)-1) == kNotFound) &&
|
||||
(fileName.RFind(TAB_FILE_EXTENSION, PR_TRUE, -1, sizeof(TAB_FILE_EXTENSION)-1) == kNotFound) ) {
|
||||
if ((fileName.Find(TXT_FILE_EXTENSION, fileName.Length() - strlen(TXT_FILE_EXTENSION), PR_TRUE) == -1) &&
|
||||
(fileName.Find(TAB_FILE_EXTENSION, fileName.Length() - strlen(TAB_FILE_EXTENSION), PR_TRUE) == -1)) {
|
||||
|
||||
// Add the extenstion and build a new localFile.
|
||||
fileName.AppendLiteral(TXT_FILE_EXTENSION);
|
||||
|
@ -498,17 +498,29 @@ nsAddressBook::ExportDirectoryToDelimitedText(nsIAbDirectory *aDirectory, const
|
|||
// of the string we need to quote the double quote(s) as well.
|
||||
nsAutoString newValue(value);
|
||||
PRBool needsQuotes = PR_FALSE;
|
||||
if(newValue.FindChar('"') != kNotFound)
|
||||
if(newValue.FindChar('"') != -1)
|
||||
{
|
||||
needsQuotes = PR_TRUE;
|
||||
newValue.ReplaceSubstring(NS_LITERAL_STRING("\"").get(), NS_LITERAL_STRING("\"\"").get());
|
||||
|
||||
PRInt32 match = 0;
|
||||
PRUint32 offset = 0;
|
||||
nsString oldSubstr = NS_LITERAL_STRING("\"");
|
||||
nsString newSubstr = NS_LITERAL_STRING("\"\"");
|
||||
while (offset < newValue.Length()) {
|
||||
match = newValue.Find(oldSubstr, offset);
|
||||
if (match == -1)
|
||||
break;
|
||||
|
||||
newValue.Replace(offset + match, oldSubstr.Length(), newSubstr);
|
||||
offset += (match + newSubstr.Length());
|
||||
}
|
||||
}
|
||||
if (!needsQuotes && (newValue.FindChar(',') != kNotFound || newValue.FindChar('\x09') != kNotFound))
|
||||
if (!needsQuotes && (newValue.FindChar(',') != -1 || newValue.FindChar('\x09') != -1))
|
||||
needsQuotes = PR_TRUE;
|
||||
|
||||
// Make sure we quote if containing CR/LF.
|
||||
if (newValue.FindChar('\r') != kNotFound ||
|
||||
newValue.FindChar('\n') != kNotFound)
|
||||
if (newValue.FindChar('\r') != -1 ||
|
||||
newValue.FindChar('\n') != -1)
|
||||
needsQuotes = PR_TRUE;
|
||||
|
||||
if (needsQuotes)
|
||||
|
|
|
@ -46,7 +46,8 @@
|
|||
#include "nsIPrefLocalizedString.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsIAddrDatabase.h"
|
||||
#include "nsAbBaseCID.h"
|
||||
#include "nsIAddrBookSession.h"
|
||||
|
@ -61,6 +62,8 @@
|
|||
#include "plstr.h"
|
||||
#include "nsQuickSort.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
/*****************************************************************************
|
||||
* Private definitions
|
||||
*/
|
||||
|
@ -1215,7 +1218,7 @@ static nsresult DIR_GetServerPreferences(nsVoidArray** list)
|
|||
return err;
|
||||
|
||||
PRInt32 version = -1;
|
||||
nsVoidArray *newList;
|
||||
nsVoidArray *newList = nsnull;
|
||||
|
||||
/* Update the ldap list version and see if there are old prefs to migrate. */
|
||||
err = pPref->GetIntPref(PREF_LDAP_VERSION_NAME, &version);
|
||||
|
|
|
@ -51,14 +51,14 @@
|
|||
#include "nsIObserverService.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
#include "nsMsgRDFUtils.h"
|
||||
#include "nsILocaleService.h"
|
||||
#include "nsCollationCID.h"
|
||||
#include "prmem.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
#define NC_RDF_DIRNAME "http://home.netscape.com/NC-rdf#DirName"
|
||||
#define NC_RDF_DIRURI "http://home.netscape.com/NC-rdf#DirUri"
|
||||
|
@ -443,11 +443,11 @@ NS_IMETHODIMP nsAbDirectoryDataSource::OnItemPropertyChanged(nsISupports *item,
|
|||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (PL_strcmp("DirName", property) == 0)
|
||||
if (strcmp("DirName", property) == 0)
|
||||
{
|
||||
NotifyPropertyChanged(resource, kNC_DirName, oldValue, newValue);
|
||||
}
|
||||
else if (PL_strcmp("IsSecure", property) == 0)
|
||||
else if (strcmp("IsSecure", property) == 0)
|
||||
{
|
||||
NotifyPropertyChanged(resource, kNC_IsSecure, oldValue, newValue);
|
||||
}
|
||||
|
|
|
@ -38,14 +38,12 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsLDAPAutoCompleteSession.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIProxyObjectManager.h"
|
||||
#include "nsILDAPURL.h"
|
||||
#include "nsILDAPService.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nspr.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsCRTGlue.h"
|
||||
|
@ -56,6 +54,7 @@
|
|||
#include "nsILDAPService.h"
|
||||
#include "nsILDAPMessage.h"
|
||||
#include "nsILDAPErrors.h"
|
||||
#include "nsXPCOMCIDInternal.h"
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
static PRLogModuleInfo *sLDAPAutoCompleteLogModule = 0;
|
||||
|
@ -122,10 +121,8 @@ nsLDAPAutoCompleteSession::OnStartLookup(const PRUnichar *searchString,
|
|||
// that are too short
|
||||
//
|
||||
if (searchString[0] == 0 ||
|
||||
nsDependentString(searchString).FindChar(PRUnichar('@'), 0) !=
|
||||
kNotFound ||
|
||||
nsDependentString(searchString).FindChar(PRUnichar(','), 0) !=
|
||||
kNotFound ||
|
||||
nsDependentString(searchString).FindChar(PRUnichar('@'), 0) != -1 ||
|
||||
nsDependentString(searchString).FindChar(PRUnichar(','), 0) != -1 ||
|
||||
( !IS_CJK_CHAR_FOR_LDAP(searchString[0]) ?
|
||||
mMinStringLength && NS_strlen(searchString) < mMinStringLength :
|
||||
mCjkMinStringLength && NS_strlen(searchString) <
|
||||
|
@ -608,7 +605,12 @@ nsLDAPAutoCompleteSession::DoTask()
|
|||
|
||||
// get a proxy object so the callback happens on the main thread
|
||||
//
|
||||
rv = NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
|
||||
nsCOMPtr<nsIProxyObjectManager> proxyObjMgr = do_CreateInstance(NS_XPCOMPROXY_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
FinishAutoCompleteLookup(nsIAutoCompleteStatus::failureItems, rv, UNBOUND);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
rv = proxyObjMgr->GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
|
||||
NS_GET_IID(nsILDAPMessageListener),
|
||||
static_cast<nsILDAPMessageListener *>(this),
|
||||
NS_PROXY_ASYNC | NS_PROXY_ALWAYS,
|
||||
|
@ -886,7 +888,12 @@ nsLDAPAutoCompleteSession::InitConnection()
|
|||
|
||||
// get a proxy object so the callback happens on the main thread
|
||||
//
|
||||
rv = NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
|
||||
nsCOMPtr<nsIProxyObjectManager> proxyObjMgr = do_CreateInstance(NS_XPCOMPROXY_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
FinishAutoCompleteLookup(nsIAutoCompleteStatus::failureItems, rv, UNBOUND);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
rv = proxyObjMgr->GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
|
||||
NS_GET_IID(nsILDAPMessageListener),
|
||||
static_cast<nsILDAPMessageListener *>(this),
|
||||
NS_PROXY_ASYNC | NS_PROXY_ALWAYS,
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "nsILDAPAutoCompleteSession.h"
|
||||
#include "nsILDAPAutoCompFormatter.h"
|
||||
#include "nsILDAPURL.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsIAuthPrompt.h"
|
||||
|
|
Загрузка…
Ссылка в новой задаче