diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-24 13:19:52 +0100 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-24 13:19:52 +0100 | 
| commit | ea728e661f521405c2883c70865d563750223770 (patch) | |
| tree | 31ee3abe6715bf4b75a895eb35d76b2026d5efec /protocols | |
| parent | 9b1d2d6fa7edb911e3dbcd8785aaa797ebb20d0a (diff) | |
| parent | bd599b9aeabee36ac6fdb379ca09aec27cce13a4 (diff) | |
Merging mainline.
Diffstat (limited to 'protocols')
| -rw-r--r-- | protocols/bee.h | 2 | ||||
| -rw-r--r-- | protocols/bee_chat.c | 8 | ||||
| -rw-r--r-- | protocols/jabber/message.c | 16 | ||||
| -rw-r--r-- | protocols/jabber/si.c | 6 | ||||
| -rw-r--r-- | protocols/twitter/twitter_lib.c | 2 | ||||
| -rw-r--r-- | protocols/yahoo/libyahoo2.c | 19 | 
6 files changed, 44 insertions, 9 deletions
| diff --git a/protocols/bee.h b/protocols/bee.h index d7da3671..077c3661 100644 --- a/protocols/bee.h +++ b/protocols/bee.h @@ -122,6 +122,7 @@ typedef struct bee_ui_funcs  	gboolean (*chat_remove_user)( bee_t *bee, struct groupchat *c, bee_user_t *bu );  	gboolean (*chat_topic)( bee_t *bee, struct groupchat *c, const char *new, bee_user_t *bu );  	gboolean (*chat_name_hint)( bee_t *bee, struct groupchat *c, const char *name ); +	gboolean (*chat_invite)( bee_t *bee, bee_user_t *bu, const char *name, const char *msg );  	struct file_transfer* (*ft_in_start)( bee_t *bee, bee_user_t *bu, const char *file_name, size_t file_size );  	gboolean (*ft_out_start)( struct im_connection *ic, struct file_transfer *ft ); @@ -175,5 +176,6 @@ G_MODULE_EXPORT void imcb_chat_add_buddy( struct groupchat *c, const char *handl  G_MODULE_EXPORT void imcb_chat_remove_buddy( struct groupchat *c, const char *handle, const char *reason );  G_MODULE_EXPORT int bee_chat_msg( bee_t *bee, struct groupchat *c, const char *msg, int flags );  G_MODULE_EXPORT struct groupchat *bee_chat_by_title( bee_t *bee, struct im_connection *ic, const char *title ); +G_MODULE_EXPORT void imcb_chat_invite( struct im_connection *ic, const char *name, const char *who, const char *msg );  #endif /* __BEE_H__ */ diff --git a/protocols/bee_chat.c b/protocols/bee_chat.c index 3be6f189..0314cae5 100644 --- a/protocols/bee_chat.c +++ b/protocols/bee_chat.c @@ -232,3 +232,11 @@ struct groupchat *bee_chat_by_title( bee_t *bee, struct im_connection *ic, const  	return NULL;  } + +void imcb_chat_invite( struct im_connection *ic, const char *name, const char *who, const char *msg ) +{ +	bee_user_t *bu = bee_user_by_handle( ic->bee, ic, who ); +	 +	if( bu && ic->bee->ui->chat_invite ) +		ic->bee->ui->chat_invite( ic->bee, bu, name, msg ); +} diff --git a/protocols/jabber/message.c b/protocols/jabber/message.c index ce5017fb..6e40e521 100644 --- a/protocols/jabber/message.c +++ b/protocols/jabber/message.c @@ -30,7 +30,7 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data )  	char *type = xt_find_attr( node, "type" );  	struct xt_node *body = xt_find_node( node->children, "body" ), *c;  	struct jabber_buddy *bud = NULL; -	char *s; +	char *s, *room = NULL, *reason = NULL;  	if( !from )  		return XT_HANDLED; /* Consider this packet corrupted. */ @@ -51,19 +51,19 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data )  		for( c = node->children; ( c = xt_find_node( c, "x" ) ); c = c->next )  		{ -			char *ns = xt_find_attr( c, "xmlns" ), *room; -			struct xt_node *inv, *reason; +			char *ns = xt_find_attr( c, "xmlns" ); +			struct xt_node *inv;  			if( ns && strcmp( ns, XMLNS_MUC_USER ) == 0 &&  			    ( inv = xt_find_node( c->children, "invite" ) ) )  			{ +				/* This is an invitation. Set some vars which +				   will be passed to imcb_chat_invite() below. */  				room = from;  				if( ( from = xt_find_attr( inv, "from" ) ) == NULL )  					from = room; - -				g_string_append_printf( fullmsg, "<< \002BitlBee\002 - Invitation to chatroom %s >>\n", room ); -				if( ( reason = xt_find_node( inv->children, "reason" ) ) && reason->text_len > 0 ) -					g_string_append( fullmsg, reason->text ); +				if( ( inv = xt_find_node( inv->children, "reason" ) ) && inv->text_len > 0 ) +					reason = inv->text;  			}  		} @@ -103,6 +103,8 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data )  		if( fullmsg->len > 0 )  			imcb_buddy_msg( ic, from, fullmsg->str,  			                0, jabber_get_timestamp( node ) ); +		if( room ) +			imcb_chat_invite( ic, room, from, reason );  		g_string_free( fullmsg, TRUE ); diff --git a/protocols/jabber/si.c b/protocols/jabber/si.c index 58c0e17f..4b0e57c4 100644 --- a/protocols/jabber/si.c +++ b/protocols/jabber/si.c @@ -261,6 +261,10 @@ int jabber_si_handle_request( struct im_connection *ic, struct xt_node *node, st  				requestok = TRUE;  				break;  			} +			else +			{ +				c = c->next; +			}  		if ( !requestok )  			imcb_log( ic, "WARNING: Unsupported file transfer request from %s", ini_jid); @@ -372,7 +376,7 @@ void jabber_si_answer_request( file_transfer_t *ft ) {  static xt_status jabber_si_handle_response(struct im_connection *ic, struct xt_node *node, struct xt_node *orig )  {  	struct xt_node *c, *d; -	char *ini_jid, *tgt_jid, *iq_id, *cmp; +	char *ini_jid = NULL, *tgt_jid, *iq_id, *cmp;  	GSList *tflist;  	struct jabber_transfer *tf=NULL;  	struct jabber_data *jd = ic->proto_data; diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index 22d2a3bd..f86e1f15 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -372,7 +372,7 @@ static xt_status twitter_xt_get_user_list( struct xt_node *node, struct twitter_   */  static xt_status twitter_xt_get_status( struct xt_node *node, struct twitter_xml_status *txs )  { -	struct xt_node *child, *rt; +	struct xt_node *child, *rt = NULL;  	gboolean truncated = FALSE;  	// Walk over the nodes children. diff --git a/protocols/yahoo/libyahoo2.c b/protocols/yahoo/libyahoo2.c index b062e7f9..07689809 100644 --- a/protocols/yahoo/libyahoo2.c +++ b/protocols/yahoo/libyahoo2.c @@ -2168,6 +2168,18 @@ static void yahoo_process_buddyadd(struct yahoo_input_data *yid,  	yd->buddies = y_list_append(yd->buddies, bud); +#if 0 +	/* BitlBee: This seems to be wrong in my experience. I think: +	   status = 0: Success +	   status = 2: Already on list +	   status = 3: Doesn't exist +	   status = 42: Invalid handle (possibly banned/reserved, I get it for +	                handles like joe or jjjjjj) +	   Haven't seen others yet. But whenever the add is successful, there +	   will be a separate "went online" packet when the auth. request is +	   accepted. Couldn't find any test account that doesn't require auth. +	   unfortunately (if there is even such a thing?) */ +	     	/* A non-zero status (i've seen 2) seems to mean the buddy is already   	 * added and is online */  	if (status) { @@ -2176,6 +2188,13 @@ static void yahoo_process_buddyadd(struct yahoo_input_data *yid,  		YAHOO_CALLBACK(ext_yahoo_status_changed) (yd->client_id, who,  			YAHOO_STATUS_AVAILABLE, NULL, 0, 0, 0);  	} +#endif +	/* BitlBee: Need ACK of added buddy, if it was successful. */ +	if (status == 0) { +		YList *tmp = y_list_append(NULL, bud); +		YAHOO_CALLBACK(ext_yahoo_got_buddies) (yd->client_id, tmp); +		y_list_free(tmp); +	}  }  static void yahoo_process_buddydel(struct yahoo_input_data *yid, | 
