void addrbook_empty_book( AddressBookFile *book ) {
g_return_if_fail( book != NULL );
- // Free up folders and hash table
+ /* Free up folders and hash table */
addrcache_clear( book->addressCache );
g_list_free( book->tempList );
book->tempList = NULL;
- // Reset to initial state
+ /* Reset to initial state */
book->retVal = MGU_SUCCESS;
book->tempHash = NULL;
book->readFlag = FALSE;
book->path = NULL;
book->fileName = NULL;
- // Free up folders and hash table
+ /* Free up folders and hash table */
addrcache_free( book->addressCache );
book->addressCache = NULL;
* ***********************************************************************
*/
-// Element tag names
+/* Element tag names */
#define AB_ELTAG_ADDRESS "address"
#define AB_ELTAG_ATTRIBUTE "attribute"
#define AB_ELTAG_ATTRIBUTE_LIST "attribute-list"
#define AB_ATTAG_EID "eid"
#define AB_ATTAG_PID "pid"
-// Attribute values
+/* Attribute values */
#define AB_ATTAG_VAL_PERSON "person"
#define AB_ATTAG_VAL_GROUP "group"
#define AB_ATTAG_VAL_FOLDER "folder"
}
attr = g_list_next( attr );
}
- if( xml_parse_next_tag( file ) ) { // Consume closing tag
+ if( xml_parse_next_tag( file ) ) { /* Consume closing tag */
longjmp( book->jumper, 1 );
}
if( xml_compare_tag( file, AB_ELTAG_ADDRESS_LIST ) ) {
addrcache_hash_add_person( book->addressCache, person );
}
}
- if( xml_parse_next_tag( file ) ) { // Consume closing tag
+ if( xml_parse_next_tag( file ) ) { /* Consume closing tag */
longjmp( book->jumper, 1 );
}
if( xml_compare_tag( file, AB_ELTAG_ATTRIBUTE_LIST ) ) {
}
attr = g_list_next( attr );
}
- if( xml_parse_next_tag( file ) ) { // Consume closing tag
+ if( xml_parse_next_tag( file ) ) { /* Consume closing tag */
longjmp( book->jumper, 1 );
}
if( xml_compare_tag( file, AB_ELTAG_MEMBER_LIST ) ) {
}
attr = g_list_next( attr );
}
- if( xml_parse_next_tag( file ) ) { // Consume closing tag
+ if( xml_parse_next_tag( file ) ) { /* Consume closing tag */
longjmp( book->jumper, 1 );
}
if( xml_compare_tag( file, AB_ELTAG_ITEM_LIST ) ) {
if( folder ) {
if( addrcache_hash_add_folder( book->addressCache, folder ) ) {
book->tempList = g_list_append( book->tempList, folder );
- ADDRITEM_PARENT(folder) = NULL; // We will resolve folder later
+ ADDRITEM_PARENT(folder) = NULL; /* We will resolve folder later */
}
}
addrbook_parse_folder_list( book, file, folder );
retVal = TRUE;
for (;;) {
if (! file->level ) break;
- // Get next item tag (person, group or folder)
+ /* Get next item tag (person, group or folder) */
if( xml_parse_next_tag( file ) ) {
longjmp( book->jumper, 1 );
}
folder->listGroup = g_list_append( folder->listGroup, item );
ADDRITEM_PARENT(item) = ADDRITEM_OBJECT(folder);
}
- // Replace data with pointer to item
+ /* Replace data with pointer to item */
g_free( uid );
node->data = aio;
}
else {
- // Not found, append to remove list.
+ /* Not found, append to remove list. */
listRemove = g_list_append( listRemove, uid );
}
node = g_list_next( node );
}
rootFolder->listFolder = g_list_append( rootFolder->listFolder, folder );
- // Process remove list
+ /* Process remove list */
node = listRemove;
while( node ) {
gchar *uid = node->data;
nodeFolder = g_list_next( nodeFolder );
}
- // Remove folders with parents.
+ /* Remove folders with parents. */
listRemove = NULL;
node = rootFolder->listFolder;
while( node ) {
ItemFolder *folder = ( ItemFolder * ) node->data;
if( ADDRITEM_PARENT(folder) ) {
- // Remove folders with parents
+ /* Remove folders with parents */
listRemove = g_list_append( listRemove, folder );
}
else {
- // Add to root folder
+ /* Add to root folder */
ADDRITEM_PARENT(folder) = ADDRITEM_OBJECT(book->addressCache->rootFolder);
}
node = g_list_next( node );
}
- // Process remove list
+ /* Process remove list */
node = listRemove;
while( node ) {
rootFolder->listFolder = g_list_remove( rootFolder->listFolder, node->data );
}
g_list_free( listRemove );
- // Move all unparented persons and groups into root folder
+ /* Move all unparented persons and groups into root folder */
g_hash_table_foreach( book->addressCache->itemHash, addrbook_res_items_vis, book );
- // Free up some more
+ /* Free up some more */
nodeFolder = book->tempList;
while( nodeFolder ) {
ItemFolder *folder = nodeFolder->data;
if( file ) {
book->tempList = NULL;
- // Trap for parsing errors.
+ /* Trap for parsing errors. */
if( setjmp( book->jumper ) ) {
xml_close_file( file );
return book->retVal;
addrbook_read_tree( book, file );
xml_close_file( file );
- // Resolve folder items
+ /* Resolve folder items */
addrbook_resolve_folder_items( book );
book->tempList = NULL;
book->readFlag = TRUE;
addrbook_write_attr( fp, AB_ATTAG_COMMON_NAME, ADDRITEM_NAME(person) );
fputs( " >\n", fp);
- // Output email addresses
+ /* Output email addresses */
addrbook_write_elem_s( fp, 2, AB_ELTAG_ADDRESS_LIST );
fputs( ">\n", fp );
node = person->listEMail;
}
addrbook_write_elem_e( fp, 2, AB_ELTAG_ADDRESS_LIST );
- // Output user attributes
+ /* Output user attributes */
addrbook_write_elem_s( fp, 2, AB_ELTAG_ATTRIBUTE_LIST );
fputs( ">\n", fp );
node = person->listAttrib;
addrbook_write_attr( fp, AB_ATTAG_REMARKS, group->remarks );
fputs( " >\n", fp );
- // Output email address links
+ /* Output email address links */
addrbook_write_elem_s( fp, 2, AB_ELTAG_MEMBER_LIST );
fputs( ">\n", fp );
node = group->listEMail;
addrbook_write_attr( fp, AB_ATTAG_REMARKS, group->remarks );
fputs( " >\n", fp );
- // Output email address links
+ /* Output email address links */
addrbook_write_elem_s( fp, 2, AB_ELTAG_MEMBER_LIST );
fputs( ">\n", fp );
node = group->listEMail;
addrbook_write_elem_s( fp, 2, AB_ELTAG_ITEM_LIST );
fputs( ">\n", fp );
- // Output persons
+ /* Output persons */
node = folder->listPerson;
while ( node ) {
ItemPerson *item = node->data;
node = g_list_next( node );
}
- // Output groups
+ /* Output groups */
node = folder->listGroup;
while ( node ) {
ItemGroup *item = node->data;
node = g_list_next( node );
}
- // Output folders
+ /* Output folders */
node = folder->listFolder;
while ( node ) {
ItemFolder *item = node->data;
addrbook_write_elem_s( fp, 2, AB_ELTAG_ITEM_LIST );
fputs( ">\n", fp );
- // Output persons
+ /* Output persons */
node = folder->listPerson;
while ( node ) {
ItemPerson *item = node->data;
node = g_list_next( node );
}
- // Output groups
+ /* Output groups */
node = folder->listGroup;
while ( node ) {
ItemGroup *item = node->data;
node = g_list_next( node );
}
- // Output folders
+ /* Output folders */
node = folder->listFolder;
while ( node ) {
ItemFolder *item = node->data;
addrbook_write_attr( fp, AB_ATTAG_NAME, book->name );
fputs( " >\n", fp );
- // Output all persons
+ /* Output all persons */
g_hash_table_foreach( book->addressCache->itemHash, addrbook_write_item_person_vis, fp );
- // Output all groups
+ /* Output all groups */
g_hash_table_foreach( book->addressCache->itemHash, addrbook_write_item_group_vis, fp );
- // addrbook_write_folder_group( book->rootFolder, fp );
+ /* addrbook_write_folder_group( book->rootFolder, fp ); */
- // Output all folders
+ /* Output all folders */
g_hash_table_foreach( book->addressCache->itemHash, addrbook_write_item_folder_vis, fp );
- // addrbook_write_folder_folder( book->rootFolder, fp );
+ /* addrbook_write_folder_folder( book->rootFolder, fp ); */
addrbook_write_elem_e( fp, 0, AB_ELTAG_ADDRESS_BOOK );
book->retVal = MGU_SUCCESS;
g_return_if_fail( book != NULL );
g_return_if_fail( person != NULL );
- // Remember old list
+ /* Remember old list */
oldData = person->listEMail;
- // Attach new address list to person.
+ /* Attach new address list to person. */
node = listEMail;
while( node ) {
ItemEMail *email = node->data;
if( ADDRITEM_ID(email) == NULL ) {
- // Allocate an ID
+ /* Allocate an ID */
addrcache_id_email( book->addressCache, email );
}
ADDRITEM_PARENT(email) = ADDRITEM_OBJECT(person);
}
person->listEMail = listEMail;
- // Get groups where person's email is listed
+ /* Get groups where person's email is listed */
listGroup = addrcache_get_group_for_person( book->addressCache, person );
if( listGroup ) {
GHashTable *hashEMail;
GList *nodeGrp;
- // Load hash table with new address entries
+ /* Load hash table with new address entries */
hashEMail = g_hash_table_new( g_str_hash, g_str_equal );
node = listEMail;
while( node ) {
node = g_list_next( node );
}
- // Re-parent new addresses to existing groups, where email address match.
+ /* Re-parent new addresses to existing groups, where email address match. */
nodeGrp = listGroup;
while( nodeGrp ) {
ItemGroup *group = ( ItemGroup * ) nodeGrp->data;
GList *nodeGrpEM;
GList *listRemove = NULL;
- // Process each email item linked to group
+ /* Process each email item linked to group */
nodeGrpEM = groupEMail;
while( nodeGrpEM ) {
ItemEMail *emailGrp = ( ItemEMail * ) nodeGrpEM->data;
if( ADDRITEM_PARENT(emailGrp) == ADDRITEM_OBJECT(person) ) {
- // Found an email address for this person
+ /* Found an email address for this person */
ItemEMail *emailNew = NULL;
gchar *addr = g_strdup( emailGrp->address );
g_strdown( addr );
emailNew = ( ItemEMail * ) g_hash_table_lookup( hashEMail, addr );
g_free( addr );
if( emailNew ) {
- // Point to this entry
+ /* Point to this entry */
nodeGrpEM->data = emailNew;
}
else {
- // Mark for removal
+ /* Mark for removal */
listRemove = g_list_append( listRemove, emailGrp );
}
}
- // Move on to next email link
+ /* Move on to next email link */
nodeGrpEM = g_list_next( nodeGrpEM );
}
- // Process all removed links in current group
+ /* Process all removed links in current group */
nodeGrpEM = listRemove;
while( nodeGrpEM ) {
ItemEMail *emailGrp = nodeGrpEM->data;
nodeGrpEM = g_list_next( nodeGrpEM );
}
- // Move on to next group
+ /* Move on to next group */
nodeGrp = g_list_next( nodeGrp );
}
- // Clear hash table
+ /* Clear hash table */
g_hash_table_foreach_remove( hashEMail, ( GHRFunc ) addrbook_free_simple_hash_vis, NULL );
g_hash_table_destroy( hashEMail );
hashEMail = NULL;
listGroup = NULL;
}
- // Free up old data
+ /* Free up old data */
addritem_free_list_email( oldData );
oldData = NULL;
book->dirtyFlag = TRUE;
GList *node = person->listEMail;
while( node ) {
ItemEMail *email = node->data;
- //gchar *newKey = g_strdup( ADDRITEM_ID(email) );
+ /* gchar *newKey = g_strdup( ADDRITEM_ID(email) ); */
if( ! g_hash_table_lookup( book->tempHash, ADDRITEM_ID(email) ) ) {
book->tempList = g_list_append( book->tempList, email );
g_return_val_if_fail( book != NULL, NULL );
- // Load hash table with group email entries
+ /* Load hash table with group email entries */
table = g_hash_table_new( g_str_hash, g_str_equal );
if( group ) {
list = group->listEMail;
}
}
- // Build list of available email addresses which exclude those already in groups
+ /* Build list of available email addresses which exclude those already in groups */
book->tempList = NULL;
book->tempHash = table;
g_hash_table_foreach( book->addressCache->itemHash, addrbook_build_avail_email_vis, book );
book->tempList = NULL;
book->tempHash = NULL;
- // Clear hash table
+ /* Clear hash table */
g_hash_table_destroy( table );
table = NULL;
g_return_if_fail( book != NULL );
g_return_if_fail( group != NULL );
- // Remember old list
+ /* Remember old list */
oldData = group->listEMail;
group->listEMail = listEMail;
mgu_clear_list( oldData );
g_return_if_fail( book != NULL );
g_return_if_fail( person != NULL );
- // Remember old list
+ /* Remember old list */
oldData = person->listAttrib;
- // Attach new address list to person.
+ /* Attach new address list to person. */
node = listAttrib;
while( node ) {
UserAttribute *attrib = node->data;
if( attrib->uid == NULL ) {
- // Allocate an ID
+ /* Allocate an ID */
addrcache_id_attribute( book->addressCache, attrib );
}
node = g_list_next( node );
}
person->listAttrib = listAttrib;
- // Free up old data
+ /* Free up old data */
addritem_free_list_attribute( oldData );
oldData = NULL;
book->dirtyFlag = TRUE;
}
}
if( flg ) {
- // Get value
+ /* Get value */
val = strtol( numbuf, &endptr, 10 );
if( endptr && val > -1 ) {
if( val > maxval ) maxval = val;
}
if (file->level < prev_level) return;
attr = xml_get_current_tag_attr(file);
- // addrbook_show_attribs( attr );
+ /* addrbook_show_attribs( attr ); */
if( xml_compare_tag( file, AB_ELTAG_ADDRESS ) ) {
addrbook_chkparse_addr_list( book, file );
}
gchar *element;
attr = xml_get_current_tag_attr(file);
- // addrbook_show_attribs( attr );
+ /* addrbook_show_attribs( attr ); */
element = xml_get_element( file );
- // printf( "\t\tattrib value : %s\n", element );
+ /* printf( "\t\tattrib value : %s\n", element ); */
}
/*
GList *attr;
attr = xml_get_current_tag_attr(file);
- // addrbook_show_attribs( attr );
- if( xml_parse_next_tag( file ) ) { // Consume closing tag
+ /* addrbook_show_attribs( attr ); */
+ if( xml_parse_next_tag( file ) ) { /* Consume closing tag */
longjmp( book->jumper, 1 );
}
if( xml_compare_tag( file, AB_ELTAG_ADDRESS_LIST ) ) {
addrbook_chkparse_addr_list( book, file );
}
- if( xml_parse_next_tag( file ) ) { // Consume closing tag
+ if( xml_parse_next_tag( file ) ) { /* Consume closing tag */
longjmp( book->jumper, 1 );
}
if( xml_compare_tag( file, AB_ELTAG_ATTRIBUTE_LIST ) ) {
if (file->level < prev_level) return;
if( xml_compare_tag( file, AB_ELTAG_MEMBER ) ) {
attr = xml_get_current_tag_attr(file);
- // addrbook_show_attribs( attr );
+ /* addrbook_show_attribs( attr ); */
addrbook_chkparse_member_list( book, file );
}
else {
attr = xml_get_current_tag_attr( file );
- // addrbook_show_attribs( attr );
+ /* addrbook_show_attribs( attr ); */
}
}
}
GList *attr;
attr = xml_get_current_tag_attr(file);
- // addrbook_show_attribs( attr );
- if( xml_parse_next_tag( file ) ) { // Consume closing tag
+ /* addrbook_show_attribs( attr ); */
+ if( xml_parse_next_tag( file ) ) { /* Consume closing tag */
longjmp( book->jumper, 1 );
}
if( xml_compare_tag( file, AB_ELTAG_MEMBER_LIST ) ) {
if (file->level < prev_level) return;
if( xml_compare_tag( file, AB_ELTAG_ITEM ) ) {
attr = xml_get_current_tag_attr(file);
- // addrbook_show_attribs( attr );
+ /* addrbook_show_attribs( attr ); */
addrbook_chkparse_folder_list( book, file );
}
else {
attr = xml_get_current_tag_attr( file );
- // addrbook_show_attribs( attr );
+ /* addrbook_show_attribs( attr ); */
}
}
}
GList *attr;
attr = xml_get_current_tag_attr(file);
- // addrbook_show_attribs( attr );
- if( xml_parse_next_tag( file ) ) { // Consume closing tag
+ /* addrbook_show_attribs( attr ); */
+ if( xml_parse_next_tag( file ) ) { /* Consume closing tag */
longjmp( book->jumper, 1 );
}
if( xml_compare_tag( file, AB_ELTAG_ITEM_LIST ) ) {