329 g_free(cleanjid); |
329 g_free(cleanjid); |
330 buddylist_build(); |
330 buddylist_build(); |
331 |
331 |
332 // maybe not needed: if user appears his status will change |
332 // maybe not needed: if user appears his status will change |
333 //update_roster = TRUE; |
333 //update_roster = TRUE; |
|
334 } |
|
335 |
|
336 void jb_delbuddy(const char *jid) |
|
337 { |
|
338 xmlnode x, y, z; |
|
339 char *cleanjid; |
|
340 |
|
341 if (!online) return; |
|
342 |
|
343 // XXX Check jid (but perhaps caller should do it) |
|
344 |
|
345 cleanjid = jidtodisp(jid); |
|
346 |
|
347 // If the current buddy is an agent, unsubscribe from it |
|
348 if (roster_gettype(cleanjid) == ROSTER_TYPE_AGENT) { |
|
349 scr_LogPrint("Unregistering from the %s agent", cleanjid); |
|
350 |
|
351 x = jutil_iqnew(JPACKET__SET, NS_REGISTER); |
|
352 xmlnode_put_attrib(x, "to", cleanjid); |
|
353 y = xmlnode_get_tag(x, "query"); |
|
354 xmlnode_insert_tag(y, "remove"); |
|
355 jab_send(jc, x); |
|
356 xmlnode_free(x); |
|
357 } |
|
358 |
|
359 // Unsubscribe this buddy from our presence notification |
|
360 x = jutil_presnew(JPACKET__UNSUBSCRIBE, cleanjid, 0); |
|
361 jab_send(jc, x); |
|
362 xmlnode_free(x); |
|
363 |
|
364 // Ask for removal from roster |
|
365 x = jutil_iqnew(JPACKET__SET, NS_ROSTER); |
|
366 y = xmlnode_get_tag(x, "query"); |
|
367 z = xmlnode_insert_tag(y, "item"); |
|
368 xmlnode_put_attrib(z, "jid", cleanjid); |
|
369 xmlnode_put_attrib(z, "subscription", "remove"); |
|
370 jab_send(jc, x); |
|
371 xmlnode_free(x); |
|
372 |
|
373 roster_del_user(cleanjid); |
|
374 g_free(cleanjid); |
|
375 buddylist_build(); |
|
376 |
|
377 update_roster = TRUE; |
334 } |
378 } |
335 |
379 |
336 void postlogin() |
380 void postlogin() |
337 { |
381 { |
338 //int i; |
382 //int i; |
735 scr_LogPrint("Away msg: %s", p); |
779 scr_LogPrint("Away msg: %s", p); |
736 */ |
780 */ |
737 break; |
781 break; |
738 |
782 |
739 case JPACKET_S10N: |
783 case JPACKET_S10N: |
740 scr_LogPrint("Received subscription packet"); |
784 scr_LogPrint("Received (un)subscription packet (type=%s)", |
741 if (type) scr_LogPrint("Type=%s", type); |
785 ((type) ? type : "")); |
742 |
786 |
743 if (!strcmp(type, "subscribe")) { |
787 if (!strcmp(type, "subscribe")) { |
744 int isagent; |
788 int isagent; |
745 r = jidtodisp(from); |
789 r = jidtodisp(from); |
746 isagent = (roster_gettype(r) & ROSTER_TYPE_AGENT) != 0; |
790 isagent = (roster_gettype(r) & ROSTER_TYPE_AGENT) != 0; |