Changeset fe7a554 for protocols/jabber/iq.c
- Timestamp:
- 2006-09-22T18:39:31Z (18 years ago)
- Branches:
- master
- Children:
- d8e0484
- Parents:
- 8d74291
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/iq.c
r8d74291 rfe7a554 28 28 struct gaim_connection *gc = data; 29 29 struct jabber_data *jd = gc->proto_data; 30 struct xt_node *query, *reply = NULL ;30 struct xt_node *query, *reply = NULL, *orig = NULL; 31 31 char *s, *type, *xmlns; 32 32 int st; … … 39 39 40 40 xmlns = xt_find_attr( query, "xmlns" ); 41 42 if( ( s = xt_find_attr( node, "id" ) ) ) 43 orig = jabber_packet_from_cache( gc, s ); 41 44 42 45 if( strcmp( type, "result" ) == 0 && xmlns && strcmp( xmlns, "jabber:iq:auth" ) == 0 ) … … 82 85 83 86 reply = jabber_make_packet( "iq", "set", NULL, reply ); 87 jabber_cache_packet( gc, reply ); 84 88 st = jabber_write_packet( gc, reply ); 85 xt_free_node( reply );86 89 87 90 return st ? XT_HANDLED : XT_ABORT; … … 106 109 presence_announce( gc ); 107 110 } 108 else if( strcmp( type, "result" ) == 0 )111 else if( strcmp( type, "result" ) == 0 && orig ) 109 112 { 110 /* If we weren't authenticated yet, let's assume we are now. 111 There are cleaner ways to do this, probably, but well.. */ 112 if( !( jd->flags & JFLAG_AUTHENTICATED ) ) 113 struct xt_node *node; 114 115 if( !( jd->flags & JFLAG_AUTHENTICATED ) && 116 ( node = xt_find_node( orig->children, "query" ) ) && 117 ( node = xt_find_node( node->children, "username" ) ) && 118 node->text_len ) 113 119 { 120 /* This happens when we just successfully authenticated 121 the old (non-SASL) way. */ 114 122 jd->flags |= JFLAG_AUTHENTICATED; 115 123 if( !jabber_get_roster( gc ) ) 116 124 return XT_ABORT; 125 } 126 else if( ( node = xt_find_node( orig->children, "bind" ) ) || 127 ( node = xt_find_node( orig->children, "session" ) ) ) 128 { 129 if( strcmp( node->name, "bind" ) == 0 ) 130 jd->flags &= ~JFLAG_WAIT_BIND; 131 else if( strcmp( node->name, "session" ) == 0 ) 132 jd->flags &= ~JFLAG_WAIT_SESSION; 133 134 if( ( jd->flags & ( JFLAG_WAIT_BIND | JFLAG_WAIT_SESSION ) ) == 0 ) 135 { 136 if( !jabber_get_roster( gc ) ) 137 return XT_ABORT; 138 } 117 139 } 118 140 }
Note: See TracChangeset
for help on using the changeset viewer.