- Timestamp:
- 2006-09-20T20:09:19Z (18 years ago)
- Branches:
- master
- Children:
- 0b4a0db
- Parents:
- 21167d2
- Location:
- protocols/jabber
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/iq.c
r21167d2 r70f6aab8 24 24 #include "jabber.h" 25 25 26 /*27 <iq xmlns="jabber:client" id="BeeX00000001" type="result"><query28 xmlns="jabber:iq:auth"><username>wilmer</username><resource/><password/><digest/>29 <sequence>499</sequence><token>450D1FFD</token></query></iq>30 */31 32 26 xt_status jabber_pkt_iq( struct xt_node *node, gpointer data ) 33 27 { … … 35 29 struct jabber_data *jd = gc->proto_data; 36 30 struct xt_node *query, *reply = NULL; 37 char *s ;31 char *s, *type, *xmlns; 38 32 int st; 39 33 40 34 query = xt_find_node( node->children, "query" ); 35 type = xt_find_attr( node, "type" ); 41 36 42 if( ! query)37 if( !type ) 43 38 return XT_HANDLED; /* Ignore it for now, don't know what's best... */ 44 39 45 if( ( s = xt_find_attr( query, "xmlns" ) ) && strcmp( s, "jabber:iq:auth" ) == 0 ) 40 xmlns = xt_find_attr( query, "xmlns" ); 41 42 if( strcmp( type, "result" ) == 0 && xmlns && strcmp( xmlns, "jabber:iq:auth" ) == 0 ) 46 43 { 47 44 /* Time to authenticate ourselves! */ … … 79 76 xt_free_node( reply ); 80 77 81 hide_login_progress _error( gc, "Can't find suitable authentication method" );78 hide_login_progress( gc, "Can't find suitable authentication method" ); 82 79 signoff( gc ); 83 80 return XT_ABORT; … … 89 86 90 87 return st ? XT_HANDLED : XT_ABORT; 88 } 89 else if( strcmp( type, "result" ) == 0 ) 90 { 91 /* If we weren't authenticated yet, let's assume we are now. 92 There are cleaner ways to do this, probably, but well.. */ 93 if( !( jd->flags & JFLAG_AUTHENTICATED ) ) 94 { 95 jd->flags |= JFLAG_AUTHENTICATED; 96 if( !jabber_get_roster( gc ) ) 97 return XT_ABORT; 98 } 99 } 100 else if( strcmp( type, "error" ) == 0 ) 101 { 102 if( !( jd->flags & JFLAG_AUTHENTICATED ) ) 103 { 104 hide_login_progress( gc, "Authentication failure" ); 105 signoff( gc ); 106 return XT_ABORT; 107 } 91 108 } 92 109 … … 109 126 return st; 110 127 } 128 129 int jabber_get_roster( struct gaim_connection *gc ) 130 { 131 struct xt_node *node; 132 int st; 133 134 set_login_progress( gc, 1, "Authenticated, requesting buddy list" ); 135 136 node = xt_new_node( "query", NULL, NULL ); 137 xt_add_attr( node, "xmlns", "jabber:iq:roster" ); 138 node = jabber_make_packet( "iq", "get", NULL, node ); 139 140 st = jabber_write_packet( gc, node ); 141 142 xt_free_node( node ); 143 return st; 144 } -
protocols/jabber/jabber.c
r21167d2 r70f6aab8 101 101 closesocket( jd->fd ); 102 102 103 xt_free( jd->xt ); 104 103 105 g_free( jd->username ); 104 106 g_free( jd ); -
protocols/jabber/jabber.h
r21167d2 r70f6aab8 39 39 xt_status jabber_pkt_iq( struct xt_node *node, gpointer data ); 40 40 int jabber_start_auth( struct gaim_connection *gc ); 41 int jabber_get_roster( struct gaim_connection *gc ); 41 42 42 43 xt_status jabber_pkt_message( struct xt_node *node, gpointer data );
Note: See TracChangeset
for help on using the changeset viewer.