Mercurial > hg
changeset 834:6f913f4fbb2a
Use jb_subscr_ in jb_delbuddy()
(Avoid code duplication)
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 04 May 2006 17:03:19 +0200 |
parents | 63707a595c2e |
children | 6a732d2ad4b4 |
files | mcabber/src/jabglue.c mcabber/src/jabglue.h |
diffstat | 2 files changed, 15 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mcabber/src/jabglue.c Thu May 04 16:02:22 2006 +0200 +++ b/mcabber/src/jabglue.c Thu May 04 17:03:19 2006 +0200 @@ -436,6 +436,17 @@ xmlnode_free(x); } +// jb_subscr_request_cancel(jid) +// Request to cancel jour subscription to jid's presence updates +void jb_subscr_request_cancel(const char *jid) +{ + xmlnode x; + + x = jutil_presnew(JPACKET__UNSUBSCRIBE, (char *)jid, NULL); + jab_send(jc, x); + xmlnode_free(x); +} + // Note: the caller should check the jid is correct void jb_addbuddy(const char *jid, const char *name, const char *group) { @@ -477,7 +488,7 @@ void jb_delbuddy(const char *jid) { - xmlnode x, y, z; + xmlnode y, z; eviqs *iqn; char *cleanjid; @@ -498,12 +509,8 @@ } // Cancel the subscriptions - x = jutil_presnew(JPACKET__UNSUBSCRIBED, cleanjid, 0); // Cancel "from" - jab_send(jc, x); - xmlnode_free(x); - x = jutil_presnew(JPACKET__UNSUBSCRIBE, cleanjid, 0); // Cancel "to" - jab_send(jc, x); - xmlnode_free(x); + jb_subscr_cancel_auth(cleanjid); // Cancel "from" + jb_subscr_request_cancel(cleanjid); // Cancel "to" // Ask for removal from roster iqn = iqs_new(JPACKET__SET, NS_ROSTER, NULL, IQS_DEFAULT_TIMEOUT);
--- a/mcabber/src/jabglue.h Thu May 04 16:02:22 2006 +0200 +++ b/mcabber/src/jabglue.h Thu May 04 17:03:19 2006 +0200 @@ -42,6 +42,7 @@ void jb_subscr_send_auth(const char *jid); void jb_subscr_cancel_auth(const char *jid); void jb_subscr_request_auth(const char *jid); +void jb_subscr_request_cancel(const char *jid); void jb_addbuddy(const char *jid, const char *name, const char *group); void jb_delbuddy(const char *jid); void jb_updatebuddy(const char *jid, const char *name, const char *group);