comparison 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
comparison
equal deleted inserted replaced
207:41fafa0ecfd8 208:8b08f34922c5
299 void jb_addbuddy(const char *jid, const char *group) 299 void jb_addbuddy(const char *jid, const char *group)
300 { 300 {
301 xmlnode x, y, z; 301 xmlnode x, y, z;
302 char *cleanjid; 302 char *cleanjid;
303 303
304 // XXX Check jid (but perhaps caller should do it) 304 if (!online) return;
305 305
306 // We don't check if the jabber user already exists in the roster, 306 // We don't check if the jabber user already exists in the roster,
307 // because it allows to re-ask for notification. 307 // because it allows to re-ask for notification.
308 308
309 //x = jutil_presnew(JPACKET__SUBSCRIBE, jid, NULL); 309 //x = jutil_presnew(JPACKET__SUBSCRIBE, jid, NULL);
337 { 337 {
338 xmlnode x, y, z; 338 xmlnode x, y, z;
339 char *cleanjid; 339 char *cleanjid;
340 340
341 if (!online) return; 341 if (!online) return;
342
343 // XXX Check jid (but perhaps caller should do it)
344 342
345 cleanjid = jidtodisp(jid); 343 cleanjid = jidtodisp(jid);
346 344
347 // If the current buddy is an agent, unsubscribe from it 345 // If the current buddy is an agent, unsubscribe from it
348 if (roster_gettype(cleanjid) == ROSTER_TYPE_AGENT) { 346 if (roster_gettype(cleanjid) == ROSTER_TYPE_AGENT) {
373 roster_del_user(cleanjid); 371 roster_del_user(cleanjid);
374 g_free(cleanjid); 372 g_free(cleanjid);
375 buddylist_build(); 373 buddylist_build();
376 374
377 update_roster = TRUE; 375 update_roster = TRUE;
376 }
377
378 void jb_updatebuddy(const char *jid, const char *name, const char *group)
379 {
380 xmlnode x, y;
381 char *cleanjid;
382
383 if (!online) return;
384
385 // XXX We should check name's and group's correctness
386
387 cleanjid = jidtodisp(jid);
388
389 x = jutil_iqnew(JPACKET__SET, NS_ROSTER);
390 y = xmlnode_insert_tag(xmlnode_get_tag(x, "query"), "item");
391 xmlnode_put_attrib(y, "jid", cleanjid);
392 xmlnode_put_attrib(y, "name", name);
393
394 if (group) {
395 y = xmlnode_insert_tag(y, "group");
396 xmlnode_insert_cdata(y, group, (unsigned) -1);
397 }
398
399 jab_send(jc, x);
400 xmlnode_free(x);
401 g_free(cleanjid);
378 } 402 }
379 403
380 void postlogin() 404 void postlogin()
381 { 405 {
382 //int i; 406 //int i;