comparison mcabber/src/jabglue.c @ 124:6d2122c003c4

[/trunk] Changeset 137 by mikael * Implement /add command, partially.
author mikael
date Tue, 26 Apr 2005 20:05:14 +0000
parents cfd3df636d5f
children 1bf1a1233b88
comparison
equal deleted inserted replaced
123:1bdf882bed98 124:6d2122c003c4
279 { 279 {
280 xmlnode x = jutil_msgnew(TMSG_CHAT, (char*)jid, 0, (char*)text); 280 xmlnode x = jutil_msgnew(TMSG_CHAT, (char*)jid, 0, (char*)text);
281 jab_send(jc, x); 281 jab_send(jc, x);
282 xmlnode_free(x); 282 xmlnode_free(x);
283 jb_reset_keepalive(); 283 jb_reset_keepalive();
284 }
285
286 void jb_addbuddy(const char *jid, const char *group)
287 {
288 xmlnode x, y, z;
289
290 // XXX Check jid (but perhaps caller should do it)
291
292 // We don't check if the jabber user already exists in the roster,
293 // because it allows to re-ask for notification.
294
295 //x = jutil_presnew(JPACKET__SUBSCRIBE, jid, NULL);
296 x = jutil_presnew(JPACKET__SUBSCRIBE, jid, "online");
297 jab_send(jc, x);
298 xmlnode_free(x);
299
300 x = jutil_iqnew(JPACKET__SET, NS_ROSTER);
301 y = xmlnode_get_tag(x, "query");
302 z = xmlnode_insert_tag(y, "item");
303 xmlnode_put_attrib(z, "jid", jid);
304
305 if (group) {
306 z = xmlnode_insert_tag(z, "group");
307 xmlnode_insert_cdata(z, group, (unsigned) -1);
308 }
309
310 jab_send(jc, x);
311 xmlnode_free(x);
312
313 roster_add_user(jid, NULL, group, ROSTER_TYPE_USER);
314 buddylist_build();
315
316 // maybe not needed: if user appears his status will change
317 //update_roster = TRUE;
284 } 318 }
285 319
286 void postlogin() 320 void postlogin()
287 { 321 {
288 //int i; 322 //int i;