Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/jabglue.c @ 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 | 19c615fd071e |
children | 7c74eef1d0e0 |
comparison
equal
deleted
inserted
replaced
833:63707a595c2e | 834:6f913f4fbb2a |
---|---|
434 x = jutil_presnew(JPACKET__SUBSCRIBE, (char *)jid, NULL); | 434 x = jutil_presnew(JPACKET__SUBSCRIBE, (char *)jid, NULL); |
435 jab_send(jc, x); | 435 jab_send(jc, x); |
436 xmlnode_free(x); | 436 xmlnode_free(x); |
437 } | 437 } |
438 | 438 |
439 // jb_subscr_request_cancel(jid) | |
440 // Request to cancel jour subscription to jid's presence updates | |
441 void jb_subscr_request_cancel(const char *jid) | |
442 { | |
443 xmlnode x; | |
444 | |
445 x = jutil_presnew(JPACKET__UNSUBSCRIBE, (char *)jid, NULL); | |
446 jab_send(jc, x); | |
447 xmlnode_free(x); | |
448 } | |
449 | |
439 // Note: the caller should check the jid is correct | 450 // Note: the caller should check the jid is correct |
440 void jb_addbuddy(const char *jid, const char *name, const char *group) | 451 void jb_addbuddy(const char *jid, const char *name, const char *group) |
441 { | 452 { |
442 xmlnode y, z; | 453 xmlnode y, z; |
443 eviqs *iqn; | 454 eviqs *iqn; |
475 update_roster = TRUE; | 486 update_roster = TRUE; |
476 } | 487 } |
477 | 488 |
478 void jb_delbuddy(const char *jid) | 489 void jb_delbuddy(const char *jid) |
479 { | 490 { |
480 xmlnode x, y, z; | 491 xmlnode y, z; |
481 eviqs *iqn; | 492 eviqs *iqn; |
482 char *cleanjid; | 493 char *cleanjid; |
483 | 494 |
484 if (!online) return; | 495 if (!online) return; |
485 | 496 |
496 jab_send(jc, iqn->xmldata); | 507 jab_send(jc, iqn->xmldata); |
497 iqs_del(iqn->id); // XXX | 508 iqs_del(iqn->id); // XXX |
498 } | 509 } |
499 | 510 |
500 // Cancel the subscriptions | 511 // Cancel the subscriptions |
501 x = jutil_presnew(JPACKET__UNSUBSCRIBED, cleanjid, 0); // Cancel "from" | 512 jb_subscr_cancel_auth(cleanjid); // Cancel "from" |
502 jab_send(jc, x); | 513 jb_subscr_request_cancel(cleanjid); // Cancel "to" |
503 xmlnode_free(x); | |
504 x = jutil_presnew(JPACKET__UNSUBSCRIBE, cleanjid, 0); // Cancel "to" | |
505 jab_send(jc, x); | |
506 xmlnode_free(x); | |
507 | 514 |
508 // Ask for removal from roster | 515 // Ask for removal from roster |
509 iqn = iqs_new(JPACKET__SET, NS_ROSTER, NULL, IQS_DEFAULT_TIMEOUT); | 516 iqn = iqs_new(JPACKET__SET, NS_ROSTER, NULL, IQS_DEFAULT_TIMEOUT); |
510 y = xmlnode_get_tag(iqn->xmldata, "query"); | 517 y = xmlnode_get_tag(iqn->xmldata, "query"); |
511 z = xmlnode_insert_tag(y, "item"); | 518 z = xmlnode_insert_tag(y, "item"); |