Ignore:
Timestamp:
2010-03-17T15:15:19Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
60e4df3
Parents:
1c3008a (diff), f9928cb (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:

Merging mainline.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/io.c

    r1c3008a re8c8d00  
    375375       
    376376        if( ( c = xt_find_node( node->children, "bind" ) ) )
    377         {
    378                 reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &ic->acc->set, "resource" ), NULL ) );
    379                 xt_add_attr( reply, "xmlns", XMLNS_BIND );
    380                 reply = jabber_make_packet( "iq", "set", NULL, reply );
    381                 jabber_cache_add( ic, reply, jabber_pkt_bind_sess );
    382                
    383                 if( !jabber_write_packet( ic, reply ) )
    384                         return XT_ABORT;
    385                
    386                 jd->flags |= JFLAG_WAIT_BIND;
    387         }
     377                jd->flags |= JFLAG_WANT_BIND;
    388378       
    389379        if( ( c = xt_find_node( node->children, "session" ) ) )
    390         {
    391                 reply = xt_new_node( "session", NULL, NULL );
    392                 xt_add_attr( reply, "xmlns", XMLNS_SESSION );
    393                 reply = jabber_make_packet( "iq", "set", NULL, reply );
    394                 jabber_cache_add( ic, reply, jabber_pkt_bind_sess );
    395                
    396                 if( !jabber_write_packet( ic, reply ) )
    397                         return XT_ABORT;
    398                
    399                 jd->flags |= JFLAG_WAIT_SESSION;
    400         }
    401        
    402         /* This flag is already set if we authenticated via SASL, so now
    403            we can resume the session in the new stream, if we don't have
    404            to bind/initialize the session. */
    405         if( jd->flags & JFLAG_AUTHENTICATED && ( jd->flags & ( JFLAG_WAIT_BIND | JFLAG_WAIT_SESSION ) ) == 0 )
    406         {
    407                 if( !jabber_get_roster( ic ) )
    408                         return XT_ABORT;
    409         }
     380                jd->flags |= JFLAG_WANT_SESSION;
     381       
     382        if( jd->flags & JFLAG_AUTHENTICATED )
     383                return jabber_pkt_bind_sess( ic, NULL, NULL );
    410384       
    411385        return XT_HANDLED;
     
    441415        imcb_log( ic, "Converting stream to TLS" );
    442416       
     417        jd->flags |= JFLAG_STARTTLS_DONE;
    443418        jd->ssl = ssl_starttls( jd->fd, jabber_connected_ssl, ic );
    444419       
     
    531506                jd->r_inpa = b_input_add( jd->fd, GAIM_INPUT_READ, jabber_read_callback, ic );
    532507       
    533         greet = g_strdup_printf( "<?xml version='1.0' ?>"
    534                                  "<stream:stream to=\"%s\" xmlns=\"jabber:client\" "
    535                                   "xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\">", jd->server );
     508        greet = g_strdup_printf( "%s<stream:stream to=\"%s\" xmlns=\"jabber:client\" "
     509                                  "xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\">",
     510                                  ( jd->flags & JFLAG_STARTTLS_DONE ) ? "" : "<?xml version='1.0' ?>",
     511                                  jd->server );
    536512       
    537513        st = jabber_write( ic, greet, strlen( greet ) );
Note: See TracChangeset for help on using the changeset viewer.