Fix to use the server and port from AB Sync server - Bug # 43782 - r: jefft
git-svn-id: svn://10.0.0.236/trunk@73258 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -37,6 +37,7 @@ interface nsIAbSyncMojo : nsISupports {
|
||||
* This is the primary interface for performing AB Sync mojo operations
|
||||
*/
|
||||
string BuildMojoString();
|
||||
void StartAbSyncMojo(in nsIStreamListener aListener);
|
||||
void GetAbSyncMojoResults(out string aMojoUser, out string aMojoString);
|
||||
void StartAbSyncMojo(in nsIStreamListener aListener);
|
||||
void GetAbSyncMojoResults(out string aMojoUser, out string aMojoString,
|
||||
out string aMojoSpec, out long aMojoPort);
|
||||
};
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "nsTextFormatter.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsINetSupportDialogService.h"
|
||||
#include "nsMsgI18N.h"
|
||||
|
||||
static NS_DEFINE_CID(kCAbSyncPostEngineCID, NS_ABSYNC_POST_ENGINE_CID);
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
@@ -767,10 +768,18 @@ nsAbSync::GenerateProtocolForCard(nsIAbCard *aCard, PRBool aAddId, nsString &pro
|
||||
}
|
||||
else // Good ole' normal tag...
|
||||
{
|
||||
char *utfString = nsString2(aName).ToNewUTF8String();
|
||||
|
||||
tProtLine.Append(NS_ConvertASCIItoUCS2("&"));
|
||||
tProtLine.Append(NS_ConvertASCIItoUCS2(mSchemaMappingList[i].serverField));
|
||||
tProtLine.Append(NS_ConvertASCIItoUCS2("="));
|
||||
tProtLine.Append(aName);
|
||||
if (utfString)
|
||||
{
|
||||
tProtLine.Append(NS_ConvertASCIItoUCS2(utfString));
|
||||
PR_FREEIF(utfString);
|
||||
}
|
||||
else
|
||||
tProtLine.Append(aName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2300,6 +2309,17 @@ nsAbSync::AddValueToNewCard(nsIAbCard *aCard, nsString *aTagName, nsString *aTag
|
||||
// as to their type...this is not the case with phone numbers.
|
||||
//
|
||||
PRUnichar aChar = '_';
|
||||
nsString outValue;
|
||||
char *tValue = nsnull;
|
||||
|
||||
tValue = aTagValue->ToNewCString();
|
||||
if (tValue)
|
||||
{
|
||||
rv = nsMsgI18NConvertToUnicode(nsCString("UTF-8"), tValue, outValue);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
aTagValue->Assign(outValue);
|
||||
PR_FREEIF(tValue);
|
||||
}
|
||||
|
||||
if (!aTagName->CompareWithConversion("phone", PR_TRUE, 5))
|
||||
{
|
||||
|
||||
@@ -101,10 +101,10 @@ nsAbSyncPostEngine::nsAbSyncPostEngine()
|
||||
mAuthenticationRunning = PR_TRUE;
|
||||
mCookie = nsnull;
|
||||
mUser = nsnull;
|
||||
mSyncSpec = nsnull;
|
||||
mSyncProtocolRequest = nsnull;
|
||||
mSyncProtocolRequestPrefix = nsnull;
|
||||
mChannel = nsnull;
|
||||
mMojoSyncSpec = nsnull;
|
||||
}
|
||||
|
||||
nsAbSyncPostEngine::~nsAbSyncPostEngine()
|
||||
@@ -117,7 +117,7 @@ nsAbSyncPostEngine::~nsAbSyncPostEngine()
|
||||
PR_FREEIF(mSyncProtocolRequestPrefix);
|
||||
PR_FREEIF(mCookie);
|
||||
PR_FREEIF(mUser);
|
||||
PR_FREEIF(mSyncSpec);
|
||||
PR_FREEIF(mMojoSyncSpec);
|
||||
DeleteListeners();
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ nsAbSyncPostEngine::OnStopRequest(nsIChannel *aChannel, nsISupports * /* ctxt */
|
||||
{
|
||||
nsresult rv;
|
||||
if (mSyncMojo)
|
||||
rv = mSyncMojo->GetAbSyncMojoResults(&mUser, &mCookie);
|
||||
rv = mSyncMojo->GetAbSyncMojoResults(&mUser, &mCookie, &mMojoSyncSpec, &mMojoSyncPort);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
@@ -745,10 +745,6 @@ NS_IMETHODIMP nsAbSyncPostEngine::SendAbRequest(const char *aSpec, PRInt32 aPort
|
||||
if (NS_FAILED(mSyncMojo->StartAbSyncMojo(this)))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Stash these away for later...
|
||||
mSyncSpec = nsCRT::strdup(aSpec);
|
||||
mSyncPort = aPort;
|
||||
|
||||
// Set transaction ID and save/init Sync info...
|
||||
mTransactionID = aTransactionID;
|
||||
|
||||
@@ -795,15 +791,15 @@ nsAbSyncPostEngine::KickTheSyncOperation(void)
|
||||
goto GetOuttaHere;
|
||||
}
|
||||
|
||||
rv = nsEngineNewURI(&workURI, mSyncSpec, nsnull);
|
||||
rv = nsEngineNewURI(&workURI, mMojoSyncSpec, nsnull);
|
||||
if (NS_FAILED(rv) || (!workURI))
|
||||
{
|
||||
rv = NS_ERROR_FAILURE; // we couldn't allocate the string
|
||||
goto GetOuttaHere;
|
||||
}
|
||||
|
||||
if (mSyncPort > 0)
|
||||
workURI->SetPort(mSyncPort);
|
||||
if (mMojoSyncPort > 0)
|
||||
workURI->SetPort(mMojoSyncPort);
|
||||
|
||||
rv = FireURLRequest(workURI, tCommand);
|
||||
|
||||
|
||||
@@ -108,12 +108,13 @@ private:
|
||||
// Since we need to do authentication a bit differently, do it here!
|
||||
PRBool mAuthenticationRunning;
|
||||
nsCOMPtr<nsIAbSyncMojo> mSyncMojo;
|
||||
char *mSyncSpec;
|
||||
PRInt32 mSyncPort;
|
||||
nsCOMPtr<nsIChannel> mChannel;
|
||||
|
||||
char *mSyncProtocolRequest;
|
||||
char *mSyncProtocolRequestPrefix;
|
||||
|
||||
char *mMojoSyncSpec;
|
||||
PRInt32 mMojoSyncPort;
|
||||
};
|
||||
|
||||
#endif /* nsAbSyncPostEngine_h_ */
|
||||
|
||||
Reference in New Issue
Block a user