changeset 12266:0e467757b57a

[gaim-migrate @ 14568] setting up buddy subscriptions and user status at login committer: Tailor Script <tailor@pidgin.im>
author Christopher O'Brien <siege@pidgin.im>
date Wed, 30 Nov 2005 01:04:45 +0000
parents f82b6d559ea7
children df93ed932b3a
files src/protocols/sametime/sametime.c
diffstat 1 files changed, 43 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/sametime/sametime.c	Tue Nov 29 23:59:36 2005 +0000
+++ b/src/protocols/sametime/sametime.c	Wed Nov 30 01:04:45 2005 +0000
@@ -1325,6 +1325,38 @@
 }
 
 
+/* lifted this from oldstatus, since HEAD doesn't do this at login
+   anymore. */
+static void blist_init(GaimAccount *acct) {
+  GaimBlistNode *gnode, *cnode, *bnode;
+  GList *add_buds = NULL;
+
+  for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) {
+    if(! GAIM_BLIST_NODE_IS_GROUP(gnode)) continue;
+
+    for(cnode = gnode->child; cnode; cnode = cnode->next) {
+      if(! GAIM_BLIST_NODE_IS_CONTACT(cnode))
+	continue;
+      for(bnode = cnode->child; bnode; bnode = bnode->next) {
+	GaimBuddy *b;
+	if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
+	  continue;
+	
+	b = (GaimBuddy *)bnode;
+	if(b->account == acct) {
+	  add_buds = g_list_append(add_buds, b);
+	}
+      }
+    }
+  }
+  
+  if(add_buds) {
+    gaim_account_add_buddies(acct, add_buds);
+    g_list_free(add_buds);
+  }
+}
+
+
 /** Last thing to happen from a started session */
 static void services_starting(struct mwGaimPluginData *pd) {
 
@@ -1392,6 +1424,8 @@
   /* ... but we can do file transfers! */
   mwServiceAware_setAttributeBoolean(pd->srvc_aware,
 				     mwAttribute_FILE_TRANSFER, TRUE);
+
+  blist_init(acct);
 }
 
 
@@ -1415,12 +1449,19 @@
 }
 
 
+static void mw_prpl_set_status(GaimAccount *acct, GaimStatus *status);
+
+
 /** called from mw_session_stateChange when the session's state is
     mwSession_STARTED. Any finalizing of start-up stuff should go
     here */
 static void session_started(struct mwGaimPluginData *pd) {
-
-  /* XXX setup status */
+  GaimStatus *status;
+  GaimAccount *acct;
+
+  acct = gaim_connection_get_account(pd->gc);
+  status = gaim_account_get_active_status(acct);
+  mw_prpl_set_status(acct, status);
 
   /* use our services to do neat things */
   services_starting(pd);