diff options
| author | ulim <a.sporto+bee@gmail.com> | 2007-12-05 02:30:50 +0100 | 
|---|---|---|
| committer | ulim <a.sporto+bee@gmail.com> | 2007-12-05 02:30:50 +0100 | 
| commit | 8076ec04b1b5699f8266fa0e2e17456974ced554 (patch) | |
| tree | c53680ef30c2368e99f396e5e147b9c08437e46e /protocols/jabber/conference.c | |
| parent | dce390357114e30a424106c99e49cef1e682e1af (diff) | |
| parent | 793cc254ad2479d95d00266d6cb7ab2bcd158834 (diff) | |
merges from upstream/release
  ulim 2007-12-04 Follow rename of jabber_chat_by_jid from upstrem
    ulim 2007-12-04 Merged in current devel
    Wilmer van der Gaast 2007-12-02 Imported setuid() patch from Simo Leone <simo@archlinux...> with some
    Wilmer van der Gaast 2007-12-02 Forgot to return something in jabber_chat_join_failed().
    Wilmer van der Gaast 2007-12-02 Merging a change I should've pulled before committing three other changes.
    Wilmer van der Gaast 2007-12-02 Added charset checks on incoming msgs (from the IRC side) to prevent possible
    Wilmer van der Gaast 2007-12-02 Handling of presence-error packets (only useful for groupchats now), moved
    Wilmer van der Gaast 2007-12-02 Defining DEBUG via CFLAGS so that it'll always be there, even when a file
    ulim 2007-12-04 Jabber file transfer now also with sending! You can't use a proxy yet when
    Wilmer van der Gaast 2007-12-02 Removed retarded printf() (ARGH) and moved the event handling handling of
    Wilmer van der Gaast 2007-11-29 printf() in daemons considered harmful.
    Wilmer van der Gaast 2007-11-28 Fixed the epoll+ForkDaemon combination. The libevent event handling
Diffstat (limited to 'protocols/jabber/conference.c')
| -rw-r--r-- | protocols/jabber/conference.c | 48 | 
1 files changed, 44 insertions, 4 deletions
| diff --git a/protocols/jabber/conference.c b/protocols/jabber/conference.c index 008bbe63..c5bc0e68 100644 --- a/protocols/jabber/conference.c +++ b/protocols/jabber/conference.c @@ -23,6 +23,8 @@  #include "jabber.h" +static xt_status jabber_chat_join_failed( struct im_connection *ic, struct xt_node *node, struct xt_node *orig ); +  struct groupchat *jabber_chat_join( struct im_connection *ic, char *room, char *nick, char *password )  {  	struct jabber_chat *jc; @@ -34,14 +36,13 @@ struct groupchat *jabber_chat_join( struct im_connection *ic, char *room, char *  	node = xt_new_node( "x", NULL, NULL );  	xt_add_attr( node, "xmlns", XMLNS_MUC );  	node = jabber_make_packet( "presence", NULL, roomjid, node ); +	jabber_cache_add( ic, node, jabber_chat_join_failed );  	if( !jabber_write_packet( ic, node ) )  	{  		g_free( roomjid ); -		xt_free_node( node );  		return NULL;  	} -	xt_free_node( node );  	jc = g_new0( struct jabber_chat, 1 );  	jc->name = jabber_normalize( room ); @@ -64,6 +65,45 @@ struct groupchat *jabber_chat_join( struct im_connection *ic, char *room, char *  	return c;  } +static xt_status jabber_chat_join_failed( struct im_connection *ic, struct xt_node *node, struct xt_node *orig ) +{ +	struct jabber_error *err; +	struct jabber_buddy *bud; +	char *room; +	 +	room = xt_find_attr( orig, "to" ); +	if( ( bud = jabber_buddy_by_jid( ic, room, 0 ) ) ) +		jabber_chat_free( jabber_chat_by_jid( ic, bud->bare_jid ) ); +	 +	err = jabber_error_parse( xt_find_node( node->children, "error" ), XMLNS_STANZA_ERROR ); +	if( err ) +	{ +		imcb_error( ic, "Error joining groupchat %s: %s%s%s", +		            bud->bare_jid, err->code, err->text ? ": " : "", +		            err->text ? err->text : "" ); +		jabber_error_free( err ); +	} +	 +	return XT_HANDLED; +} + +struct groupchat *jabber_chat_by_jid( struct im_connection *ic, const char *name ) +{ +	char *normalized = jabber_normalize( name ); +	struct groupchat *ret; +	struct jabber_chat *jc; +	 +	for( ret = ic->groupchats; ret; ret = ret->next ) +	{ +		jc = ret->data; +		if( strcmp( normalized, jc->name ) == 0 ) +			break; +	} +	g_free( normalized ); +	 +	return ret; +} +  void jabber_chat_free( struct groupchat *c )  {  	struct jabber_chat *jc = c->data; @@ -147,7 +187,7 @@ void jabber_chat_pkt_presence( struct im_connection *ic, struct jabber_buddy *bu  	struct jabber_chat *jc;  	char *s; -	if( ( chat = jabber_chat_by_name( ic, bud->bare_jid ) ) == NULL ) +	if( ( chat = jabber_chat_by_jid( ic, bud->bare_jid ) ) == NULL )  	{  		/* How could this happen?? We could do kill( self, 11 )  		   now or just wait for the OS to do it. :-) */ @@ -249,7 +289,7 @@ void jabber_chat_pkt_message( struct im_connection *ic, struct jabber_buddy *bud  		return;  	} -	else if( ( chat = jabber_chat_by_name( ic, bud->bare_jid ) ) == NULL ) +	else if( ( chat = jabber_chat_by_jid( ic, bud->bare_jid ) ) == NULL )  	{  		/* How could this happen?? We could do kill( self, 11 )  		   now or just wait for the OS to do it. :-) */ | 
