[Commits] xml-plugin.c 1.5 1.6
miras at claws-mail.org
miras at claws-mail.org
Mon Nov 14 23:06:46 CET 2011
Update of /home/claws-mail/contacts/plugins/xml
In directory claws-mail:/tmp/cvs-serv18563/plugins/xml
Modified Files:
xml-plugin.c
Log Message:
Lots of bug fixes and read-only support for LDAP. No searching implemented though
Index: xml-plugin.c
===================================================================
RCS file: /home/claws-mail/contacts/plugins/xml/xml-plugin.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- xml-plugin.c 4 Oct 2011 20:21:40 -0000 1.5
+++ xml-plugin.c 14 Nov 2011 22:06:43 -0000 1.6
@@ -59,6 +59,7 @@
gint equal;
} Compare;
+static Plugin* self = NULL;
static PluginFeature* feature = NULL;
static const gchar subtype[] = "Claws-mail native addressbook";
static GHashTable* attribs = NULL;
@@ -446,7 +447,7 @@
}
cur = NULL;
- cur_attribs = plugin_attrib_list();
+ cur_attribs = self->attrib_list();
for (tmp = cur_attribs; tmp; tmp = g_slist_next(tmp)) {
AttribDef* attrdef = (AttribDef *) tmp->data;
cur = g_slist_prepend(cur, g_strdup(attrdef->attrib_name));
@@ -456,7 +457,7 @@
gslist_free(&cur, g_free);
cur = NULL;
- cur_attribs = plugin_inactive_attribs();
+ cur_attribs = self->inactive_attribs();
for (tmp = cur_attribs; tmp; tmp = g_slist_next(tmp)) {
AttribDef* attrdef = (AttribDef *) tmp->data;
cur = g_slist_prepend(cur, g_strdup(attrdef->attrib_name));
@@ -804,12 +805,13 @@
closed_books = g_list_remove_link(closed_books, found);
}
-gboolean plugin_init(gchar** error) {
+gboolean plugin_init(gpointer self_ref, gchar** error) {
gchar *basedir, *path;
GSList *list = NULL, *cur, *found;
ConfiguredBooks* cf_books;
ClosedBooks* cl_books;
+ self = (Plugin *) self_ref;
if (*error != NULL) {
g_free(*error);
*error = NULL;
@@ -824,7 +826,7 @@
if (*error || ! attribs) {
return TRUE;
}
- plugin_abook_open(NULL, error);
+ self->abook_open(NULL, error);
}
else {
basedir = get_self_home();
@@ -854,7 +856,9 @@
if (! cl_books || ! found) {
AddressBook* abook = address_book_new();
abook->URL = g_strconcat(path, book, ".xml", NULL);
- plugin_abook_open(abook, error);
+ gboolean ok = self->abook_open(abook, error);
+ if (! ok)
+ closed_books = g_list_prepend(closed_books, abook);
}
}
}
@@ -929,6 +933,8 @@
old_abook_free_dir();
gslist_free(&inactive_attribs, attrib_def_free);
+ self = NULL;
+
return TRUE;
}
@@ -964,7 +970,11 @@
return VERSION;
}
-const gchar* plugin_type(void) {
+PluginType plugin_type(void) {
+ return PLUGIN_TYPE_SIMPLE;
+}
+
+const gchar* plugin_file_filter(void) {
return "xml";
}
@@ -1148,6 +1158,7 @@
show_message(NULL, GTK_UTIL_MESSAGE_WARNING, "%s", *error);
g_free(*error);
*error = NULL;
+ closed_books = g_list_prepend(closed_books, abook);
return FALSE;
}
abook_set_next_uid(abook);
@@ -1155,6 +1166,7 @@
}
abooks = g_list_prepend(abooks, abook);
}
+ abook->open = TRUE;
return TRUE;
}
@@ -1162,14 +1174,18 @@
gboolean plugin_abook_delete(AddressBook* abook, gchar** error) {
if (! abook)
return FALSE;
-
- plugin_abook_close(abook, error);
+
+ if (abook->open)
+ self->abook_close(abook, error);
+ /* Remove from closed books since deleting */
+ closed_books = g_list_remove(closed_books, abook);
if (abook->URL) {
if (g_unlink(abook->URL) < 0) {
*error = g_new0(gchar, 1024);
strerror_r(errno, *error, 1024);
}
}
+
return TRUE;
}
@@ -1179,6 +1195,8 @@
address_book_contacts_free(abook);
debug_print("List contains %d elements after\n", g_list_length(abooks));
closed_books = g_list_prepend(closed_books, abook);
+ abook->open = FALSE;
+
return TRUE;
}
@@ -1244,4 +1262,12 @@
}
return list;
-}
\ No newline at end of file
+}
+
+gboolean plugin_need_credentials(void) {
+ return FALSE;
+}
+
+GSList* plugin_extra_config(void) {
+ return NULL;
+}
More information about the Commits
mailing list