/soc/2012/sanket/statscollector-2.x.y: ff71d67069ed: Add loaded-...

Sanket Agarwal sanket at soc.pidgin.im
Tue Jul 10 00:36:26 EDT 2012


Changeset: ff71d67069edf2e0c91434089fa409ecfcff4750
Author:	 Sanket Agarwal <sanket at soc.pidgin.im>
Date:	 2012-05-31 16:14 +0000
Branch:	 soc.2012.statscollector
URL: http://hg.pidgin.im/soc/2012/sanket/statscollector-2.x.y/rev/ff71d67069ed

Description:

Add loaded-accounts on startup with purple_accounts_get_all_active

It might be possible that we miss some of the accounts with account-sign-on
event if there are possible race-condition within plugin-subsystem and
accounts being loaded. For this reason, we now check explicitly on start
that all loaded accounts are already accounted for.

diffstat:

 libpurple/plugins/statscollector.c |  12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diffs (29 lines):

diff --git a/libpurple/plugins/statscollector.c b/libpurple/plugins/statscollector.c
--- a/libpurple/plugins/statscollector.c
+++ b/libpurple/plugins/statscollector.c
@@ -794,7 +794,7 @@
    */
 
   /* GHashTableIter *iter; */
-  GList *loaded_plugins;
+  GList *loaded_plugins, *loaded_accounts;
   const gchar *filename;
   gchar *file_contents;
   const char *id_node;
@@ -889,6 +889,16 @@
 
   get_ui_info();
 
+  /* It is possible that the loading of our plugin might miss some accounts
+   * because of race-condition where the account-sign-on is fired *before*
+   * the plugin loads and registers it signals, hence handle loaded accounts
+   * here
+   */
+
+  loaded_accounts = purple_accounts_get_all_active();
+
+  g_list_foreach(loaded_accounts, (GFunc)acc_sign_on_event, NULL);
+
   /* Return the structure for modification */
   return root;
 }



More information about the Commits mailing list