Mercurial > pidgin.yaz
comparison plugins/jabber/jabber.c @ 1354:6b0a7cea1dd1
[gaim-migrate @ 1364]
yay. state.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 22 Dec 2000 03:14:27 +0000 |
parents | f6a8bca11766 |
children | f0c2d6b88b14 |
comparison
equal
deleted
inserted
replaced
1353:f6a8bca11766 | 1354:6b0a7cea1dd1 |
---|---|
48 #include "prpl.h" | 48 #include "prpl.h" |
49 #include "gaim.h" | 49 #include "gaim.h" |
50 #include "jabber.h" | 50 #include "jabber.h" |
51 | 51 |
52 #include "pixmaps/available.xpm" | 52 #include "pixmaps/available.xpm" |
53 #include "pixmaps/available-away.xpm" | |
54 #include "pixmaps/available-chat.xpm" | |
55 #include "pixmaps/available-xa.xpm" | |
56 #include "pixmaps/available-dnd.xpm" | |
53 | 57 |
54 /* The priv member of gjconn's is a gaim_connection for now. */ | 58 /* The priv member of gjconn's is a gaim_connection for now. */ |
55 #define GJ_GC(x) ((struct gaim_connection *)(x)->priv) | 59 #define GJ_GC(x) ((struct gaim_connection *)(x)->priv) |
56 | 60 |
57 #define IQ_NONE -1 | 61 #define IQ_NONE -1 |
58 #define IQ_AUTH 0 | 62 #define IQ_AUTH 0 |
59 #define IQ_ROSTER 1 | 63 #define IQ_ROSTER 1 |
64 | |
65 #define UC_AWAY 0x38 | |
66 #define UC_CHAT 0x48 | |
67 #define UC_XA 0x98 | |
68 #define UC_DND 0x118 | |
60 | 69 |
61 typedef struct gjconn_struct { | 70 typedef struct gjconn_struct { |
62 /* Core structure */ | 71 /* Core structure */ |
63 pool p; /* Memory allocation pool */ | 72 pool p; /* Memory allocation pool */ |
64 int state; /* Connection state flag */ | 73 int state; /* Connection state flag */ |
438 { | 447 { |
439 char *to, *from, *type; | 448 char *to, *from, *type; |
440 struct buddy *b; | 449 struct buddy *b; |
441 jid who; | 450 jid who; |
442 char *buddy; | 451 char *buddy; |
452 xmlnode y; | |
453 char *show; | |
454 int state; | |
443 | 455 |
444 to = xmlnode_get_attrib(p->x, "to"); | 456 to = xmlnode_get_attrib(p->x, "to"); |
445 from = xmlnode_get_attrib(p->x, "from"); | 457 from = xmlnode_get_attrib(p->x, "from"); |
446 type = xmlnode_get_attrib(p->x, "type"); | 458 type = xmlnode_get_attrib(p->x, "type"); |
447 | 459 |
460 if ((y = xmlnode_get_tag(p->x, "show"))) { | |
461 show = xmlnode_get_data(y); | |
462 if (!strcmp(show, "away")) { | |
463 state = UC_AWAY; | |
464 } else if (!strcmp(show, "chat")) { | |
465 state = UC_CHAT; | |
466 } else if (!strcmp(show, "xa")) { | |
467 state = UC_XA; | |
468 } else if (!strcmp(show, "dnd")) { | |
469 state = UC_DND; | |
470 } | |
471 } else { | |
472 state = UC_NORMAL; | |
473 } | |
474 | |
448 who = jid_new(j->p, from); | 475 who = jid_new(j->p, from); |
449 if (who->user == NULL) { | 476 if (who->user == NULL) { |
450 /* FIXME: transport */ | 477 /* FIXME: transport */ |
451 return; | 478 return; |
452 } | 479 } |
453 | 480 |
454 buddy = g_strdup_printf("%s@%s", who->user, who->server); | 481 buddy = g_strdup_printf("%s@%s", who->user, who->server); |
455 | 482 |
456 if (!(b = find_buddy(GJ_GC(j), buddy))) { | 483 if (!(b = find_buddy(GJ_GC(j), buddy))) { |
457 add_buddy(GJ_GC(j), "Buddies", buddy, buddy); | 484 b = add_buddy(GJ_GC(j), "Buddies", buddy, buddy); |
458 build_edit_tree(); | 485 build_edit_tree(); |
459 do_export(NULL, NULL); | 486 do_export(NULL, NULL); |
460 } | 487 } |
461 | 488 |
462 if (type && (strcasecmp(type, "unavailable") == 0)) | 489 if (type && (strcasecmp(type, "unavailable") == 0)) |
463 serv_got_update(GJ_GC(j), buddy, 0, 0, 0, 0, 0, 0); | 490 serv_got_update(GJ_GC(j), buddy, 0, 0, 0, 0, 0, 0); |
464 else | 491 else |
465 serv_got_update(GJ_GC(j), buddy, 1, 0, 0, 0, 0, 0); | 492 serv_got_update(GJ_GC(j), buddy, 1, 0, 0, 0, state, 0); |
466 | 493 |
467 g_free(buddy); | 494 g_free(buddy); |
468 | 495 |
469 return; | 496 return; |
470 } | 497 } |
772 g_free(realwho); | 799 g_free(realwho); |
773 } | 800 } |
774 | 801 |
775 static char **jabber_list_icon(int uc) | 802 static char **jabber_list_icon(int uc) |
776 { | 803 { |
777 return available_xpm; | 804 switch (uc) { |
805 case UC_AWAY: | |
806 return available_away_xpm; | |
807 case UC_CHAT: | |
808 return available_chat_xpm; | |
809 case UC_XA: | |
810 return available_xa_xpm; | |
811 case UC_DND: | |
812 return available_dnd_xpm; | |
813 default: | |
814 return available_xpm; | |
815 } | |
778 } | 816 } |
779 | 817 |
780 static struct prpl *my_protocol = NULL; | 818 static struct prpl *my_protocol = NULL; |
781 | 819 |
782 void Jabber_init(struct prpl *ret) | 820 void Jabber_init(struct prpl *ret) |