Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/iq.c

    ra73e91a r8fb1263  
    5151        {
    5252                if( !( ( c = xt_find_node( node->children, "query" ) ) ||
    53                        ( c = xt_find_node( node->children, "ping" ) ) ) || /* O_o WHAT is wrong with just <query/> ????? */
     53                       ( c = xt_find_node( node->children, "ping" ) ) ) ||
    5454                    !( s = xt_find_attr( c, "xmlns" ) ) )
    5555                {
    56                         imcb_log( ic, "Warning: Received incomplete IQ-%s packet", type );
     56                        /* Sigh. Who decided to suddenly invent new elements
     57                           instead of just sticking with <query/>? */
    5758                        return XT_HANDLED;
    5859                }
     
    297298{
    298299        struct jabber_data *jd = ic->proto_data;
    299         struct xt_node *c;
     300        struct xt_node *c, *reply = NULL;
    300301        char *s;
    301302       
    302         if( ( c = xt_find_node( node->children, "bind" ) ) )
     303        if( node && ( c = xt_find_node( node->children, "bind" ) ) )
    303304        {
    304305                c = xt_find_node( c->children, "jid" );
     
    307308                        imcb_log( ic, "Server changed session resource string to `%s'", s + 1 );
    308309               
    309                 jd->flags &= ~JFLAG_WAIT_BIND;
    310         }
    311         else
    312         {
    313                 jd->flags &= ~JFLAG_WAIT_SESSION;
    314         }
    315        
    316         if( ( jd->flags & ( JFLAG_WAIT_BIND | JFLAG_WAIT_SESSION ) ) == 0 )
     310                jd->flags &= ~JFLAG_WANT_BIND;
     311        }
     312        else if( node && ( c = xt_find_node( node->children, "session" ) ) )
     313        {
     314                jd->flags &= ~JFLAG_WANT_SESSION;
     315        }
     316       
     317        if( jd->flags & JFLAG_WANT_BIND )
     318        {
     319                reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &ic->acc->set, "resource" ), NULL ) );
     320                xt_add_attr( reply, "xmlns", XMLNS_BIND );
     321        }
     322        else if( jd->flags & JFLAG_WANT_SESSION )
     323        {
     324                reply = xt_new_node( "session", NULL, NULL );
     325                xt_add_attr( reply, "xmlns", XMLNS_SESSION );
     326        }
     327       
     328        if( reply != NULL )
     329        {
     330                reply = jabber_make_packet( "iq", "set", NULL, reply );
     331                jabber_cache_add( ic, reply, jabber_pkt_bind_sess );
     332               
     333                if( !jabber_write_packet( ic, reply ) )
     334                        return XT_ABORT;
     335        }
     336        else if( ( jd->flags & ( JFLAG_WANT_BIND | JFLAG_WANT_SESSION ) ) == 0 )
    317337        {
    318338                if( !jabber_get_roster( ic ) )
Note: See TracChangeset for help on using the changeset viewer.