blueZync

Synchronize Bluetooth phone with Thunderbird

Develpers' detailed documentation for the mozilla-sync plugin for OpenSync. A part of blueZync.

ThunderbirdCard Class Reference

#include <thunderbird-card.h>

Collaboration diagram for ThunderbirdCard:

List of all members.


Public Member Functions

gboolean CreateFromXML (const gchar *szXML, char **pSzError, void(*pLogFunction)(int level, bool sensitive, const char *szFile, int iLine, const char *szFunc, const char *szFormat,...))
 Create AbCard from XML representation (OpenSync xmlformat-card).
gchar * GetHash (char **pSzError, void(*pLogFunction)(int level, bool sensitive, const char *szFile, int iLine, const char *szFunc, const char *szFormat,...))
 Get hash value for OpenSync.
char * GetKey (nsIAddrDatabase *addrDatabase, char **pSzError, void(*pLogFunction)(int level, bool sensitive, const char *szFile, int iLine, const char *szFunc, const char *szFormat,...))
 Get key for OpenSync.
gchar * GetLongName (char **pSzError, void(*pLogFunction)(int level, bool sensitive, const char *szFile, int iLine, const char *szFunc, const char *szFormat,...))
 Get a strange name, only useful for debugging...
char * GetXML (char **pSzError, void(*pLogFunction)(int level, bool sensitive, const char *szFile, int iLine, const char *szFunc, const char *szFormat,...))
 Get XML representation (OpenSync xmlformat-card) of the AbCard.
gboolean ResetFromXML (const gchar *szXML, char **pSzError, void(*pLogFunction)(int level, bool sensitive, const char *szFile, int iLine, const char *szFunc, const char *szFormat,...))
 Clear contents of AbCard, then update from XML representation (OpenSync xmlformat-card).
 ThunderbirdCard (nsIAbCard *pAbCard)
 Construct ThunderbirdCard from abCard.
 ThunderbirdCard ()
 Construct empty ThunderbirdCard.
gboolean UpdateFromXML (const gchar *szXML, char **pSzError, void(*pLogFunction)(int level, bool sensitive, const char *szFile, int iLine, const char *szFunc, const char *szFormat,...))
 Update the AbCard from XML representation (OpenSync xmlformat-card).

Static Public Member Functions

static GList * PGListCapabilities ()
 Get list of field names representing Thunderbird card capabilities.

Public Attributes

nsCOMPtr< nsIAbCard > myCard
 This is how Thunderbird sees it.

Constructor & Destructor Documentation

ThunderbirdCard::ThunderbirdCard (  ) 

Construct empty ThunderbirdCard.

ThunderbirdCard::ThunderbirdCard ( nsIAbCard *  pAbCard  ) 

Construct ThunderbirdCard from abCard.

Parameters:
pAbCard The nsIAbCard


Member Function Documentation

gboolean ThunderbirdCard::CreateFromXML ( const gchar *  szXML,
char **  pSzError,
void(*)(int level, bool sensitive, const char *szFile, int iLine, const char *szFunc, const char *szFormat,...)  pLogFunction 
)

Create AbCard from XML representation (OpenSync xmlformat-card).

Parameters:
szXML string according to xmlformat-card
pSzError Pointer to string, into which we shall write an error message if we return false
pLogFunction Function used to log information text
Returns:
string on success; NULL on error

References LOG, MOZ_ERROR_CHECK_FALSE, myCard, and UpdateFromXML().

Referenced by mozilla_sync_commit_addressbook_change().

Here is the call graph for this function:

gchar * ThunderbirdCard::GetHash ( char **  pSzError,
void(*)(int level, bool sensitive, const char *szFile, int iLine, const char *szFunc, const char *szFormat,...)  pLogFunction 
)

Get hash value for OpenSync.

The hash value is the LastModifedDate of the AbCard. If the card content changes, so should the hash.

Parameters:
pSzError Pointer to string, into which we shall write an error message if we return false
pLogFunction Function used to log information text
Returns:
string on success; NULL on error

References MOZ_ERROR_CHECK, and myCard.

Referenced by ThunderbirdAddressbook::LogInfo(), ThunderbirdAddressbook::ModifyCardFromXML(), mozilla_sync_commit_addressbook_change(), and mozilla_sync_report_addressbook_changes_to_hash().

char * ThunderbirdCard::GetKey ( nsIAddrDatabase *  addrDatabase,
char **  pSzError,
void(*)(int level, bool sensitive, const char *szFile, int iLine, const char *szFunc, const char *szFormat,...)  pLogFunction 
)

Get key for OpenSync.

The key uniquely identfies the card towards OpenSync. Same key, same card.

Note that from nsIAbMDBCard we can GetKey a key for the card. But there seems to be no way retrieve the card, given the key! So, we use our own database field "OpenSyncKey". First time ThunderbirdCard::GetKey is called for a card, we retrieve the real key with nsIAbMDBCard::GetKey and store it with nsIAbMDBCard::SetStringAttribute in the "OpenSyncKey" field. On future calls we then retrieve the key with nsIAbMDBCard::GetStringAttribute

You must call nsIAddrDatabase->Close() afterwards. If not, the change is lost.

Parameters:
pSzError Pointer to string, into which we shall write an error message if we return false
addrDatabase Mozilla address database to get the key from
pLogFunction Function used to log information text
Returns:
string on success; NULL on error

References LOG, MOZ_ERROR_CHECK, myCard, NS_strdup(), and OPEN_SYNC_KEY.

Referenced by ThunderbirdAddressbook::LogInfo(), mozilla_sync_commit_addressbook_change(), and mozilla_sync_report_addressbook_changes_to_hash().

Here is the call graph for this function:

gchar * ThunderbirdCard::GetLongName ( char **  pSzError,
void(*)(int level, bool sensitive, const char *szFile, int iLine, const char *szFunc, const char *szFormat,...)  pLogFunction 
)

Get a strange name, only useful for debugging...

Parameters:
pSzError Pointer to string, into which we shall write an error message if we return false
pLogFunction Function used to log information text
Returns:
string on success; NULL on error

References MOZ_ERROR_CHECK, and myCard.

Referenced by ThunderbirdAddressbook::LogInfo().

gchar * ThunderbirdCard::GetXML ( char **  pSzError,
void(*)(int level, bool sensitive, const char *szFile, int iLine, const char *szFunc, const char *szFormat,...)  pLogFunction 
)

Get XML representation (OpenSync xmlformat-card) of the AbCard.

Parameters:
pSzError Pointer to string, into which we shall write an error message if we return false
pLogFunction Function used to log information text
Returns:
XML string on success; NULL on error

References _XMLAttributeDef::attributeType, MOZ_ERROR_CHECK, MY_ENCODING, myCard, NULL_ERROR_CHECK, RC_ERROR_CHECK, _XMLAttributeDef::szAttribute, _XMLEntryDef::szEntry, _XMLGroupDef::szGroup, _XMLEntryDef::szProperty, _XMLAttributeDef::szValue, _XMLGroupDef::xmlAttributeDef, _XMLGroupDef::xmlEntryDef, and _XMLContactDef::xmlGroupDef.

Referenced by ThunderbirdAddressbook::LogInfo(), and mozilla_sync_report_addressbook_changes_to_hash().

GList * ThunderbirdCard::PGListCapabilities (  )  [static]

Get list of field names representing Thunderbird card capabilities.

Returns:
List of strings

References GHFuncAddCap(), _XMLGroupDef::szGroup, and _XMLContactDef::xmlGroupDef.

Referenced by mozilla_sync_initialize().

Here is the call graph for this function:

gboolean ThunderbirdCard::ResetFromXML ( const gchar *  szXML,
char **  pSzError,
void(*)(int level, bool sensitive, const char *szFile, int iLine, const char *szFunc, const char *szFormat,...)  pLogFunction 
)

Clear contents of AbCard, then update from XML representation (OpenSync xmlformat-card).

Parameters:
szXML string according to xmlformat-card
pSzError Pointer to string, into which we shall write an error message if we return false
pLogFunction Function used to log information text
Returns:
string on success; NULL on error

Todo:
Clean all fields before updating from XML

References UpdateFromXML().

Referenced by ThunderbirdAddressbook::ModifyCardFromXML().

Here is the call graph for this function:

gboolean ThunderbirdCard::UpdateFromXML ( const gchar *  szXML,
char **  pSzError,
void(*)(int level, bool sensitive, const char *szFile, int iLine, const char *szFunc, const char *szFormat,...)  pLogFunction 
)

Update the AbCard from XML representation (OpenSync xmlformat-card).

Parameters:
szXML string according to xmlformat-card
pSzError Pointer to string, into which we shall write an error message if we return false
pLogFunction Function used to log information text
Returns:
string on success; NULL on error

References ATTRIBUTE_EQUAL, ATTRIBUTE_NOTEQUAL, _XMLAttributeDef::attributeType, ERROR, LOG, LOG_SENSITIVE, MOZ_ERROR_CHECK_FALSE, myCard, NS_strdup(), NS_strlen(), _XMLAttributeDef::szAttribute, _XMLEntryDef::szEntry, _XMLGroupDef::szGroup, _XMLEntryDef::szProperty, _XMLAttributeDef::szValue, _XMLGroupDef::xmlAttributeDef, _XMLGroupDef::xmlEntryDef, and _XMLContactDef::xmlGroupDef.

Referenced by CreateFromXML(), and ResetFromXML().

Here is the call graph for this function:


Member Data Documentation

nsCOMPtr<nsIAbCard> ThunderbirdCard::myCard


The documentation for this class was generated from the following files: