Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/iq.c

    r74349eb r315dd4c  
    298298{
    299299        struct jabber_data *jd = ic->proto_data;
    300         struct xt_node *c;
     300        struct xt_node *c, *reply = NULL;
    301301        char *s;
    302302       
    303         if( ( c = xt_find_node( node->children, "bind" ) ) )
     303        if( node && ( c = xt_find_node( node->children, "bind" ) ) )
    304304        {
    305305                c = xt_find_node( c->children, "jid" );
     
    307307                    strcmp( s + 1, set_getstr( &ic->acc->set, "resource" ) ) != 0 )
    308308                        imcb_log( ic, "Server changed session resource string to `%s'", s + 1 );
    309                
    310                 jd->flags &= ~JFLAG_WAIT_BIND;
    311         }
    312         else
    313         {
    314                 jd->flags &= ~JFLAG_WAIT_SESSION;
    315         }
    316        
    317         if( ( jd->flags & ( JFLAG_WAIT_BIND | JFLAG_WAIT_SESSION ) ) == 0 )
     309        }
     310       
     311        if( jd->flags & JFLAG_WANT_BIND )
     312        {
     313                reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &ic->acc->set, "resource" ), NULL ) );
     314                xt_add_attr( reply, "xmlns", XMLNS_BIND );
     315                jd->flags &= ~JFLAG_WANT_BIND;
     316        }
     317        else if( jd->flags & JFLAG_WANT_SESSION )
     318        {
     319                reply = xt_new_node( "session", NULL, NULL );
     320                xt_add_attr( reply, "xmlns", XMLNS_SESSION );
     321                jd->flags &= ~JFLAG_WANT_SESSION;
     322        }
     323       
     324        if( reply != NULL )
     325        {
     326                reply = jabber_make_packet( "iq", "set", NULL, reply );
     327                jabber_cache_add( ic, reply, jabber_pkt_bind_sess );
     328               
     329                if( !jabber_write_packet( ic, reply ) )
     330                        return XT_ABORT;
     331        }
     332        else if( ( jd->flags & ( JFLAG_WANT_BIND | JFLAG_WANT_SESSION ) ) == 0 )
    318333        {
    319334                if( !jabber_get_roster( ic ) )
Note: See TracChangeset for help on using the changeset viewer.