[Commits] [SCM] claws branch, litehtml, updated. 3.17.3-49-g0966618

miras at claws-mail.org miras at claws-mail.org
Sun Dec 30 17:12:22 CET 2018


The branch, litehtml has been updated
       via  096661899d831e655d5c996b44dee2428e20b9c3 (commit)
       via  a4aac3390985e89614a04594ff40cf21da68190e (commit)
       via  c8757d8ad98a715dd96228f12681dba37b59fa17 (commit)
       via  60c15ac9a22245f7de30f6e804f83a3273e7eac3 (commit)
      from  0fbe4e53687c000dc7b17fa51d60f919c5cc9823 (commit)

Summary of changes:
 src/addressbook-dbus.c |  556 ++++++++++++++++++++++++------------------------
 src/addressbook-dbus.h |   28 +--
 2 files changed, 292 insertions(+), 292 deletions(-)


- Log -----------------------------------------------------------------
commit 096661899d831e655d5c996b44dee2428e20b9c3
Author: Michael Rasmussen <mir at datanom.net>
Date:   Sun Dec 30 16:54:52 2018 +0100

    Fix deprecation warning
    
    Signed-off-by: Michael Rasmussen <mir at datanom.net>

diff --git a/src/addressbook-dbus.c b/src/addressbook-dbus.c
index 154550d..517f1e3 100644
--- a/src/addressbook-dbus.c
+++ b/src/addressbook-dbus.c
@@ -95,12 +95,12 @@ static GHashTable* hash_table_new(void) {
 }
 
 static void g_value_email_free(gpointer data) {
-    GValueArray* email = (GValueArray *) data;
+    GArray* email = (GArray *) data;
     GValue* email_member;
     guint i;
 
-    for (i = 0; i < email->n_values; i++) {
-        email_member = g_value_array_get_nth(email, i);
+    for (i = 0; i < email->len; i++) {
+        email_member = g_array_index(email, GValue*, i);
         g_value_unset(email_member);
     }
 }
@@ -137,7 +137,7 @@ static gchar* convert_2_utf8(gchar* locale) {
 static void format_contact(DBusContact* contact, ContactData* c) {
     gchar* firstname;
     gchar* lastname;
-    GValueArray* email = NULL;
+    GArray* email = NULL;
     GValue email_member = {0};
     gchar* str;
     gchar* image = NULL;
@@ -177,12 +177,12 @@ static void format_contact(DBusContact* contact, ContactData* c) {
         g_strdup("image"), g_base64_encode((const guchar *) image, size));
     }
 
-    email = g_value_array_new(0);
+    email = g_array_new(FALSE, FALSE, sizeof(GValue*));
 
     /* Alias is not available but needed so make an empty string */
     g_value_init(&email_member, G_TYPE_STRING);
     g_value_set_string(&email_member, "");
-    g_value_array_append(email, &email_member);
+    g_array_append_val(email, email_member);
     g_value_unset(&email_member);
 
     if (c->email)
@@ -192,7 +192,7 @@ static void format_contact(DBusContact* contact, ContactData* c) {
 
     g_value_init(&email_member, G_TYPE_STRING);
     g_value_set_string(&email_member, str);
-    g_value_array_append(email, &email_member);
+    g_array_append_val(email, email_member);
     g_value_unset(&email_member);
     g_free(str);
 
@@ -203,7 +203,7 @@ static void format_contact(DBusContact* contact, ContactData* c) {
 
     g_value_init(&email_member, G_TYPE_STRING);
     g_value_set_string(&email_member, str);
-    g_value_array_append(email, &email_member);
+    g_array_append_val(email, email_member);
     g_value_unset(&email_member);
     g_free(str);
 
@@ -459,7 +459,7 @@ gboolean addressbook_add_vcard(const gchar* abook, const gchar* vcard, GError**
 }
 
 static gboolean my_compose_create_hook(gpointer source, gpointer user_data) {
-    Compose *compose = (Compose*) source;
+    //Compose *compose = (Compose*) source;
     GError* error = NULL;
 
     gchar* vcard = addressbook_get_vcard("test", &error);

commit a4aac3390985e89614a04594ff40cf21da68190e
Author: Michael Rasmussen <mir at datanom.net>
Date:   Sun Dec 30 16:17:51 2018 +0100

    Remove mysterious chars and replace with correct tab chars
    
    Signed-off-by: Michael Rasmussen <mir at datanom.net>

diff --git a/src/addressbook-dbus.h b/src/addressbook-dbus.h
index d9ca0b9..9ed4fa8 100644
--- a/src/addressbook-dbus.h
+++ b/src/addressbook-dbus.h
@@ -42,30 +42,30 @@ G_BEGIN_DECLS
 #include "compose.h"
 
 typedef struct {
-	gchar*		cn;
-	gchar*		email;
-	gchar*		remarks;
-	gchar*		name;
-	gchar*		book;
-	GdkPixbuf* picture;
+    gchar*  cn;
+    gchar*  email;
+    gchar*  remarks;
+    gchar*  name;
+    gchar*  book;
+    GdkPixbuf* picture;
 } ContactData;
 
 gboolean addressbook_start_service(GError** error);
 void addressbook_install_hooks(GError** error);
 int addressbook_dbus_add_contact(ContactData* contact, GError** error);
 gboolean addrindex_dbus_load_completion(gint (*callBackFunc)
-										(const gchar* name,
-										 const gchar* address,
-										 const gchar* nick,
-										 const gchar* alias,
-										 GList* grp_emails),
-										 GError** error);
+                                        (const gchar* name,
+                                         const gchar* address,
+                                         const gchar* nick,
+                                         const gchar* alias,
+                                         GList* grp_emails),
+                                         GError** error);
 void addressbook_dbus_open(gboolean compose, GError** error);
 GSList* addressbook_dbus_get_books(GError** error);
 void contact_data_free(ContactData** data);
 void addressbook_harvest(FolderItem *folderItem,
-						 gboolean sourceInd,
-						 GList *msgList );
+                         gboolean sourceInd,
+                         GList *msgList );
 void addressbook_connect_signals(Compose* compose);
 gchar* addressbook_get_vcard(const gchar* account, GError** error);
 gboolean addressbook_add_vcard(const gchar* abook, const gchar* vcard, GError** error);

commit c8757d8ad98a715dd96228f12681dba37b59fa17
Author: Michael Rasmussen <mir at datanom.net>
Date:   Sun Dec 30 16:14:06 2018 +0100

    Remove mysterious chars and replace with correct tab chars
    
    Signed-off-by: Michael Rasmussen <mir at datanom.net>

diff --git a/src/addressbook-dbus.c b/src/addressbook-dbus.c
index a71cd06..154550d 100644
--- a/src/addressbook-dbus.c
+++ b/src/addressbook-dbus.c
@@ -27,7 +27,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * 
+ *
  */
 
 #ifdef HAVE_CONFIG_H
@@ -139,7 +139,7 @@ static void format_contact(DBusContact* contact, ContactData* c) {
     gchar* lastname;
     GValueArray* email = NULL;
     GValue email_member = {0};
-    gchar* str;   
+    gchar* str;
     gchar* image = NULL;
     gsize size;
 

commit 60c15ac9a22245f7de30f6e804f83a3273e7eac3
Author: Michael Rasmussen <mir at datanom.net>
Date:   Sun Dec 30 16:12:03 2018 +0100

    Remove mysterious chars and replace with correct tab chars
    
    Signed-off-by: Michael Rasmussen <mir at datanom.net>

diff --git a/src/addressbook-dbus.c b/src/addressbook-dbus.c
index 2892b3c..a71cd06 100644
--- a/src/addressbook-dbus.c
+++ b/src/addressbook-dbus.c
@@ -12,8 +12,8 @@
  * More lightweight is achieved by design, in that sence that the whole
  * structure is based on a plugable design.
  *
- * Claws Mail is Copyright (C) 1999-2012 by the Claws Mail Team and
- * Claws-contacts is Copyright (C) 2011 by Michael Rasmussen.
+ * Claws Mail is Copyright (C) 1999-2018 by the Claws Mail Team and
+ * Claws-contacts is Copyright (C) 2018 by Michael Rasmussen.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -62,12 +62,12 @@ static GQuark client_object_error_quark() {
 static gboolean init(GError** error) {
     connection = dbus_g_bus_get (DBUS_BUS_SESSION, error);
     if (connection == NULL || *error) {
-		if (! *error)
-			g_set_error(error, client_object_error_quark(), 1, "Unable to connect to dbus");
+        if (! *error)
+            g_set_error(error, client_object_error_quark(), 1, "Unable to connect to dbus");
         g_warning("Unable to connect to dbus: %s", (*error)->message);
         return FALSE;
     }
-    
+
     proxy = dbus_g_proxy_new_for_name (connection,
             "org.clawsmail.Contacts",
             "/org/clawsmail/contacts",
@@ -77,7 +77,7 @@ static gboolean init(GError** error) {
         g_set_error(error, client_object_error_quark(), 1, "Could not get a proxy object");
         return FALSE;
     }
-    
+
     return TRUE;
 }
 
@@ -87,26 +87,26 @@ static void dbus_contact_free(const DBusContact* contact) {
 }
 
 static GHashTable* hash_table_new(void) {
-	GHashTable* hash_table;
-	
-	hash_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
-		
-	return hash_table;
+    GHashTable* hash_table;
+
+    hash_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
+
+    return hash_table;
 }
 
 static void g_value_email_free(gpointer data) {
-	GValueArray* email = (GValueArray *) data;
-	GValue* email_member;
-	guint i;
-	
-	for (i = 0; i < email->n_values; i++) {
-		email_member = g_value_array_get_nth(email, i);
-		g_value_unset(email_member);
-	}
+    GValueArray* email = (GValueArray *) data;
+    GValue* email_member;
+    guint i;
+
+    for (i = 0; i < email->n_values; i++) {
+        email_member = g_value_array_get_nth(email, i);
+        g_value_unset(email_member);
+    }
 }
 
 static GPtrArray* g_value_email_new() {
-	return g_ptr_array_new_with_free_func(g_value_email_free);
+    return g_ptr_array_new_with_free_func(g_value_email_free);
 }
 
 static gchar* convert_2_utf8(gchar* locale) {
@@ -140,13 +140,13 @@ static void format_contact(DBusContact* contact, ContactData* c) {
     GValueArray* email = NULL;
     GValue email_member = {0};
     gchar* str;   
-	gchar* image = NULL;
-	gsize size;
-    
+    gchar* image = NULL;
+    gsize size;
+
     contact->data = hash_table_new();
     contact->emails = g_value_email_new();
     firstname = lastname = NULL;
-    
+
     if (c->name) {
         gchar* pos = strchr(c->name, ' ');
         if (pos) {
@@ -165,21 +165,21 @@ static void format_contact(DBusContact* contact, ContactData* c) {
         g_free(firstname);
         g_free(lastname);
     }
-	if (c->cn) {
-		g_hash_table_replace(contact->data,
-			g_strdup("cn"), convert_2_utf8(c->cn));
-	}
-
-	if (c->picture) {
-		gdk_pixbuf_save_to_buffer(
-			c->picture, &image, &size, "png", NULL, NULL);
-		g_hash_table_replace(contact->data,
-			g_strdup("image"), g_base64_encode((const guchar *) image, size));
-	}
-	
+    if (c->cn) {
+        g_hash_table_replace(contact->data,
+        g_strdup("cn"), convert_2_utf8(c->cn));
+    }
+
+    if (c->picture) {
+        gdk_pixbuf_save_to_buffer(
+        c->picture, &image, &size, "png", NULL, NULL);
+        g_hash_table_replace(contact->data,
+        g_strdup("image"), g_base64_encode((const guchar *) image, size));
+    }
+
     email = g_value_array_new(0);
 
-	/* Alias is not available but needed so make an empty string */
+    /* Alias is not available but needed so make an empty string */
     g_value_init(&email_member, G_TYPE_STRING);
     g_value_set_string(&email_member, "");
     g_value_array_append(email, &email_member);
@@ -200,7 +200,7 @@ static void format_contact(DBusContact* contact, ContactData* c) {
         str = convert_2_utf8(c->remarks);
     else
         str = g_strdup("");
-    
+
     g_value_init(&email_member, G_TYPE_STRING);
     g_value_set_string(&email_member, str);
     g_value_array_append(email, &email_member);
@@ -211,277 +211,277 @@ static void format_contact(DBusContact* contact, ContactData* c) {
 }
 
 static DBusHandlerResult contact_add_signal(DBusConnection* bus,
-							   				DBusMessage* message,
-							   				gpointer data) {
-	DBusError error;
+                                            DBusMessage* message,
+                                            gpointer data) {
+    DBusError error;
     gchar *s = NULL;
 
-	if (! compose_instance) {
-		g_message("Missing compose instance\n");
-		return DBUS_HANDLER_RESULT_HANDLED;
-	}
-
-   	dbus_error_init (&error);
-
-	if (dbus_message_is_signal(message, "org.clawsmail.Contacts", "ContactMailTo")) {
-    	if (dbus_message_get_args(
-				message, &error, DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID)) {
-      		debug_print("ContactMailTo address received: %s\n", s);
-			compose_entry_append(compose_instance, s, COMPOSE_TO, PREF_NONE);
-    	}
-		else {
-      		debug_print("ContactMailTo received with error: %s\n", error.message);
-      		dbus_error_free(&error);
-    	}
-	}
-	else if (dbus_message_is_signal(message, "org.clawsmail.Contacts", "ContactMailCc")) {
-    	if (dbus_message_get_args(
-				message, &error, DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID)) {
-      		debug_print("ContactMailTo address received: %s\n", s);
-			compose_entry_append(compose_instance, s, COMPOSE_CC, PREF_NONE);
-    	}
-		else {
-      		debug_print("ContactMailTo received with error: %s\n", error.message);
-      		dbus_error_free(&error);
-    	}
-	}
-	else if (dbus_message_is_signal(message, "org.clawsmail.Contacts", "ContactMailBcc")) {
-    	if (dbus_message_get_args(
-				message, &error, DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID)) {
-      		debug_print("ContactMailTo address received: %s\n", s);
-			compose_entry_append(compose_instance, s, COMPOSE_BCC, PREF_NONE);
-    	}
-		else {
-      		debug_print("ContactMailTo received with error: %s\n", error.message);
-      		dbus_error_free(&error);
-    	}
-	}
-	else {
-		if (error.message) {
-			g_warning("Reception error: %s", error.message);
-			dbus_error_free(&error);
-		}
-		debug_print("Unhandled signal received\n");
-		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-	}
-
-	return DBUS_HANDLER_RESULT_HANDLED;
+    if (! compose_instance) {
+        g_message("Missing compose instance\n");
+        return DBUS_HANDLER_RESULT_HANDLED;
+    }
+
+    dbus_error_init (&error);
+
+    if (dbus_message_is_signal(message, "org.clawsmail.Contacts", "ContactMailTo")) {
+        if (dbus_message_get_args(
+            message, &error, DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID)) {
+            debug_print("ContactMailTo address received: %s\n", s);
+            compose_entry_append(compose_instance, s, COMPOSE_TO, PREF_NONE);
+        }
+        else {
+            debug_print("ContactMailTo received with error: %s\n", error.message);
+            dbus_error_free(&error);
+        }
+    }
+    else if (dbus_message_is_signal(message, "org.clawsmail.Contacts", "ContactMailCc")) {
+        if (dbus_message_get_args(
+            message, &error, DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID)) {
+            debug_print("ContactMailTo address received: %s\n", s);
+            compose_entry_append(compose_instance, s, COMPOSE_CC, PREF_NONE);
+        }
+        else {
+            debug_print("ContactMailTo received with error: %s\n", error.message);
+            dbus_error_free(&error);
+        }
+    }
+    else if (dbus_message_is_signal(message, "org.clawsmail.Contacts", "ContactMailBcc")) {
+        if (dbus_message_get_args(
+            message, &error, DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID)) {
+            debug_print("ContactMailTo address received: %s\n", s);
+            compose_entry_append(compose_instance, s, COMPOSE_BCC, PREF_NONE);
+        }
+        else {
+            debug_print("ContactMailTo received with error: %s\n", error.message);
+            dbus_error_free(&error);
+        }
+    }
+    else {
+        if (error.message) {
+            g_warning("Reception error: %s", error.message);
+            dbus_error_free(&error);
+        }
+        debug_print("Unhandled signal received\n");
+        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+    }
+
+    return DBUS_HANDLER_RESULT_HANDLED;
 }
 
 gboolean addressbook_start_service(GError** error) {
-	gchar* reply = NULL;
-	gboolean result = FALSE;
-	
-	if (! init(error))
-		return result;
-
-	if (!org_clawsmail_Contacts_ping(proxy, &reply, error)) {
-		if (! *error)
-			g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
-		g_warning ("Woops remote method failed: %s", (*error)->message);
-	}
-	if (reply && strcmp("PONG", reply) == 0)
-		result = TRUE;
-		
-	return result;
+    gchar* reply = NULL;
+    gboolean result = FALSE;
+
+    if (! init(error))
+        return result;
+
+    if (!org_clawsmail_Contacts_ping(proxy, &reply, error)) {
+        if (! *error)
+            g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
+        g_warning ("Woops remote method failed: %s", (*error)->message);
+    }
+    if (reply && strcmp("PONG", reply) == 0)
+        result = TRUE;
+
+    return result;
 }
 
 int addressbook_dbus_add_contact(ContactData* contact, GError** error) {
-	DBusContact dbus_contact;
-	
-	if (! init(error))
-		return -1;
-
-	format_contact(&dbus_contact, contact);
-	if (!org_clawsmail_Contacts_add_contact(
-		proxy, contact->book, dbus_contact.data, dbus_contact.emails, error)) {
-		if (! *error)
-			g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
-		g_warning ("Woops remote method failed: %s", (*error)->message);
-		dbus_contact_free(&dbus_contact);
-		return -1;
-	}
-	dbus_contact_free(&dbus_contact);
-	return 0;
+    DBusContact dbus_contact;
+
+    if (! init(error))
+        return -1;
+
+    format_contact(&dbus_contact, contact);
+    if (!org_clawsmail_Contacts_add_contact(
+        proxy, contact->book, dbus_contact.data, dbus_contact.emails, error)) {
+        if (! *error)
+            g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
+        g_warning ("Woops remote method failed: %s", (*error)->message);
+        dbus_contact_free(&dbus_contact);
+        return -1;
+    }
+    dbus_contact_free(&dbus_contact);
+    return 0;
 }
 
 gboolean addrindex_dbus_load_completion(gint (*callBackFunc)
-										(const gchar* name,
-										 const gchar* address,
-										 const gchar* nick,
-										 const gchar* alias,
-										 GList* grp_emails),
-										 GError** error) {
-	gchar **list = NULL, **contacts;
-	gchar *name, *email;
-	
-	if (! init(error))
-		return FALSE;
-
-	if (!org_clawsmail_Contacts_search_addressbook(
-			proxy, "*", NULL, &list, error)) {
-		if (! *error)
-			g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
-		g_warning ("Woops remote method failed: %s", (*error)->message);
-	    g_strfreev(list);
-	    return FALSE;
+                                        (const gchar* name,
+                                         const gchar* address,
+                                         const gchar* nick,
+                                         const gchar* alias,
+                                         GList* grp_emails),
+                                         GError** error) {
+    gchar **list = NULL, **contacts;
+    gchar *name, *email;
+
+    if (! init(error))
+        return FALSE;
+
+    if (!org_clawsmail_Contacts_search_addressbook(
+        proxy, "*", NULL, &list, error)) {
+        if (! *error)
+            g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
+        g_warning ("Woops remote method failed: %s", (*error)->message);
+        g_strfreev(list);
+        return FALSE;
+    }
+    for (contacts = list; *contacts != NULL; contacts += 1) {
+        gchar* tmp = g_strdup(*contacts);
+        gchar* pos = g_strrstr(tmp, "\"");
+    if (pos) {
+            /* Contact has a name as part of email address */
+            *pos = '\0';
+            name = tmp;
+            name += 1;
+            pos += 3;
+            email = pos;
+            pos = g_strrstr(email, ">");
+            if (pos)
+            *pos = '\0';
+        }
+        else {
+            name = "";
+            email = tmp;
+        }
+        debug_print("Adding: %s <%s> to completition\n", name, email);
+        callBackFunc(name, email, NULL, NULL, NULL);
+        g_free(tmp);
     }
-	for (contacts = list; *contacts != NULL; contacts += 1) {
-		gchar* tmp = g_strdup(*contacts);
-		gchar* pos = g_strrstr(tmp, "\"");
-		if (pos) {
-		    /* Contact has a name as part of email address */
-		    *pos = '\0';
-		    name = tmp;
-		    name += 1;
-		    pos += 3;
-		    email = pos;
-		    pos = g_strrstr(email, ">");
-		    if (pos)
-			*pos = '\0';
-		}
-		else {
-		    name = "";
-		    email = tmp;
-		}
-		debug_print("Adding: %s <%s> to completition\n", name, email);
-		callBackFunc(name, email, NULL, NULL, NULL);
-		g_free(tmp);
-	}
 
     return TRUE;
 }
 
 void addressbook_dbus_open(gboolean compose, GError** error) {
-	if (! init(error))
-		return;
-
-	if (!org_clawsmail_Contacts_show_addressbook(proxy, compose, error)) {
-		if (! *error)
-			g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
-		g_warning ("Woops remote method failed: %s", (*error)->message);
-	}
+    if (! init(error))
+        return;
+
+    if (!org_clawsmail_Contacts_show_addressbook(proxy, compose, error)) {
+        if (! *error)
+            g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
+        g_warning ("Woops remote method failed: %s", (*error)->message);
+    }
 }
 
 GSList* addressbook_dbus_get_books(GError** error) {
-	gchar **book_names = NULL, **cur;
-	GSList* books = NULL;
-	
-	if (! init(error)) {
-		return books;
-	}
-	
-	if (!org_clawsmail_Contacts_book_list(proxy, &book_names, error)) {
-		if (! *error)
-			g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
-		g_warning ("Woops remote method failed: %s", (*error)->message);
-		g_strfreev(book_names);
-		return books;
-	}
-	for (cur = book_names; *cur; cur += 1)
-		books = g_slist_prepend(books, g_strdup(*cur));
-	
-	g_strfreev(book_names);
-	
-	return books;
+    gchar **book_names = NULL, **cur;
+    GSList* books = NULL;
+
+    if (! init(error)) {
+        return books;
+    }
+
+    if (!org_clawsmail_Contacts_book_list(proxy, &book_names, error)) {
+        if (! *error)
+            g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
+        g_warning ("Woops remote method failed: %s", (*error)->message);
+        g_strfreev(book_names);
+        return books;
+    }
+    for (cur = book_names; *cur; cur += 1)
+        books = g_slist_prepend(books, g_strdup(*cur));
+
+    g_strfreev(book_names);
+
+    return books;
 }
 
 void contact_data_free(ContactData** data) {
-	ContactData* contact;
-	
-	if (! data && ! *data)
-		return;
-		
-	contact = *data;
-	g_free(contact->cn);
-	g_free(contact->email);
-	g_free(contact->remarks);
-	g_free(contact->name);
-	g_free(contact->book);
-	g_free(contact);
-	*data = NULL;
+    ContactData* contact;
+
+    if (! data && ! *data)
+        return;
+
+    contact = *data;
+    g_free(contact->cn);
+    g_free(contact->email);
+    g_free(contact->remarks);
+    g_free(contact->name);
+    g_free(contact->book);
+    g_free(contact);
+    *data = NULL;
 }
 
 void addressbook_harvest(FolderItem *folderItem,
-						 gboolean sourceInd,
-						 GList *msgList ) {
-	addrgather_dlg_execute(folderItem, sourceInd, msgList);
+                         gboolean sourceInd,
+                         GList *msgList ) {
+    addrgather_dlg_execute(folderItem, sourceInd, msgList);
 }
 
 void addressbook_connect_signals(Compose* compose) {
-	DBusConnection* bus;
-  	DBusError* error = NULL;
-  	
-	g_return_if_fail(compose != NULL);
-	
-	bus = dbus_bus_get (DBUS_BUS_SESSION, error);
-  	if (!bus) {
-    	g_warning ("Failed to connect to the D-BUS daemon: %s", error->message);
-    	dbus_error_free(error);
-    	return;
-  	}
-	
-  	debug_print("Compose: %p\n", compose);
-	compose_instance = compose;
-	dbus_bus_add_match(bus, "type='signal',interface='org.clawsmail.Contacts'", error);
-	if (error) {
-		debug_print("Failed to add match to the D-BUS daemon: %s\n", error->message);
-    	dbus_error_free(error);
-    	return;
-	}
-	dbus_connection_add_filter(bus, contact_add_signal, NULL, NULL);
+    DBusConnection* bus;
+    DBusError* error = NULL;
+
+    g_return_if_fail(compose != NULL);
+
+    bus = dbus_bus_get (DBUS_BUS_SESSION, error);
+    if (!bus) {
+        g_warning ("Failed to connect to the D-BUS daemon: %s", error->message);
+        dbus_error_free(error);
+        return;
+    }
+
+    debug_print("Compose: %p\n", compose);
+    compose_instance = compose;
+    dbus_bus_add_match(bus, "type='signal',interface='org.clawsmail.Contacts'", error);
+    if (error) {
+        debug_print("Failed to add match to the D-BUS daemon: %s\n", error->message);
+        dbus_error_free(error);
+        return;
+    }
+    dbus_connection_add_filter(bus, contact_add_signal, NULL, NULL);
 }
 
 gchar* addressbook_get_vcard(const gchar* account, GError** error) {
-	gchar* vcard = NULL;
-	
-	g_return_val_if_fail(account != NULL, vcard);
-	
-	if (! init(error)) {
-		return vcard;
-	}
-	
-	if (!org_clawsmail_Contacts_get_vcard(proxy, account, &vcard, error)) {
-		if (! *error)
-			g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
-		g_warning ("Woops remote method failed: %s", (*error)->message);
-		g_free(vcard);
-		vcard = NULL;
-	}
-	
-	return vcard;
+    gchar* vcard = NULL;
+
+    g_return_val_if_fail(account != NULL, vcard);
+
+    if (! init(error)) {
+        return vcard;
+    }
+
+    if (!org_clawsmail_Contacts_get_vcard(proxy, account, &vcard, error)) {
+        if (! *error)
+            g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
+        g_warning ("Woops remote method failed: %s", (*error)->message);
+        g_free(vcard);
+        vcard = NULL;
+}
+
+    return vcard;
 }
 
 gboolean addressbook_add_vcard(const gchar* abook, const gchar* vcard, GError** error) {
-	gboolean result = FALSE;
-	
-	return result;
+    gboolean result = FALSE;
+
+    return result;
 }
 
 static gboolean my_compose_create_hook(gpointer source, gpointer user_data) {
-	Compose *compose = (Compose*) source;
-	GError* error = NULL;
-
-	gchar* vcard = addressbook_get_vcard("test", &error);
-	if (error) {
-		g_warning("%s", error->message);
-		g_clear_error(&error);
-	}
-	else {
-		debug_print("test.vcf:\n%s\n", vcard);
-		g_free(vcard);
-	}
-	
-	return FALSE;
+    Compose *compose = (Compose*) source;
+    GError* error = NULL;
+
+    gchar* vcard = addressbook_get_vcard("test", &error);
+    if (error) {
+        g_warning("%s", error->message);
+        g_clear_error(&error);
+    }
+    else {
+        debug_print("test.vcf:\n%s\n", vcard);
+        g_free(vcard);
+}
+
+    return FALSE;
 }
 
 void addressbook_install_hooks(GError** error) {
-	if ((guint)-1 == hooks_register_hook(
-			COMPOSE_CREATED_HOOKLIST, my_compose_create_hook, NULL)) {
-		g_warning("Could not register hook for adding vCards");
-		if (error) {
-			g_set_error(error, client_object_error_quark(), 1,
-				"Could not register hook for adding vCards");
-		}
-	}
+    if ((guint)-1 == hooks_register_hook(COMPOSE_CREATED_HOOKLIST, my_compose_create_hook, NULL)) {
+        g_warning("Could not register hook for adding vCards");
+        if (error) {
+            g_set_error(error, client_object_error_quark(), 1,
+                "Could not register hook for adding vCards");
+        }
+    }
 }
+

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list