[Commits] ldap-plugin.c 1.10 1.11

miras at claws-mail.org miras at claws-mail.org
Mon Nov 28 22:45:29 CET 2011


Update of /home/claws-mail/contacts/plugins/ldap
In directory claws-mail:/tmp/cvs-serv9755/plugins/ldap

Modified Files:
	ldap-plugin.c 
Log Message:
2011-11-28 [mir]	0.6.0cvs30

	* configure.ac
	* plugins/ldap/ldap-plugin.c
	* plugins/xml/xml-plugin.c
	* src/callbacks.c
	* src/contactwindow.c
	* src/printing.c
	* src/utils.c
	* src/utils.h
	* xmllib/parser.c
	    - code cleaning to loose compile time
	      warnings and optimizer errors. 

Index: ldap-plugin.c
===================================================================
RCS file: /home/claws-mail/contacts/plugins/ldap/ldap-plugin.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- ldap-plugin.c	28 Nov 2011 17:52:14 -0000	1.10
+++ ldap-plugin.c	28 Nov 2011 21:45:27 -0000	1.11
@@ -643,16 +643,16 @@
 	gchar **new_list, **tmp, **head;
 	guint len;
 	
-	if (! list)
-		return list;
+	tmp = (gchar **) list;
+	if (! tmp)
+		return tmp;
 	
-	len = g_strv_length(list);
+	len = g_strv_length(tmp);
 	new_list = g_new0(gchar *, len + 1);
 	
 	if (len < 1)
 		return new_list;
 	
-	tmp = list;
 	head = new_list;
 	while (*tmp) {
 		debug_print("%s : %s\n", *tmp, native2ldap(*tmp));
@@ -671,7 +671,7 @@
 	g_hash_table_iter_init(&iter, attribs);
 	while (g_hash_table_iter_next(&iter, &key, &value)) {
 		const gchar* attr  = native2ldap((gchar *) key);
-		attr_list = g_slist_prepend(attr_list, attr);
+		attr_list = g_slist_prepend(attr_list, g_strdup(attr));
 	}
 	
 	res = gslist_to_array(attr_list, NULL);
@@ -787,7 +787,7 @@
 	gboolean multi = FALSE;
 
 	filter = g_string_new("");
-	head = list;
+	head = (gchar **) list;
 	while (head && *head) {
 		token = filter_token_add(object, *head++);
 		if (multi) {
@@ -810,7 +810,7 @@
 	gboolean multi = FALSE;
 
 	filter = g_string_new("");
-	head = list;
+	head = (gchar **) list;
 	while (head && *head) {
 		token = filter_token_add(*head++, value);
 		if (multi) {
@@ -853,11 +853,11 @@
 }
 
 static gchar* filter_build_standard() {
-	gchar **list;
+	gchar** list;
 	gchar* filter;
 
 	list = ldap2native_list(standard_attribs);
-	filter = filter_string_value(list, "*");
+	filter = filter_string_value((const gchar **) list, "*");
 	g_strfreev(list);
 	
 	return filter;
@@ -1000,8 +1000,9 @@
     gchar* search_filter;
 	gchar* tmp;
 	gboolean found = FALSE;
+	Contact* contact = (Contact *) ac->contact;
 
-	search_filter = filter_build(ac->contact, ac->intersection);
+	search_filter = filter_build(contact, ac->intersection);
 	filter = g_string_new("(&");
 	filter = g_string_append(filter, search_filter);
 	g_free(search_filter);
@@ -1063,8 +1064,9 @@
     LDAPMessage* res = NULL;
     gchar* search_filter;
 	GString* filter;
+	Contact* contact = (Contact *) ac->contact;
 	
-	search_filter = filter_build(ac->contact, ac->intersection);
+	search_filter = filter_build(contact, ac->intersection);
 	filter = g_string_new("(&");
 	filter = g_string_append(filter, search_filter);
 	g_free(search_filter);
@@ -1297,11 +1299,12 @@
 static gchar* contact_get_dn(AbookConnection* ac) {
 	gchar* dn = NULL;
 	GSList* cur;
+	Contact* contact = (Contact *) ac->contact;
 		
-	if (! ac->contact)
+	if (! contact)
 		dn = create_dummy_dn(ac->server->dn);
-	else if (! contact_has_dn(ac->contact)) {
-		cur = ac->contact->emails;
+	else if (! contact_has_dn(contact)) {
+		cur = contact->emails;
 		while(cur && ! dn) {
 			Email* e = (Email *) cur->data;
 			if (e->email)
@@ -1315,11 +1318,11 @@
 			Email* a = g_new0(Email, 1);
 			a->email = g_strdup(tmp);
 			g_free(tmp);
-			ac->contact->emails = g_slist_append(ac->contact->emails, a);
+			contact->emails = g_slist_append(contact->emails, a);
 		}
 	}
 	else {
-		extract_data(ac->contact->data, "dn", (gpointer) &dn);
+		extract_data(contact->data, "dn", (gpointer) &dn);
 	}
 	
 	return dn;
@@ -1364,7 +1367,7 @@
 
 static gchar** get_object_classes() {
 	gchar** obj;
-	guint size = g_strv_length(objectclass) + 1;
+	guint size = g_strv_length((gchar **) objectclass) + 1;
 	int i;
 	
 	obj = g_new0(gchar *, size);
@@ -1417,7 +1420,7 @@
 	while (cur && ! contact) {
 		contact = (Contact *) cur->data;
 		extract_data(contact->data, "dn", (gpointer) &uid);
-		if (! uid || utf8_collate(dn, uid) != 0) {
+		if (! uid || utf8_collate((gchar *) dn, uid) != 0) {
 			contact = NULL;
 			cur = cur->next;
 		}
@@ -1501,7 +1504,8 @@
 	Server* server;
 	guint row = 0;
 	GSList *cur, *attributes;
-	guint size = g_strv_length(standard_attribs) + g_strv_length(other_attributes);
+	guint size = g_strv_length((gchar **) standard_attribs) + 
+			g_strv_length((gchar **) other_attributes);
     LDAPMod *mods[size + 2]; /* including NULL and objects */
     LDAPMod modarr[size + 2]; /* including NULL and objects */
 	gchar* attr[size + 1][2];
@@ -1516,7 +1520,7 @@
 		return TRUE;
 	}
 	
-	if (! has_required_info(contact)) {
+	if (! has_required_info((Contact *) contact)) {
 		if (error)
 			*error = g_strdup(_("Missing mandatory attributes"));
 		return TRUE;
@@ -1529,7 +1533,7 @@
 		return TRUE;
 	}
 	server = ac->server;
-	ac->contact = contact;
+	ac->contact = (Contact *) contact;
 	
 	dn = contact_get_dn(ac);
 	if (! dn) {
@@ -1547,7 +1551,7 @@
 	if (! contact) {
 		Email* a = g_new0(Email, 1);
 		a->email = extract_email_from_dn(dn);
-		contact->emails = g_slist_append(contact->emails, a);
+		((Contact *) contact)->emails = g_slist_append(((Contact *) contact)->emails, a);
 	}
 	
 	cur = contact->emails;
@@ -1638,7 +1642,7 @@
 		return TRUE;
 	}
 	server = ac->server;
-	ac->contact = contact;
+	ac->contact = (Contact *) contact;
 
 	dn = contact_get_dn(ac);
     if (dn) {
@@ -1679,12 +1683,13 @@
 	AbookConnection* ac;
 	Contact* old;
 	GSList *diff, *cur;
-	AttribDef* attrib;
-	Email* email;
+	AttribDef* attrib = NULL;
+	Email* email = NULL;
 	Server* server;
 	guint row = 0;
 	guint num = 0;
-	guint size = g_strv_length(standard_attribs) + g_strv_length(other_attributes);
+	guint size = g_strv_length((gchar **) standard_attribs) +
+			g_strv_length((gchar **) other_attributes);
     LDAPMod *mods[size + 2]; // including NULL and objects
     LDAPMod modarr[size + 2]; // including NULL and objects
 	gchar* attr[size + 1][2];
@@ -1698,15 +1703,12 @@
 		return TRUE;
 	}
 	
-	if (! has_required_info(contact)) {
+	if (! has_required_info((Contact *) contact)) {
 		if (error)
 			*error = g_strdup(_("Missing mandatory attributes"));
 		return TRUE;
 	}
 
-	if (debug_get_mode())
-		contact_dump(contact, stderr);
-	
 	ac = get_abook_connection(abook);
 	if (! ac) {
 		if (error)
@@ -1714,8 +1716,8 @@
 		return TRUE;
 	}
 	server = ac->server;
+	ac->contact = (Contact *) contact;
 
-	ac->contact = contact;
 	dn = contact_get_dn(ac);
 	if (dn) {
 		/* Initialize structure */
@@ -1725,7 +1727,7 @@
 
 		old = address_book_contact_get(abook, dn);
 		if (old) {
-			diff = contact_diff(old, contact);
+			diff = contact_diff(old, ac->contact);
 			cur = diff;
 			old_dn = g_strdup(dn);
 			rc = ldap_set_dn(server, cur, &dn);



More information about the Commits mailing list