From: Jim S. <jse...@us...> - 2002-06-15 20:22:31
|
Update of /cvsroot/gaim/gaim/src/protocols/jabber In directory usw-pr-cvs1:/tmp/cvs-serv3323/src/protocols/jabber Modified Files: jabber.c Log Message: Added "Remove From Roster" (proto-specific edit buddy menu) option. Index: jabber.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/jabber/jabber.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- jabber.c 15 Jun 2002 17:24:07 -0000 1.54 +++ jabber.c 15 Jun 2002 20:22:28 -0000 1.55 @@ -2373,6 +2373,27 @@ xmlnode_free(x); } +/* + * Remove a buddy item from the roster entirely + */ +static void jabber_remove_buddy_roster_item(struct gaim_connection *gc, char *name) +{ + xmlnode x, y; + char *realwho; + gjconn gjc = ((struct jabber_data *)gc->proto_data)->gjc; + + if(!name || (realwho = get_realwho(gjc, name, FALSE, NULL)) == NULL) + return; + + x = jutil_iqnew(JPACKET__SET, NS_ROSTER); + y = xmlnode_insert_tag(xmlnode_get_tag(x, "query"), "item"); + xmlnode_put_attrib(y, "jid", realwho); + xmlnode_put_attrib(y, "subscription", "remove"); + gjab_send(((struct jabber_data *)gc->proto_data)->gjc, x); + g_free(realwho); + xmlnode_free(x); +} + static char **jabber_list_icon(int uc) { switch (uc) { @@ -2843,6 +2864,22 @@ return m; } +/* + * Jabber protocol-specific "edit buddy menu" item(s) + */ +static GList *jabber_edit_buddy_menu(struct gaim_connection *gc, char *who) { + GList *m = NULL; + struct proto_buddy_menu *pbm; + + pbm = g_new0(struct proto_buddy_menu, 1); + pbm->label = _("Remove From Roster"); + pbm->callback = jabber_remove_buddy_roster_item; + pbm->gc = gc; + m = g_list_append(m, pbm); + + return m; +} + static GList *jabber_away_states(struct gaim_connection *gc) { GList *m = NULL; @@ -3732,6 +3769,7 @@ ret->actions = jabber_actions; ret->do_action = jabber_do_action; ret->buddy_menu = jabber_buddy_menu; + ret->edit_buddy_menu = jabber_edit_buddy_menu; ret->user_opts = jabber_user_opts; ret->login = jabber_login; ret->close = jabber_close; |