diff options
| -rw-r--r-- | protocols/jabber/iq.c | 44 | ||||
| -rw-r--r-- | protocols/jabber/jabber.h | 4 | 
2 files changed, 47 insertions, 1 deletions
| diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c index 2cdc681e..b5a37a30 100644 --- a/protocols/jabber/iq.c +++ b/protocols/jabber/iq.c @@ -26,6 +26,7 @@  static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );  static xt_status jabber_iq_display_vcard( struct im_connection *ic, struct xt_node *node, struct xt_node *orig ); +static int jabber_iq_disco_server( struct im_connection *ic );  xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )  { @@ -329,6 +330,8 @@ static xt_status jabber_finish_iq_auth( struct im_connection *ic, struct xt_node  		jd->flags |= JFLAG_AUTHENTICATED;  		if( !jabber_get_roster( ic ) )  			return XT_ABORT; +		if( !jabber_iq_disco_server( ic ) ) +			return XT_ABORT;  	}  	return XT_HANDLED; @@ -390,6 +393,8 @@ xt_status jabber_pkt_bind_sess( struct im_connection *ic, struct xt_node *node,  	{  		if( !jabber_get_roster( ic ) )  			return XT_ABORT; +		if( !jabber_iq_disco_server( ic ) ) +			return XT_ABORT;  	}  	return XT_HANDLED; @@ -886,3 +891,42 @@ static xt_status jabber_iq_version_response( struct im_connection *ic,  	return XT_HANDLED;  } + +static xt_status jabber_iq_disco_server_response( struct im_connection *ic, +	struct xt_node *node, struct xt_node *orig ); + +static int jabber_iq_disco_server( struct im_connection *ic ) +{ +	struct xt_node *node, *iq; +	struct jabber_data *jd = ic->proto_data; +	 +	node = xt_new_node( "query", NULL, NULL ); +	xt_add_attr( node, "xmlns", XMLNS_DISCO_INFO ); +	iq = jabber_make_packet( "iq", "get", jd->server, node ); +	 +	jabber_cache_add( ic, iq, jabber_iq_disco_server_response ); +	return jabber_write_packet( ic, iq ); +} + +static xt_status jabber_iq_disco_server_response( struct im_connection *ic, +	struct xt_node *node, struct xt_node *orig ) +{ +	struct jabber_data *jd = ic->proto_data; +	struct xt_node *id; +	 +	if( ( id = xt_find_path( node, "query/identity" ) ) ) +	{ +		char *cat, *type, *name; +		 +		if( !( cat = xt_find_attr( id, "category" ) ) || +		    !( type = xt_find_attr( id, "type" ) ) || +		    !( name = xt_find_attr( id, "name" ) ) ) +			return XT_HANDLED; +		 +		if( strcmp( cat, "server" ) == 0 && strcmp( type, "im" ) == 0 && +		    strstr( name, "Google" ) != NULL ) +			jd->flags |= JFLAG_GTALK; +	} +	 +	return XT_HANDLED; +} diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h index 046741a3..19430505 100644 --- a/protocols/jabber/jabber.h +++ b/protocols/jabber/jabber.h @@ -46,7 +46,9 @@ typedef enum  	                                   activates all XEP-85 related code. */  	JFLAG_XMLCONSOLE = 64,          /* If the user added an xmlconsole buddy. */  	JFLAG_STARTTLS_DONE = 128,      /* If a plaintext session was converted to TLS. */ -	 + +	JFLAG_GTALK =  0x100000,        /* Is Google Talk, as confirmed by iq discovery */ +  	JFLAG_SASL_FB = 0x10000,        /* Trying Facebook authentication. */  } jabber_flags_t; | 
