[Commits] vcard-utils.c 1.4 1.5

miras at claws-mail.org miras at claws-mail.org
Mon Jan 2 00:51:56 CET 2012


Update of /home/claws-mail/contacts/extensions/vcard/src
In directory claws-mail:/tmp/cvs-serv30558/extensions/vcard/src

Modified Files:
	vcard-utils.c 
Log Message:
2012-01-01 [mir]	0.6.0cvs71

	* extensions/vcard/src/vcard-utils.c
	    Added debug info.
	    Remove dead code.

Index: vcard-utils.c
===================================================================
RCS file: /home/claws-mail/contacts/extensions/vcard/src/vcard-utils.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- vcard-utils.c	1 Jan 2012 23:31:53 -0000	1.4
+++ vcard-utils.c	1 Jan 2012 23:51:54 -0000	1.5
@@ -292,9 +292,11 @@
 	type = plugin->name();
 	version = vcard_version(vcard);
 	
-	//fprintf(stderr, "=======================================\n");
-	//printVObject(stderr, vcard);
-	//fprintf(stderr, "=======================================\n");
+	if (debug_get_mode()) {
+		fprintf(stderr, "=======================================\n");
+		printVObject(stderr, vcard);
+		fprintf(stderr, "=======================================\n");
+	}
 	contact = contact_new();
 	initPropIterator(&iter,vcard);
 	while (moreIteration(&iter)) {
@@ -333,6 +335,8 @@
 			if (value) {
 				Email* e = g_new0(Email, 1);
 				e->email = g_strdup(value);
+				if (debug_get_mode())
+					email_dump(e, stderr);
 				contact->emails = g_slist_append(contact->emails, e);
 				g_free(value);
 			}
@@ -351,7 +355,6 @@
 			value = vcard_value(prop);
 			if (value) {
 				debug_print("adding: %s -> %s\n", attrib, value);
-				//fprintf(stderr, "(catch all) adding: %s -> %s\n", attrib, (gchar *)value);
 				swap_data(contact->data, attrib, value);
 				g_free(value);
 			}
@@ -360,6 +363,7 @@
 	}
 	
 	if (family) {
+		debug_print("adding: last-name -> %s\n", family);
 		swap_data(contact->data, "last-name", family);
 		g_free(family);
 	}
@@ -371,12 +375,17 @@
 				if (pos && strlen(family) > pos - family) {
 					pos += 1;
 					swap_data(contact->data, "last-name", pos);
+					debug_print("adding: last-name -> %s\n", pos);
 				}
-				else
+				else {
 					swap_data(contact->data, "last-name", "DUMMY");
+					debug_print("adding: last-name -> DUMMY\n");
+				}
 			}
-			else
+			else {
 				swap_data(contact->data, "last-name", "DUMMY");
+				debug_print("adding: last-name -> DUMMY\n");
+			}
 		}
 	}
 	
@@ -440,23 +449,6 @@
 	AttribType type = get_data(attr, &value);
 	set_prop(cb_data->o, cb_data->p, type, key, value);
 	g_free(value);
-/*	switch (type) {
-		case ATTRIB_TYPE_BOOLEAN:
-		case ATTRIB_TYPE_INT: {
-			int i = *(gint *) value;
-			prop = addProp(o, key);
-			setVObjectIntegerValue(prop, i);
-		}
-		case ATTRIB_TYPE_CHAR: {
-			char c = *(char *) value;
-			prop = addProp(o, key);
-			setVObjectStringZValue(prop, &c);
-		}
-		case ATTRIB_TYPE_STRING: {
-			gchar* s = (gchar *) value;
-			addPropValue(o, key, s);
-		}
-	}*/
 }
 
 static void slist_iter(gpointer d, gpointer u) {
@@ -482,7 +474,8 @@
 			g_hash_table_foreach(c->data, hash_iter, &cb_data);
 			g_slist_foreach(c->emails, slist_iter, cb_data.o);
 			vcards = g_slist_prepend(vcards, cb_data.o);
-			printVObject(stderr, cb_data.o);
+			if (debug_get_mode())
+				printVObject(stderr, cb_data.o);
 		}
 	}
 	



More information about the Commits mailing list