# HG changeset patch # User Christopher O'Brien # Date 1132087918 0 # Node ID 40724851e95e6e42926478b5699f1776fa955080 # Parent 36a0c8719af3b41739436020e08813d95e3672c6 [gaim-migrate @ 14405] calm before the storm committer: Tailor Script diff -r 36a0c8719af3 -r 40724851e95e src/protocols/sametime/meanwhile/mw_srvc_place.h --- a/src/protocols/sametime/meanwhile/mw_srvc_place.h Tue Nov 15 08:42:03 2005 +0000 +++ b/src/protocols/sametime/meanwhile/mw_srvc_place.h Tue Nov 15 20:51:58 2005 +0000 @@ -109,6 +109,14 @@ int mwPlace_sendText(struct mwPlace *place, const char *msg); +/** send a legacy invitation for this place to a user. The user will + receive an apparent invitation from a Conference (rather than a + Place) */ +int mwPlace_legacyInvite(struct mwPlace *place, + struct mwIdBlock *idb, + const char *message); + + int mwPlace_setAttribute(struct mwPlace *place, guint32 attrib, struct mwOpaque *data); diff -r 36a0c8719af3 -r 40724851e95e src/protocols/sametime/meanwhile/srvc_place.c --- a/src/protocols/sametime/meanwhile/srvc_place.c Tue Nov 15 08:42:03 2005 +0000 +++ b/src/protocols/sametime/meanwhile/srvc_place.c Tue Nov 15 20:51:58 2005 +0000 @@ -991,6 +991,28 @@ } +int mwPlace_legacyInvite(struct mwPlace *place, + struct mwIdBlock *idb, + const char *message) { + + struct mwOpaque o = {0,0}; + struct mwPutBuffer *b; + int ret; + + b = mwPutBuffer_new(); + mwIdBlock_put(b, idb); + mwString_put(b, idb->user); + mwString_put(b, idb->user); + mwString_put(b, message); + gboolean_put(b, FALSE); + mwPutBuffer_finalize(&o, b); + + ret = mwChannel_send(place->channel, msg_out_OLD_INVITE, &o); + mwOpaque_clear(&o); + return ret; +} + + int mwPlace_setAttribute(struct mwPlace *place, guint32 attrib, struct mwOpaque *data) { diff -r 36a0c8719af3 -r 40724851e95e src/protocols/sametime/sametime.c --- 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); }