aboutsummaryrefslogtreecommitdiff
path: root/src/addrindex.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2010-01-26 09:41:32 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2010-01-26 09:41:32 +0000
commitaf7c0d4c4d5f20cc09dc7f709cd88c43dab567b8 (patch)
treefa65c5b918669eb161f6367f20fbdbeaea755452 /src/addrindex.c
parent80ea2c6808e3820773e774d3bca1233bcc9aa87f (diff)
implemented auto-registration of new recipients.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2442 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/addrindex.c')
-rw-r--r--src/addrindex.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/addrindex.c b/src/addrindex.c
index 62f1061d..6d47e2a8 100644
--- a/src/addrindex.c
+++ b/src/addrindex.c
@@ -1637,7 +1637,7 @@ static gboolean addrindex_create_new_book( AddressIndex *addrIndex, gchar *displ
* addrIndex. Three files will be created, for the following:
* "Common addresses"
* "Personal addresses"
-* "Gathered addresses" - a new address book.
+* "Auto-registered" - a new address book.
*/
gint addrindex_read_data( AddressIndex *addrIndex ) {
g_return_val_if_fail( addrIndex != NULL, -1 );
@@ -1666,7 +1666,7 @@ gint addrindex_read_data( AddressIndex *addrIndex ) {
* addrIndex. Three files will be created, for the following:
* "Common addresses"
* "Personal addresses"
-* "Gathered addresses" - a new address book.
+* "Auto-registered" - a new address book.
*/
gint addrindex_create_new_books( AddressIndex *addrIndex ) {
gboolean flg;
@@ -1676,11 +1676,44 @@ gint addrindex_create_new_books( AddressIndex *addrIndex ) {
flg = addrindex_create_new_book( addrIndex, DISP_NEW_COMMON );
if( flg ) {
flg = addrindex_create_new_book( addrIndex, DISP_NEW_PERSONAL );
+ flg = addrindex_create_new_book( addrIndex, ADDR_DS_AUTOREG );
addrIndex->dirtyFlag = TRUE;
}
return addrIndex->retVal;
}
+gint addrindex_create_extra_books( AddressIndex *addrIndex ) {
+ GList *node_ds;
+ AddressInterface *interface = NULL;
+ AddressDataSource *ds = NULL;
+ const gchar *ds_name;
+
+ g_return_val_if_fail(addrIndex != NULL, -1);
+
+ interface = addrindex_get_interface(addrIndex, ADDR_IF_BOOK);
+ if (!interface)
+ return -1;
+
+ for (node_ds = interface->listSource; node_ds != NULL;
+ node_ds = node_ds->next) {
+ ds = node_ds->data;
+ ds_name = addrindex_ds_get_name(ds);
+ if (!ds_name)
+ continue;
+ if (!strcmp(ds_name, ADDR_DS_AUTOREG)) {
+ debug_print("%s found\n", ADDR_DS_AUTOREG);
+ return 0;
+ }
+ }
+
+ debug_print("%s not found, creating new one\n", ADDR_DS_AUTOREG);
+ if (addrindex_create_new_book(addrIndex, ADDR_DS_AUTOREG)) {
+ addrIndex->dirtyFlag = TRUE;
+ }
+
+ return addrIndex->retVal;
+}
+
/* **********************************************************************
* New interface stuff.
* ***********************************************************************