Ignore:
Timestamp:
2016-11-20T08:40:36Z (8 years ago)
Author:
dequis <dx@…>
Children:
3f44e43
Parents:
ba52ac5 (diff), 9f03c47 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge master up to commit '9f03c47' into parson

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/iq.c

    rba52ac5 r537d9b9  
    6767                        xt_add_child(reply, xt_new_node("name", set_getstr(&ic->acc->set, "user_agent"), NULL));
    6868                        xt_add_child(reply, xt_new_node("version", BITLBEE_VERSION, NULL));
    69                         xt_add_child(reply, xt_new_node("os", ARCH, NULL));
    7069                } else if (strcmp(s, XMLNS_TIME_OLD) == 0) {
    7170                        time_t time_ep;
     
    234233                imcb_log(ic, "Warning: Received incomplete IQ packet while authenticating");
    235234                imc_logout(ic, FALSE);
    236                 return XT_HANDLED;
     235                return XT_ABORT;
    237236        }
    238237
     
    287286                imcb_log(ic, "Warning: Received incomplete IQ packet while authenticating");
    288287                imc_logout(ic, FALSE);
    289                 return XT_HANDLED;
     288                return XT_ABORT;
    290289        }
    291290
     
    10601059        return XT_HANDLED;
    10611060}
     1061
     1062xt_status jabber_iq_disco_muc_response(struct im_connection *ic, struct xt_node *node, struct xt_node *orig);
     1063
     1064int jabber_iq_disco_muc(struct im_connection *ic, const char *muc_server)
     1065{
     1066        struct xt_node *node;
     1067        int st;
     1068
     1069        node = xt_new_node("query", NULL, NULL);
     1070        xt_add_attr(node, "xmlns", XMLNS_DISCO_ITEMS);
     1071        node = jabber_make_packet("iq", "get", (char *) muc_server, node);
     1072
     1073        jabber_cache_add(ic, node, jabber_iq_disco_muc_response);
     1074        st = jabber_write_packet(ic, node);
     1075
     1076        return st;
     1077}
     1078
     1079xt_status jabber_iq_disco_muc_response(struct im_connection *ic, struct xt_node *node, struct xt_node *orig)
     1080{
     1081        struct xt_node *query, *c;
     1082        struct jabber_error *err;
     1083        GSList *rooms =  NULL;
     1084
     1085        if ((err = jabber_error_parse(xt_find_node(node->children, "error"), XMLNS_STANZA_ERROR))) {
     1086                imcb_error(ic, "The server replied with an error: %s%s%s",
     1087                           err->code, err->text ? ": " : "", err->text ? err->text : "");
     1088                jabber_error_free(err);
     1089                return XT_HANDLED;
     1090        }
     1091
     1092        if (!(query = xt_find_node(node->children, "query"))) {
     1093                imcb_error(ic, "Received incomplete MUC list reply");
     1094                return XT_HANDLED;
     1095        }
     1096
     1097        c = query->children;
     1098        while ((c = xt_find_node(c, "item"))) {
     1099                char *jid = xt_find_attr(c, "jid");
     1100
     1101                if (!jid || !strchr(jid, '@')) {
     1102                        c = c->next;
     1103                        continue;
     1104                }
     1105
     1106                bee_chat_info_t *ci = g_new(bee_chat_info_t, 1);
     1107                ci->title = g_strdup(xt_find_attr(c, "jid"));
     1108                ci->topic = g_strdup(xt_find_attr(c, "name"));
     1109                rooms = g_slist_prepend(rooms, ci);
     1110
     1111                c = c->next;
     1112        }
     1113
     1114        imcb_chat_list_free(ic);
     1115        ic->chatlist = g_slist_reverse(rooms);
     1116        imcb_chat_list_finish(ic);
     1117
     1118        return XT_HANDLED;
     1119}
Note: See TracChangeset for help on using the changeset viewer.