Mercurial > pidgin.yaz
changeset 3314:52db87ab4083
[gaim-migrate @ 3332]
Added "Remove From Roster" (proto-specific edit buddy menu) option.
committer: Tailor Script <tailor@pidgin.im>
author | Jim Seymour <jseymour> |
---|---|
date | Sat, 15 Jun 2002 20:22:28 +0000 |
parents | b0d5ce77f7dd |
children | c685bb6109c7 |
files | src/protocols/jabber/jabber.c |
diffstat | 1 files changed, 38 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/jabber/jabber.c Sat Jun 15 20:21:01 2002 +0000 +++ b/src/protocols/jabber/jabber.c Sat Jun 15 20:22:28 2002 +0000 @@ -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;