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/si.c

    rba52ac5 r537d9b9  
    393393        struct jabber_transfer *tf = NULL;
    394394        struct jabber_data *jd = ic->proto_data;
     395        struct jabber_error *err;
    395396
    396397        if (!(tgt_jid = xt_find_attr(node, "from")) ||
    397             !(ini_jid = xt_find_attr(node, "to"))) {
     398            !(ini_jid = xt_find_attr(node, "to")) ||
     399            !(iq_id   = xt_find_attr(node, "id"))) {
    398400                imcb_log(ic, "Invalid SI response from=%s to=%s", tgt_jid, ini_jid);
     401                return XT_HANDLED;
     402        }
     403
     404        /* Let's see if we can find out what this bytestream should be for... */
     405
     406        for (tflist = jd->filetransfers; tflist; tflist = g_slist_next(tflist)) {
     407                struct jabber_transfer *tft = tflist->data;
     408                if ((strcmp(tft->iq_id, iq_id) == 0)) {
     409                        tf = tft;
     410                        break;
     411                }
     412        }
     413
     414        if (!tf) {
     415                imcb_log(ic, "WARNING: Received bytestream request from %s that doesn't match an SI request", ini_jid);
     416                return XT_HANDLED;
     417        }
     418
     419        err = jabber_error_parse(xt_find_node(node->children, "error"), XMLNS_STANZA_ERROR);
     420
     421        if (err) {
     422                if (g_strcmp0(err->code, "forbidden") == 0) {
     423                        imcb_log(ic, "File %s: %s rejected the transfer", tf->ft->file_name, tgt_jid);
     424                } else {
     425                        imcb_log(ic, "Error: Stream initiation request failed: %s (%s)", err->code, err->text);
     426                }
     427                imcb_file_canceled(ic, tf->ft, "Stream initiation request failed");
     428                jabber_error_free(err);
    399429                return XT_HANDLED;
    400430        }
     
    409439         *                                      <value>
    410440         */
    411         if (!(tgt_jid = xt_find_attr(node, "from")) ||
    412             !(ini_jid = xt_find_attr(node, "to")) ||
    413             !(iq_id   = xt_find_attr(node, "id")) ||
    414             !(c = xt_find_node(node->children, "si")) ||
     441        if (!(c = xt_find_node(node->children, "si")) ||
    415442            !(cmp = xt_find_attr(c, "xmlns")) ||
    416443            !(strcmp(cmp, XMLNS_SI) == 0) ||
     
    439466        }
    440467
    441         /* Let's see if we can find out what this bytestream should be for... */
    442 
    443         for (tflist = jd->filetransfers; tflist; tflist = g_slist_next(tflist)) {
    444                 struct jabber_transfer *tft = tflist->data;
    445                 if ((strcmp(tft->iq_id, iq_id) == 0)) {
    446                         tf = tft;
    447                         break;
    448                 }
    449         }
    450 
    451         if (!tf) {
    452                 imcb_log(ic, "WARNING: Received bytestream request from %s that doesn't match an SI request", ini_jid);
    453                 return XT_HANDLED;
    454         }
    455 
    456468        tf->ini_jid = g_strdup(ini_jid);
    457469        tf->tgt_jid = g_strdup(tgt_jid);
Note: See TracChangeset for help on using the changeset viewer.