diff options
| author | ulim <a.sporto+bee@gmail.com> | 2007-12-04 02:08:43 +0100 | 
|---|---|---|
| committer | ulim <a.sporto+bee@gmail.com> | 2007-12-04 02:08:43 +0100 | 
| commit | 08135dff0e668622fc858d2ad8a7d0bdbdb8cb24 (patch) | |
| tree | d46ae0a920d1db0a9f710cb916657ae549db31cb /protocols/jabber/jabber_util.c | |
| parent | fa30fa598d2e77c998f9156d0f31ccf99b0c781f (diff) | |
| parent | aaf92a9eb64327892e39fdbd7113d797d1d68cec (diff) | |
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
    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/jabber_util.c')
| -rw-r--r-- | protocols/jabber/jabber_util.c | 53 | 
1 files changed, 35 insertions, 18 deletions
| diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c index 6bb65878..7350eaf4 100644 --- a/protocols/jabber/jabber_util.c +++ b/protocols/jabber/jabber_util.c @@ -184,6 +184,36 @@ gboolean jabber_cache_clean_entry( gpointer key, gpointer entry_, gpointer nullp  	}  } +xt_status jabber_cache_handle_packet( struct im_connection *ic, struct xt_node *node ) +{ +	struct jabber_data *jd = ic->proto_data; +	struct jabber_cache_entry *entry; +	char *s; +	 +	if( ( s = xt_find_attr( node, "id" ) ) == NULL || +	    strncmp( s, jd->cached_id_prefix, strlen( jd->cached_id_prefix ) ) != 0 ) +	{ +		/* Silently ignore it, without an ID (or a non-cache +		   ID) we don't know how to handle the packet and we +		   probably don't have to. */ +		return XT_HANDLED; +	} +	 +	entry = g_hash_table_lookup( jd->node_cache, s ); +	 +	if( entry == NULL ) +	{ +		imcb_log( ic, "WARNING: Received %s-%s packet with unknown/expired ID %s!", +		              node->name, xt_find_attr( node, "type" ) ? : "(no type)", s ); +	} +	else if( entry->func ) +	{ +		return entry->func( ic, node, entry->node ); +	} +	 +	return XT_HANDLED; +} +  const struct jabber_away_state jabber_away_state_list[] =  {  	{ "away",  "Away" }, @@ -594,23 +624,6 @@ int jabber_buddy_remove_bare( struct im_connection *ic, char *bare_jid )  	}  } -struct groupchat *jabber_chat_by_name( 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; -} -  time_t jabber_get_timestamp( struct xt_node *xt )  {  	struct tm tp, utc; @@ -662,10 +675,14 @@ time_t jabber_get_timestamp( struct xt_node *xt )  struct jabber_error *jabber_error_parse( struct xt_node *node, char *xmlns )  { -	struct jabber_error *err = g_new0( struct jabber_error, 1 ); +	struct jabber_error *err;  	struct xt_node *c;  	char *s; +	if( node == NULL ) +		return NULL; +	 +	err = g_new0( struct jabber_error, 1 );  	err->type = xt_find_attr( node, "type" );  	for( c = node->children; c; c = c->next ) | 
