Ignore:
Timestamp:
2010-03-17T15:15:19Z (12 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/iq.c

    r1c3008a re8c8d00  
    310310{
    311311        struct jabber_data *jd = ic->proto_data;
    312         struct xt_node *c;
     312        struct xt_node *c, *reply = NULL;
    313313        char *s;
    314314       
    315         if( ( c = xt_find_node( node->children, "bind" ) ) )
     315        if( node && ( c = xt_find_node( node->children, "bind" ) ) )
    316316        {
    317317                c = xt_find_node( c->children, "jid" );
     
    319319                    strcmp( s + 1, set_getstr( &ic->acc->set, "resource" ) ) != 0 )
    320320                        imcb_log( ic, "Server changed session resource string to `%s'", s + 1 );
    321                
    322                 jd->flags &= ~JFLAG_WAIT_BIND;
    323         }
    324         else
    325         {
    326                 jd->flags &= ~JFLAG_WAIT_SESSION;
    327         }
    328        
    329         if( ( jd->flags & ( JFLAG_WAIT_BIND | JFLAG_WAIT_SESSION ) ) == 0 )
     321        }
     322       
     323        if( jd->flags & JFLAG_WANT_BIND )
     324        {
     325                reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &ic->acc->set, "resource" ), NULL ) );
     326                xt_add_attr( reply, "xmlns", XMLNS_BIND );
     327                jd->flags &= ~JFLAG_WANT_BIND;
     328        }
     329        else if( jd->flags & JFLAG_WANT_SESSION )
     330        {
     331                reply = xt_new_node( "session", NULL, NULL );
     332                xt_add_attr( reply, "xmlns", XMLNS_SESSION );
     333                jd->flags &= ~JFLAG_WANT_SESSION;
     334        }
     335       
     336        if( reply != NULL )
     337        {
     338                reply = jabber_make_packet( "iq", "set", NULL, reply );
     339                jabber_cache_add( ic, reply, jabber_pkt_bind_sess );
     340               
     341                if( !jabber_write_packet( ic, reply ) )
     342                        return XT_ABORT;
     343        }
     344        else if( ( jd->flags & ( JFLAG_WANT_BIND | JFLAG_WANT_SESSION ) ) == 0 )
    330345        {
    331346                if( !jabber_get_roster( ic ) )
Note: See TracChangeset for help on using the changeset viewer.