Changes in protocols/jabber/hipchat.c [830864d:40cfbc5]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/hipchat.c
r830864d r40cfbc5 27 27 { 28 28 struct jabber_data *jd = ic->proto_data; 29 char *sep, *jid , *muc_host;29 char *sep, *jid; 30 30 31 31 jid = xt_find_attr(node, "jid"); 32 muc_host = xt_find_attr(node, "muc_host");33 32 34 33 sep = strchr(jid, '/'); … … 47 46 jd->flags &= ~JFLAG_STREAM_RESTART; 48 47 49 if (!jabber_get_roster(ic)) { 50 return XT_ABORT; 51 } 52 if (!jabber_iq_disco_server(ic)) { 53 return XT_ABORT; 54 } 55 if (!jabber_get_hipchat_profile(ic)) { 56 return XT_ABORT; 57 } 58 if (!jabber_iq_disco_muc(ic, muc_host)) { 48 if (!jabber_get_roster(ic) || 49 !jabber_iq_disco_server(ic) || 50 !jabber_get_hipchat_profile(ic)) { 59 51 return XT_ABORT; 60 52 } … … 85 77 struct xt_node *query, *name_node; 86 78 87 //char *name;88 89 79 if (!(query = xt_find_node(node->children, "query"))) { 90 80 imcb_log(ic, "Warning: Received NULL profile packet"); … … 102 92 103 93 } 104 105 int jabber_iq_disco_muc(struct im_connection *ic, char *muc_server)106 {107 struct xt_node *node;108 int st;109 110 imcb_log(ic, "Fetching MUC list");111 112 node = xt_new_node("query", NULL, NULL);113 xt_add_attr(node, "xmlns", XMLNS_DISCO_ITEMS);114 node = jabber_make_packet("iq", "get", muc_server, node);115 116 jabber_cache_add(ic, node, jabber_parse_muc_list);117 st = jabber_write_packet(ic, node);118 119 return st;120 }121 122 xt_status jabber_parse_muc_list(struct im_connection *ic, struct xt_node *node, struct xt_node *orig)123 {124 struct xt_node *query, *c;125 126 if (!(query = xt_find_node(node->children, "query"))) {127 imcb_log(ic, "Warning: Received NULL MUC list packet");128 return XT_HANDLED;129 }130 131 c = query->children;132 while ((c = xt_find_node(c, "item"))) {133 struct xt_node *c2;134 char *topic = NULL;135 char *jid = xt_find_attr(c, "jid");136 char *name = xt_find_attr(c, "name");137 138 imcb_log(ic, "Debug: adding MUC to channel list: %s - '%s'", jid, name);139 140 if ((c2 = xt_find_node_by_attr(c->children, "x", "xmlns", XMLNS_HIPCHAT_MUC)) &&141 (c2 = xt_find_node(c2->children, "topic"))) {142 topic = c2->text;143 }144 145 imcb_chat_placeholder_new(ic, jid, name, topic);146 c = c->next;147 }148 return XT_HANDLED;149 150 }
Note: See TracChangeset
for help on using the changeset viewer.