View | Details | Raw Unified | Return to issue 9160
Collapse All | Expand All

(-)mailnews/addrbook/public/nsIAddrDatabase.idl (+6 lines)
Line 205 Link Here
205
	[noscript] nsIAbCard AddListCardColumnsToRow(in nsIAbCard pCard, in nsIMdbRow pListRow, in PRUint32 pos);
206
	[noscript] void GetCardFromDB(in nsIAbCard newCard, in nsIMdbRow cardRow);
207
	[noscript] void CreateABList(in nsIMdbRow listRow,out nsIAbDirectory result);
208
	[noscript] void SetListAddressTotal(in nsIMdbRow listRow, in PRUint32 total);
209
	[noscript] boolean FindRow(in nsIAbCard card, out nsIMdbRow oldRow);
210
(-)mailnews/addrbook/src/nsAddrDatabase.cpp (-10 / +20 lines)
Line 1381 Link Here
1381
nsresult nsAddrDatabase::AddListCardColumnsToRow
1381
NS_IMETHODIMP nsAddrDatabase::AddListCardColumnsToRow
1382
--
Line 1386 Link Here
1386
1387
  //PRUint32 total=GetListAddressTotal(pListRow)+1;
1388
  //SetListAddressTotal(pListRow,total);
1389
Line 1529 Link Here
1529
nsresult nsAddrDatabase::SetListAddressTotal(nsIMdbRow* listRow, PRUint32 total)
1533
NS_IMETHODIMP nsAddrDatabase::SetListAddressTotal(nsIMdbRow* listRow, PRUint32 total)
1530
--
Line 1534 Link Here
1534
1538
NS_IMETHODIMP nsAddrDatabase::FindRow(nsIAbCard * card, nsIMdbRow * *oldRow, PRBool *_retval)
1535
--
1539
{
1540
	PRUnichar *aPrimaryEmail;
1541
	card->GetPrimaryEmail(&aPrimaryEmail);
1542
	nsresult hr=GetRowForCharColumn (aPrimaryEmail,m_PriEmailColumnToken,PR_FALSE,oldRow);
1543
1544
	if (NS_SUCCEEDED(hr))
1545
	{
1546
		*_retval=PR_TRUE;
1547
	}
1548
	return hr;
1549
}
Line 2295 Link Here
2295
nsresult nsAddrDatabase::GetCardFromDB(nsIAbCard *newCard, nsIMdbRow* cardRow)
2310
NS_IMETHODIMP nsAddrDatabase::GetCardFromDB(nsIAbCard *newCard, nsIMdbRow* cardRow)
2296
--
Line 3017 Link Here
3017
nsresult nsAddrDatabase::CreateABList(nsIMdbRow* listRow, nsIAbDirectory **result)
3032
NS_IMETHODIMP nsAddrDatabase::CreateABList(nsIMdbRow* listRow, nsIAbDirectory **result)
3018
--
(-)mailnews/addrbook/src/nsAddrDatabase.h (-8 / +9 lines)
Line 254 Link Here
254
	nsresult CreateABList(nsIMdbRow* listRow, nsIAbDirectory **result);
254
	NS_IMETHOD CreateABList(nsIMdbRow* listRow, nsIAbDirectory **result);
255
--
Line 265 Link Here
265
	NS_IMETHOD AddListCardColumnsToRow(nsIAbCard *pCard, nsIMdbRow *pListRow, PRUint32 pos, nsIAbCard** pNewCard);
266
	NS_IMETHOD GetCardFromDB(nsIAbCard *newCard, nsIMdbRow* cardRow);
267
	NS_IMETHOD SetListAddressTotal(nsIMdbRow* listRow, PRUint32 total);
268
269
	NS_IMETHOD FindRow(nsIAbCard * card, nsIMdbRow * *oldRow, PRBool *_retval);
270
271
Line 284 Link Here
284
	nsresult AddIntColumn(nsIMdbRow* cardRow, mdb_column inColumn, PRUint32 nValue);
Line 290 Link Here
290
	nsresult GetCardFromDB(nsIAbCard *newCard, nsIMdbRow* cardRow);
Line 295 Link Here
295
	nsresult AddListCardColumnsToRow(nsIAbCard *pCard, nsIMdbRow *pListRow, PRUint32 pos, nsIAbCard** pNewCard);
Line 299 Link Here
299
	nsresult SetListAddressTotal(nsIMdbRow* listRow, PRUint32 total);
Line 303 Link Here
303
306
	nsresult AddIntColumn(nsIMdbRow* cardRow, mdb_column inColumn, PRUint32 nValue);
304
--
(-)mailnews/import/outlook/src/MapiApi.cpp (-2 / +1 lines)
Line 508 Link Here
508
	hr =	lpMdb->OpenEntry(	cbEntry,
508
	hr =	m_lpSession->OpenEntry(	cbEntry,
509
--
(-)mailnews/import/outlook/src/nsOutlookMail.cpp (-14 / +121 lines)
Line 57 Link Here
57
#include "nsAddrDatabase.h"
Line 62 Link Here
63
#include "prprf.h"
64
Line 946 Link Here
946
          CreateList(subject.get(), pDb);
949
          CreateList(subject.get(), pDb, lpMsg, pFieldMap);
947
--
Line 948 Link Here
951
			
Line 959 Link Here
959
nsresult nsOutlookMail::CreateList( const PRUnichar * pName, nsIAddrDatabase *pDb)
963
void GetIntYarn(PRUint32 nValue, struct mdbYarn* intYarn)
960
--
964
{
965
    intYarn->mYarn_Size = sizeof(intYarn->mYarn_Buf);
966
    intYarn->mYarn_Fill = intYarn->mYarn_Size;
967
    intYarn->mYarn_Form = 0;
968
    intYarn->mYarn_Grow = nsnull;
969
970
    PR_snprintf((char*)intYarn->mYarn_Buf, intYarn->mYarn_Size, "%lx", nValue);
971
    intYarn->mYarn_Fill = PL_strlen((const char *) intYarn->mYarn_Buf);
972
}
973
nsresult AddIntColumn(nsAddrDatabase*pDb,nsIMdbRow* cardRow, mdb_column inColumn, PRUint32 nValue)
974
{
975
    struct mdbYarn yarn;
976
    char    yarnBuf[100];
977
978
    yarn.mYarn_Buf = (void *) yarnBuf;
979
    GetIntYarn(nValue, &yarn);
980
    mdb_err err = cardRow->AddColumn(pDb->GetEnv(),  inColumn, &yarn);
981
982
    return (err == NS_OK) ? NS_OK : NS_ERROR_FAILURE;
983
}
984
985
nsresult nsOutlookMail::CreateList( const PRUnichar * pName, nsIAddrDatabase *pDb, LPMAPIPROP pUserList, nsIImportFieldMap *pFieldMap)
Lines 970-971 Link Here
970
  nsCOMPtr <nsIMdbRow> newRow;
996
  nsCOMPtr <nsIMdbRow> newListRow;
971
  rv = pDb->GetNewListRow(getter_AddRefs(newRow));
997
  rv = pDb->GetNewListRow(getter_AddRefs(newListRow));
972
--
Line 973 Link Here
973
Line 976 Link Here
976
  rv = pDb->AddListName(newRow, column.get());
1001
  rv = pDb->AddListName(newListRow, column.get());
977
--
Line 978 Link Here
978
  rv = pDb->AddCardRowToDB(newRow);
1003
//need AddListCardColumnsToRow
979
--
1004
1005
	HRESULT             hr;
1006
	LPSPropValue aValue = NULL ;
1007
	ULONG aValueCount = 0 ;
1008
1009
	LPSPropTagArray properties = NULL ;
1010
	m_mapi.MAPIAllocateBuffer(CbNewSPropTagArray(1), 
1011
					   (void **)&properties) ;
1012
	properties->cValues = 1 ;
1013
	properties->aulPropTag [0] = m_mapi.GetEmailPropertyTag(pUserList,0x8054);//PR_CONTACT_ENTRYIDS;
1014
	hr = pUserList->GetProps(properties, 0, &aValueCount, &aValue) ;
1015
1016
	SBinaryArray *sa=(SBinaryArray *)&aValue->Value.bin;
1017
	//LPSPropTagArray dists=(LPSPropTagArray)&aValue->Value.bin.lpb;
1018
1019
	LPENTRYID	lpEid;
1020
	ULONG		cbEid;
1021
	PRInt32		idx;	
1022
	LPMESSAGE		lpMsg;
1023
	nsCString		type;
1024
	LPSPropValue	pVal;
1025
	nsString		subject;
1026
	ULONG			ulObjType;
1027
	PRUint32 total;
1028
	
1029
1030
	total=sa->cValues;
1031
	for (idx=0;idx<sa->cValues ;idx++)
1032
	{
1033
		lpEid= (LPENTRYID) sa->lpbin[idx].lpb;
1034
		cbEid = sa->lpbin[idx].cb;
1035
		//GetMAPIProperties(cbEID,lpEID);
1036
1037
1038
		if (!m_mapi.OpenEntry(cbEid, lpEid, (LPUNKNOWN *) &lpMsg)) 
1039
		{
1040
			
1041
			IMPORT_LOG1( "*** Error opening messages in mailbox: %S\n", pName);
1042
			return( NS_ERROR_FAILURE);
1043
		}
1044
		{
1045
			{
1046
				// This is a contact, add it to the address book!
1047
				subject.Truncate( 0);
1048
				pVal = m_mapi.GetMapiProperty( lpMsg, PR_SUBJECT);
1049
				if (pVal)
1050
					m_mapi.GetStringFromProp( pVal, subject);
1051
				
1052
					nsIMdbRow* newRow = nsnull;
1053
					nsIMdbRow* oldRow = nsnull;
1054
					pDb->GetNewRow( &newRow); 
1055
					if (newRow) {
1056
						if (BuildCard( subject.get(), pDb, newRow, lpMsg, pFieldMap)) 
1057
						{
1058
							nsCOMPtr <nsIAbCard> userCard;
1059
							nsCOMPtr <nsIAbCard> newCard;
1060
							userCard = do_CreateInstance(NS_ABMDBCARD_CONTRACTID, &rv);
1061
							NS_ENSURE_SUCCESS(rv,rv);
1062
							pDb->GetCardFromDB(userCard,newRow);
1063
							
1064
							//add card to db
1065
							PRBool bl=PR_FALSE;
1066
							pDb->FindRow(userCard,&oldRow,&bl);
1067
							if (!bl)
1068
								pDb->AddCardRowToDB( newRow);
1069
							else
1070
							{
1071
								NS_RELEASE(newRow);
1072
								newRow = oldRow;
1073
							}
1074
							
1075
							//add card to list
1076
							
1077
							pDb->AddListCardColumnsToRow(userCard,newListRow,idx+1,getter_AddRefs(newCard));
1078
1079
							NS_RELEASE(newRow);
1080
						}
1081
					}
1082
1083
1084
			}
1085
		}
1086
	}
1087
  
1088
  rv = pDb->AddCardRowToDB(newListRow);
Line 980 Link Here
980
  rv = pDb->AddListDirNode(newRow);
1090
981
--
1091
  rv = pDb->SetListAddressTotal(newListRow, total);
1092
1093
  rv = pDb->AddListDirNode(newListRow);
(-)mailnews/import/outlook/src/nsOutlookMail.h (-2 / +1 lines)
Line 81 Link Here
81
  nsresult  CreateList( const PRUnichar * pName, nsIAddrDatabase *pDb);
81
  nsresult  CreateList( const PRUnichar * pName, nsIAddrDatabase *pDb, LPMAPIPROP pUserList, nsIImportFieldMap *pFieldMap);
82
--

Return to issue 9160