inital gtk2 patch
[claws.git] / src / vcard.c
index 43d71a754fcdbffe52a09d8f1106b797da485073..fe3ee5b19456d5a9ead852cb31bf4d36fcb60d3c 100644 (file)
@@ -281,10 +281,8 @@ static gchar *vcard_read_qp( VCardFile *cardFile, char *tagvalue ) {
        while( line ) {
                listQP = g_slist_append( listQP, line );
                len = strlen( line ) - 1;
-               if( len > 0 ) {
-                       if( line[ len ] != '=' ) break;
-                       line[ len ] = '\0';
-               }
+               if( line[ len ] != '=' ) break;
+               line[ len ] = '\0';
                line = vcard_get_line( cardFile );
        }
 
@@ -347,29 +345,12 @@ static gchar *vcard_get_tagvalue( gchar* line, gchar dlm ) {
        return value;
 }
 
-/*
-* Dump linked lists of character strings (for debug).
-*/
-static void vcard_dump_lists( GSList *listName, GSList *listAddr, GSList *listRem, GSList *listID, FILE *stream ) {
-       fprintf( stream, "dump name\n" );
-       fprintf( stream, "------------\n" );
-       mgu_print_list( listName, stdout );
-       fprintf( stream, "dump address\n" );
-       fprintf( stream, "------------\n" );
-       mgu_print_list( listAddr, stdout );
-       fprintf( stream, "dump remarks\n" );
-       fprintf( stdout, "------------\n" );
-       mgu_print_list( listRem, stdout );
-       fprintf( stream, "dump id\n" );
-       fprintf( stdout, "------------\n" );
-       mgu_print_list( listID, stdout );
-}
-
 /*
 * Build an address list entry and append to list of address items.
 */
-static void vcard_build_items( VCardFile *cardFile, GSList *listName, GSList *listAddr, GSList *listRem,
-                               GSList *listID )
+static void vcard_build_items(
+       VCardFile *cardFile, GSList *listName, GSList *listAddr,
+       GSList *listRem, GSList *listID )
 {
        GSList *nodeName = listName;
        GSList *nodeID = listID;
@@ -388,7 +369,8 @@ static void vcard_build_items( VCardFile *cardFile, GSList *listName, GSList *li
                                if( nodeRemarks ) {
                                        if( str ) {
                                                if( g_strcasecmp( str, "internet" ) != 0 ) {
-                                                       if( *str != '\0' ) addritem_email_set_remarks( email, str );
+                                                       if( *str != '\0' )
+                                                               addritem_email_set_remarks( email, str );
                                                }
                                        }
                                }
@@ -401,14 +383,14 @@ static void vcard_build_items( VCardFile *cardFile, GSList *listName, GSList *li
                if( person->listEMail ) {
                        addrcache_id_person( cardFile->addressCache, person );
                        addrcache_add_person( cardFile->addressCache, person );
+                       if( nodeID ) {
+                               str = nodeID->data;
+                               addritem_person_set_external_id( person, str );
+                       }
                }
                else {
                        addritem_free_item_person( person );
                }
-               if( nodeID ) {
-                       str = nodeID->data;
-                       addritem_person_set_external_id( person, str );
-               }
                nodeName = g_slist_next( nodeName );
                nodeID = g_slist_next( nodeID );
        }
@@ -644,7 +626,7 @@ gboolean vcard_validate( const VCardFile *cardFile ) {
 *      be g_free() when done.
 */
 gchar *vcard_find_gnomecard( void ) {
-       gchar *homedir;
+       const gchar *homedir;
        gchar buf[ WORK_BUFLEN ];
        gchar str[ WORK_BUFLEN ];
        gchar *fileSpec;