Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/si.c

    r82b0295 re88fe7da  
    393393        struct jabber_transfer *tf = NULL;
    394394        struct jabber_data *jd = ic->proto_data;
    395         struct jabber_error *err;
    396395
    397396        if (!(tgt_jid = xt_find_attr(node, "from")) ||
    398             !(ini_jid = xt_find_attr(node, "to")) ||
    399             !(iq_id   = xt_find_attr(node, "id"))) {
     397            !(ini_jid = xt_find_attr(node, "to"))) {
    400398                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);
    429399                return XT_HANDLED;
    430400        }
     
    439409         *                                      <value>
    440410         */
    441         if (!(c = xt_find_node(node->children, "si")) ||
     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")) ||
    442415            !(cmp = xt_find_attr(c, "xmlns")) ||
    443416            !(strcmp(cmp, XMLNS_SI) == 0) ||
     
    466439        }
    467440
     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
    468456        tf->ini_jid = g_strdup(ini_jid);
    469457        tf->tgt_jid = g_strdup(tgt_jid);
Note: See TracChangeset for help on using the changeset viewer.