soc.2012.statscollector: 393832b1: Add loaded-accounts on startup with purp...

sanket at soc.pidgin.im sanket at soc.pidgin.im
Fri Jun 1 05:43:16 EDT 2012


----------------------------------------------------------------------
Revision: 393832b1daa7dc5eadd0c1212da24f6ef7c6b758
Parent:   347b6e5e35974d211b9a7f3e09ef5c3e0bf66a70
Author:   sanket at soc.pidgin.im
Date:     05/31/12 12:14:41
Branch:   im.pidgin.soc.2012.statscollector
URL: http://d.pidgin.im/viewmtn/revision/info/393832b1daa7dc5eadd0c1212da24f6ef7c6b758

Changelog: 

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.

Changes against parent 347b6e5e35974d211b9a7f3e09ef5c3e0bf66a70

  patched  libpurple/plugins/statscollector.c

-------------- next part --------------
============================================================
--- libpurple/plugins/statscollector.c	eada7d865da270380cd002f9c2a6211bda98f2a6
+++ libpurple/plugins/statscollector.c	bfb369807a86418dfec21a4995ff4ec2f188270c
@@ -794,7 +794,7 @@ init_stats(){
    */
 
   /* GHashTableIter *iter; */
-  GList *loaded_plugins;
+  GList *loaded_plugins, *loaded_accounts;
   const gchar *filename;
   gchar *file_contents;
   const char *id_node;
@@ -889,6 +889,16 @@ init_stats(){
 
   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