This commit is contained in:
rhp%netscape.com 2000-05-10 06:14:18 +00:00
Родитель 288a4ae330
Коммит e082aafe5b
3 изменённых файлов: 51 добавлений и 31 удалений

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

@ -1209,7 +1209,7 @@ nsAbSync::EndOfStream()
nsresult
nsAbSync::ProcessOpReturn()
{
char *workLine;
char *workLine = nsnull;
while (workLine = ExtractCurrentLine())
{
@ -1221,7 +1221,8 @@ nsAbSync::ProcessOpReturn()
if (!nsCRT::strncasecmp(workLine, SERVER_OP_RETURN_LOCALE,
nsCRT::strlen(SERVER_OP_RETURN_LOCALE)))
{
char *locale = workLine += nsCRT::strlen(SERVER_OP_RETURN_LOCALE);
char *locale = workLine;
locale += nsCRT::strlen(SERVER_OP_RETURN_LOCALE);
if (*locale)
mLocale = NS_ConvertASCIItoUCS2(locale);
}
@ -1245,8 +1246,7 @@ nsAbSync::ProcessOpReturn()
}
}
if (*workLine)
nsCRT::free(workLine);
PR_FREEIF(workLine);
}
return NS_OK;
@ -2009,6 +2009,36 @@ nsAbSync::AddValueToNewCard(nsIAbCard *aCard, nsString *aTagName, nsString *aTag
{
nsresult rv = NS_OK;
//
// RICHIE_TODO: First, we are going to special case the phone entries because they seem to
//
/**
#define ABSYNC_PAGER_PHONE_TYPE "Pager:"
#define ABSYNC_HOME_PHONE_TYPE "Home:"
#define ABSYNC_WORK_PHONE_TYPE "Work:"
#define ABSYNC_FAX_PHONE_TYPE "Fax:"
#define ABSYNC_CELL_PHONE_TYPE "Cellular:"
if (!aTagName->CompareWithConversion(kServerWorkPhoneColumn))
aCard->SetWorkPhone(aTagValue->GetUnicode());
if (!aTagName->CompareWithConversion(kServerHomePhoneColumn))
aCard->SetHomePhone(aTagValue->GetUnicode());
if (!aTagName->CompareWithConversion(kServerFaxColumn))
aCard->SetFaxNumber(aTagValue->GetUnicode());
if (!aTagName->CompareWithConversion(kServerPagerColumn))
aCard->SetPagerNumber(aTagValue->GetUnicode());
if (!aTagName->CompareWithConversion(kServerCellularColumn))
aCard->SetCellularNumber(aTagValue->GetUnicode());
******************************/
// Ok, we need to figure out what the tag name from the server maps to and assign
// this value the new nsIAbCard
//
@ -2035,21 +2065,6 @@ nsAbSync::AddValueToNewCard(nsIAbCard *aCard, nsString *aTagName, nsString *aTag
if (!aTagName->CompareWithConversion(kServer2ndEmailColumn))
aCard->SetSecondEmail(aTagValue->GetUnicode());
if (!aTagName->CompareWithConversion(kServerWorkPhoneColumn))
aCard->SetWorkPhone(aTagValue->GetUnicode());
if (!aTagName->CompareWithConversion(kServerHomePhoneColumn))
aCard->SetHomePhone(aTagValue->GetUnicode());
if (!aTagName->CompareWithConversion(kServerFaxColumn))
aCard->SetFaxNumber(aTagValue->GetUnicode());
if (!aTagName->CompareWithConversion(kServerPagerColumn))
aCard->SetPagerNumber(aTagValue->GetUnicode());
if (!aTagName->CompareWithConversion(kServerCellularColumn))
aCard->SetCellularNumber(aTagValue->GetUnicode());
if (!aTagName->CompareWithConversion(kServerHomeAddressColumn))
aCard->SetHomeAddress(aTagValue->GetUnicode());
@ -2127,16 +2142,6 @@ nsAbSync::GetString(const PRUnichar *aStringName)
return nsCRT::strdup(aStringName);
}
/*********** RICHIE_TODO
These are the types for the phone entries!
Pager:
Home:
Work:
Fax:
Cellular:
*****/
/************ UNUSED FOR NOW
aCard->SetDisplayName(aTagValue->GetUnicode());
aCard->SetDepartment(aTagValue->GetUnicode());

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

@ -86,6 +86,12 @@ typedef struct {
#define ABSYNC_PROTOCOL 3
#define ABSYNC_VERSION "Demo"
#define ABSYNC_PAGER_PHONE_TYPE "Pager:"
#define ABSYNC_HOME_PHONE_TYPE "Home:"
#define ABSYNC_WORK_PHONE_TYPE "Work:"
#define ABSYNC_FAX_PHONE_TYPE "Fax:"
#define ABSYNC_CELL_PHONE_TYPE "Cellular:"
#define SYNC_ESCAPE_ADDUSER "op%3Dadd"
#define SYNC_ESCAPE_MOD "op%3Dmod"
#define SYNC_ESCAPE_DEL "op%3Ddel"

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

@ -317,18 +317,25 @@ nsAbSyncPostEngine::FireURLRequest(nsIURI *aURL, nsPostCompletionCallback cb,
// Tag the post stream onto the channel...but never seemed to work...so putting it
// directly on the URL spec
//
// Mark the channel as being a document URI...
nsLoadFlags loadAttribs = 0;
channel->GetLoadAttributes(&loadAttribs);
loadAttribs |= nsIChannel::LOAD_DOCUMENT_URI;
channel->SetLoadAttributes(loadAttribs);
nsCOMPtr<nsIAtom> method = NS_NewAtom ("POST");
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(channel);
if (!httpChannel)
return NS_ERROR_FAILURE;
httpChannel->SetRequestMethod(method);
httpChannel->SetUploadStream(postStream);
if (NS_SUCCEEDED(rv = NS_NewPostDataStream(getter_AddRefs(postStream), PR_FALSE, postData, 0)))
{
httpChannel->SetUploadStream(postStream);
}
**/
*****/
// let's try uri dispatching...
nsCOMPtr<nsIURILoader> pURILoader (do_GetService(NS_URI_LOADER_PROGID));
@ -521,6 +528,7 @@ NS_IMETHODIMP nsAbSyncPostEngine::SendAbRequest(const char *aSpec, PRInt32 aPort
return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the string */
printf("POST: %s\n", aProtocolRequest);
rv = nsEngineNewURI(&workURI, tSpec, nsnull);
if (NS_FAILED(rv) || (!workURI))
return NS_ERROR_FAILURE;
@ -530,6 +538,7 @@ NS_IMETHODIMP nsAbSyncPostEngine::SendAbRequest(const char *aSpec, PRInt32 aPort
workURI->SetPort(aPort);
rv = FireURLRequest(workURI, PostDoneCallback, this, aProtocolRequest);
mPostEngineState = nsIAbSyncPostEngineState::nsIAbSyncPostRunning;
return rv;
}