Mercurial > hg
comparison mcabber/src/jabglue.c @ 81:0bd578421ce9
[/trunk] Changeset 95 by mikael
* Switch from buddies.* to roster.*
Seems to work fine...
author | mikael |
---|---|
date | Sat, 16 Apr 2005 22:28:55 +0000 |
parents | 7d1c22aa2e5f |
children | 60eac956ce18 |
comparison
equal
deleted
inserted
replaced
80:7fb661f19a77 | 81:0bd578421ce9 |
---|---|
21 * USA | 21 * USA |
22 */ | 22 */ |
23 | 23 |
24 #include "../libjabber/jabber.h" | 24 #include "../libjabber/jabber.h" |
25 #include "jabglue.h" | 25 #include "jabglue.h" |
26 #include "roster.h" | |
26 #include "screen.h" | 27 #include "screen.h" |
27 #include "utils.h" | 28 #include "utils.h" |
28 #include "buddies.h" | |
29 | 29 |
30 #define JABBERPORT 5222 | 30 #define JABBERPORT 5222 |
31 #define JABBERSSLPORT 5223 | 31 #define JABBERSSLPORT 5223 |
32 | 32 |
33 jconn jc; | 33 jconn jc; |
249 //ourstatus = available; | 249 //ourstatus = available; |
250 | 250 |
251 //setautostatus(jhook.manualstatus); | 251 //setautostatus(jhook.manualstatus); |
252 | 252 |
253 setjabberstatus(1, "I'm here!"); | 253 setjabberstatus(1, "I'm here!"); |
254 buddylist_build(); | |
254 /* | 255 /* |
255 for (i = 0; i < clist.count; i++) { | 256 for (i = 0; i < clist.count; i++) { |
256 c = (icqcontact *) clist.at(i); | 257 c = (icqcontact *) clist.at(i); |
257 | 258 |
258 if (c->getdesc().pname == proto) | 259 if (c->getdesc().pname == proto) |
313 | 314 |
314 for (y = xmlnode_get_tag(x, "item"); y; y = xmlnode_get_nextsibling(y)) { | 315 for (y = xmlnode_get_tag(x, "item"); y; y = xmlnode_get_nextsibling(y)) { |
315 const char *alias = xmlnode_get_attrib(y, "jid"); | 316 const char *alias = xmlnode_get_attrib(y, "jid"); |
316 //const char *sub = xmlnode_get_attrib(y, "subscription"); // TODO Not used | 317 //const char *sub = xmlnode_get_attrib(y, "subscription"); // TODO Not used |
317 const char *name = xmlnode_get_attrib(y, "name"); | 318 const char *name = xmlnode_get_attrib(y, "name"); |
318 const char *group = 0; | 319 const char *group = NULL; |
319 | 320 |
320 z = xmlnode_get_tag(y, "group"); | 321 z = xmlnode_get_tag(y, "group"); |
321 if (z) group = xmlnode_get_data(z); | 322 if (z) group = xmlnode_get_data(z); |
322 | 323 |
323 if (alias) { | 324 if (alias) { |
325 if (name) | 326 if (name) |
326 buddyname = (char*)name; | 327 buddyname = (char*)name; |
327 else | 328 else |
328 buddyname = jidtodisp(alias); | 329 buddyname = jidtodisp(alias); |
329 | 330 |
330 bud_AddBuddy(alias, buddyname); | 331 roster_add_user(alias, buddyname, group, ROSTER_TYPE_USER); |
331 if (!name) | 332 if (!name) |
332 free(buddyname); | 333 free(buddyname); |
333 } | 334 } |
334 } | 335 } |
335 | 336 |
336 bud_SortRoster(); | |
337 postlogin(); | 337 postlogin(); |
338 } | 338 } |
339 | 339 |
340 void gotmessage(char *type, const char *from, const char *body, | 340 void gotmessage(char *type, const char *from, const char *body, |
341 const char *enc) | 341 const char *enc) |
625 } | 625 } |
626 | 626 |
627 if (type && !strcmp(type, "unavailable")) { | 627 if (type && !strcmp(type, "unavailable")) { |
628 ust = offline; | 628 ust = offline; |
629 } | 629 } |
630 //scr_LogPrint("New status: ust=%d (%s)", ust, from); | 630 // scr_LogPrint("New status: ust=%d (%s)", ust, from); |
631 | 631 |
632 bud_SetBuddyStatus(jidtodisp(from), ust); | 632 roster_setstatus(jidtodisp(from), ust); // XXX memory leak |
633 buddylist_build(); | |
634 scr_DrawRoster(); | |
633 /* | 635 /* |
634 if (x = xmlnode_get_tag(packet->x, "status")) | 636 if (x = xmlnode_get_tag(packet->x, "status")) |
635 if (p = xmlnode_get_data(x)) | 637 if (p = xmlnode_get_data(x)) |
636 scr_LogPrint("Away msg: %s", p); | 638 scr_LogPrint("Away msg: %s", p); |
637 */ | 639 */ |