diff src/protocols/sametime/sametime.c @ 12107:40724851e95e

[gaim-migrate @ 14405] calm before the storm committer: Tailor Script <tailor@pidgin.im>
author Christopher O'Brien <siege@pidgin.im>
date Tue, 15 Nov 2005 20:51:58 +0000
parents d4cd7d443795
children 35c4797c5c57
line wrap: on
line diff
--- a/src/protocols/sametime/sametime.c	Tue Nov 15 08:42:03 2005 +0000
+++ b/src/protocols/sametime/sametime.c	Tue Nov 15 20:51:58 2005 +0000
@@ -1285,24 +1285,36 @@
     handler */
 static void blist_node_menu_cb(GaimBlistNode *node,
 			       GList **menu, struct mwGaimPluginData *pd) {
+  const char *owner;
+  GaimGroup *group;
+  GaimAccount *acct;
   GaimBlistNodeAction *act;
 
-  if(GAIM_BLIST_NODE_IS_GROUP(node)) { 
-    const char *owner;
-    GaimAccount *acct;
-    
-    owner = gaim_blist_node_get_string(node, GROUP_KEY_OWNER);
-    if(! owner) return;
-
-    acct = gaim_accounts_find(owner, PLUGIN_ID);
-    if(! acct) return;
-    if(! gaim_account_is_connected(acct)) return;
-    if(acct != gaim_connection_get_account(pd->gc)) return;
-
+  /* we only want groups */
+  if(! GAIM_BLIST_NODE_IS_GROUP(node)) return;
+  group = (GaimGroup *) node;
+
+  acct = gaim_connection_get_account(pd->gc);
+  g_return_if_fail(acct != NULL);
+
+  /* better make sure we're connected */
+  if(! gaim_account_is_connected(acct)) return;
+
+#if 0
+  /* if there's anyone in the group for this acct, offer to invite
+     them all to a conference */
+  if(gaim_group_on_account(group, acct)) {
+    act = gaim_blist_node_action_new(_("Invite Group to Conference..."),
+				     blist_menu_group_invite, pd, NULL);
+    *menu = g_list_append(*menu, NULL);
+  }
+#endif
+
+  /* check if it's a NAB group for this account */
+  owner = gaim_blist_node_get_string(node, GROUP_KEY_OWNER);
+  if(owner && !strcmp(owner, gaim_account_get_username(acct))) {
     act = gaim_blist_node_action_new(_("Get Notes Address Book Info"),
 				     blist_menu_nab, pd, NULL);
-
-    *menu = g_list_append(*menu, NULL);
     *menu = g_list_append(*menu, act);
   }
 }
@@ -4731,18 +4743,24 @@
 
   struct mwGaimPluginData *pd;
   struct mwConference *conf;
+  struct mwPlace *place;
   struct mwIdBlock idb = { (char *) who, NULL };
 
   pd = gc->proto_data;
-
   g_return_if_fail(pd != NULL);
+
   conf = ID_TO_CONF(pd, id);
 
-  g_return_if_fail(conf != NULL);
-  
-  mwConference_invite(conf, &idb, invitation);
-
-  /* @todo: use Place by default instead */
+  if(conf) {
+    mwConference_invite(conf, &idb, invitation);
+    return;
+  }
+
+  place = ID_TO_PLACE(pd, id);
+  g_return_if_fail(place != NULL);
+
+  /* @todo: use the IM service for invitation */
+  mwPlace_legacyInvite(place, &idb, invitation);
 }