Mercurial > hg
diff mcabber/src/jabglue.c @ 208:8b08f34922c5
[/trunk] Changeset 220 by mikael
* jabglue: add jb_updatebuddy()
* commands: add /rename command
* documentation: small changes and updates
author | mikael |
---|---|
date | Sat, 07 May 2005 20:09:15 +0000 |
parents | e01bf6d9b4b8 |
children | 4fcdbfdf7c20 |
line wrap: on
line diff
--- a/mcabber/src/jabglue.c Sat May 07 20:04:29 2005 +0000 +++ b/mcabber/src/jabglue.c Sat May 07 20:09:15 2005 +0000 @@ -301,7 +301,7 @@ xmlnode x, y, z; char *cleanjid; - // XXX Check jid (but perhaps caller should do it) + if (!online) return; // We don't check if the jabber user already exists in the roster, // because it allows to re-ask for notification. @@ -340,8 +340,6 @@ if (!online) return; - // XXX Check jid (but perhaps caller should do it) - cleanjid = jidtodisp(jid); // If the current buddy is an agent, unsubscribe from it @@ -377,6 +375,32 @@ update_roster = TRUE; } +void jb_updatebuddy(const char *jid, const char *name, const char *group) +{ + xmlnode x, y; + char *cleanjid; + + if (!online) return; + + // XXX We should check name's and group's correctness + + cleanjid = jidtodisp(jid); + + x = jutil_iqnew(JPACKET__SET, NS_ROSTER); + y = xmlnode_insert_tag(xmlnode_get_tag(x, "query"), "item"); + xmlnode_put_attrib(y, "jid", cleanjid); + xmlnode_put_attrib(y, "name", name); + + if (group) { + y = xmlnode_insert_tag(y, "group"); + xmlnode_insert_cdata(y, group, (unsigned) -1); + } + + jab_send(jc, x); + xmlnode_free(x); + g_free(cleanjid); +} + void postlogin() { //int i;