# HG changeset patch # User Mark Doliner # Date 1111282973 0 # Node ID a4ae4fb7f939ef3b6e30a35dc64714c9c2c5a9b8 # Parent a7486f12e56f56aa373deafca0149cd98c781804 [gaim-migrate @ 12288] Make the blist.xml saving schedule function public and call it whenever privacy settings are changed. committer: Tailor Script diff -r a7486f12e56f -r a4ae4fb7f939 src/blist.c --- a/src/blist.c Sun Mar 20 01:23:06 2005 +0000 +++ b/src/blist.c Sun Mar 20 01:42:53 2005 +0000 @@ -355,8 +355,8 @@ return FALSE; } -static void -schedule_blist_save() +void +gaim_blist_schedule_save() { if (save_timer == 0) save_timer = gaim_timeout_add(5000, save_cb, NULL); @@ -835,7 +835,7 @@ g_free(buddy->name); buddy->name = g_strdup(name); - schedule_blist_save(); + gaim_blist_schedule_save(); if (ops && ops->update) ops->update(gaimbuddylist, (GaimBlistNode *)buddy); @@ -853,7 +853,7 @@ else chat->alias = NULL; - schedule_blist_save(); + gaim_blist_schedule_save(); if (ops && ops->update) ops->update(gaimbuddylist, (GaimBlistNode *)chat); @@ -872,7 +872,7 @@ else buddy->alias = NULL; - schedule_blist_save(); + gaim_blist_schedule_save(); if (ops && ops->update) ops->update(gaimbuddylist, (GaimBlistNode *)buddy); @@ -896,7 +896,7 @@ else buddy->server_alias = NULL; - schedule_blist_save(); + gaim_blist_schedule_save(); if (ops && ops->update) ops->update(gaimbuddylist, (GaimBlistNode *)buddy); @@ -980,7 +980,7 @@ } /* Save our changes */ - schedule_blist_save(); + gaim_blist_schedule_save(); /* Update the UI */ if (ops && ops->update) @@ -1090,7 +1090,7 @@ else gaim_blist_node_remove_setting((GaimBlistNode *)buddy, "buddy_icon"); - schedule_blist_save(); + gaim_blist_schedule_save(); gaim_blist_update_buddy_icon(buddy); } @@ -1159,7 +1159,7 @@ ops->remove(gaimbuddylist, cnode); - schedule_blist_save(); + gaim_blist_schedule_save(); } if (node != NULL) { @@ -1188,7 +1188,7 @@ } } - schedule_blist_save(); + gaim_blist_schedule_save(); if (ops && ops->update) ops->update(gaimbuddylist, (GaimBlistNode *)cnode); @@ -1260,7 +1260,7 @@ ops->remove(gaimbuddylist, bnode); - schedule_blist_save(); + gaim_blist_schedule_save(); if (bnode->parent->parent != (GaimBlistNode*)g) { hb = g_new(struct _gaim_hbuddy, 1); @@ -1317,7 +1317,7 @@ gaim_contact_invalidate_priority_buddy(gaim_buddy_get_contact(buddy)); - schedule_blist_save(); + gaim_blist_schedule_save(); if (ops && ops->update) ops->update(gaimbuddylist, (GaimBlistNode*)buddy); @@ -1354,7 +1354,7 @@ else contact->alias = NULL; - schedule_blist_save(); + gaim_blist_schedule_save(); if (ops && ops->update) ops->update(gaimbuddylist, (GaimBlistNode*)contact); @@ -1504,7 +1504,7 @@ ops->remove(gaimbuddylist, cnode); - schedule_blist_save(); + gaim_blist_schedule_save(); } if (node && (GAIM_BLIST_NODE_IS_CONTACT(node) || @@ -1530,7 +1530,7 @@ g->currentsize++; g->totalsize++; - schedule_blist_save(); + gaim_blist_schedule_save(); if (ops && cnode->child) ops->update(gaimbuddylist, cnode); @@ -1621,7 +1621,7 @@ gaimbuddylist->root = gnode; } - schedule_blist_save(); + gaim_blist_schedule_save(); if (ops && ops->update) { ops->update(gaimbuddylist, gnode); @@ -1664,7 +1664,7 @@ if (node->next) node->next->prev = node->prev; - schedule_blist_save(); + gaim_blist_schedule_save(); /* Update the UI */ if (ops && ops->remove) @@ -1713,7 +1713,7 @@ } contact->totalsize--; - schedule_blist_save(); + gaim_blist_schedule_save(); /* Re-sort the contact */ if (contact->priority == buddy) { @@ -1778,7 +1778,7 @@ } group->totalsize--; - schedule_blist_save(); + gaim_blist_schedule_save(); /* Update the UI */ if (ops && ops->remove) @@ -1832,7 +1832,7 @@ if (node->next) node->next->prev = node->prev; - schedule_blist_save(); + gaim_blist_schedule_save(); /* Update the UI */ if (ops && ops->remove) @@ -2333,7 +2333,7 @@ g_hash_table_remove(node->settings, key); - schedule_blist_save(); + gaim_blist_schedule_save(); } void @@ -2366,7 +2366,7 @@ g_hash_table_replace(node->settings, g_strdup(key), value); - schedule_blist_save(); + gaim_blist_schedule_save(); } gboolean @@ -2402,7 +2402,7 @@ g_hash_table_replace(node->settings, g_strdup(key), value); - schedule_blist_save(); + gaim_blist_schedule_save(); } int @@ -2438,7 +2438,7 @@ g_hash_table_replace(node->settings, g_strdup(key), value); - schedule_blist_save(); + gaim_blist_schedule_save(); } const char * diff -r a7486f12e56f -r a4ae4fb7f939 src/blist.h --- a/src/blist.h Sun Mar 20 01:23:06 2005 +0000 +++ b/src/blist.h Sun Mar 20 01:42:53 2005 +0000 @@ -719,24 +719,18 @@ /****************************************************************************************/ /** - * Parses the toc-style buddy list used in older versions of Gaim and for SSI in toc.c - * - * @param account This is the account that the buddies and groups from config will get added to - * @param config This is the toc-style buddy list data - */ -void gaim_blist_parse_toc_buddy_list(GaimAccount *account, char *config); - - -/** * Loads the buddy list from ~/.gaim/blist.xml. */ void gaim_blist_load(); /** - * Force an immediate write of the buddy list. Normally the buddy list is - * saved automatically a few seconds after a change is made. + * Schedule a save of the blist.xml file. This is used by the privacy + * API whenever the privacy settings are changed. If you make a change + * to blist.xml using one of the functions in the buddy list API, then + * the buddy list is saved automatically, so you should not need to + * call this. */ -void gaim_blist_sync(); +void gaim_blist_schedule_save(); /** * Requests from the user information needed to add a buddy to the diff -r a7486f12e56f -r a4ae4fb7f939 src/gtkprivacy.c --- a/src/gtkprivacy.c Sun Mar 20 01:23:06 2005 +0000 +++ b/src/gtkprivacy.c Sun Mar 20 01:42:53 2005 +0000 @@ -239,6 +239,10 @@ rebuild_block_list(dialog); } +/* + * TODO: Setting the permit/deny setting needs to go through privacy.c + * Even better: the privacy API needs to not suck. + */ static void type_changed_cb(GtkOptionMenu *optmenu, GaimGtkPrivacyDialog *dialog) { @@ -262,7 +266,7 @@ dialog->in_allow_list = FALSE; } - gaim_blist_sync(); + gaim_blist_schedule_save(); } static void diff -r a7486f12e56f -r a4ae4fb7f939 src/privacy.c --- a/src/privacy.c Sun Mar 20 01:23:06 2005 +0000 +++ b/src/privacy.c Sun Mar 20 01:42:53 2005 +0000 @@ -58,6 +58,8 @@ if (privacy_ops != NULL && privacy_ops->permit_added != NULL) privacy_ops->permit_added(account, who); + gaim_blist_schedule_save(); + return TRUE; } @@ -92,6 +94,8 @@ if (privacy_ops != NULL && privacy_ops->permit_removed != NULL) privacy_ops->permit_removed(account, who); + gaim_blist_schedule_save(); + return TRUE; } @@ -125,6 +129,8 @@ if (privacy_ops != NULL && privacy_ops->deny_added != NULL) privacy_ops->deny_added(account, who); + gaim_blist_schedule_save(); + return TRUE; } @@ -159,6 +165,8 @@ if (privacy_ops != NULL && privacy_ops->deny_removed != NULL) privacy_ops->deny_removed(account, who); + gaim_blist_schedule_save(); + return TRUE; }