diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-03-07 22:35:00 +0000 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-03-07 22:35:00 +0000 | 
| commit | 279607e52513bba31b7dfdd508d51e9ac24950c2 (patch) | |
| tree | 0d6aa6f0d2e57131377584fcf07bf517f617f44e /protocols/purple/purple.c | |
| parent | fb020ac61b1e457de7a44492bb05a84515828ac7 (diff) | |
Fixed purple module to work with the new away interface.
Diffstat (limited to 'protocols/purple/purple.c')
| -rw-r--r-- | protocols/purple/purple.c | 26 | 
1 files changed, 22 insertions, 4 deletions
| diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c index ce7f0e56..0873b6f5 100644 --- a/protocols/purple/purple.c +++ b/protocols/purple/purple.c @@ -194,7 +194,11 @@ static GList *purple_away_states( struct im_connection *ic )  	GList *st, *ret = NULL;  	for( st = purple_account_get_status_types( pa ); st; st = st->next ) -		ret = g_list_append( ret, (void*) purple_status_type_get_name( st->data ) ); +	{ +		PurpleStatusPrimitive prim = purple_status_type_get_primitive( st->data ); +		if( prim != PURPLE_STATUS_AVAILABLE && prim != PURPLE_STATUS_OFFLINE ) +			ret = g_list_append( ret, (void*) purple_status_type_get_name( st->data ) ); +	}  	return ret;  } @@ -204,17 +208,31 @@ static void purple_set_away( struct im_connection *ic, char *state_txt, char *me  	PurpleAccount *pa = ic->proto_data;  	GList *status_types = purple_account_get_status_types( pa ), *st;  	PurpleStatusType *pst = NULL; +	GList *args = NULL;  	for( st = status_types; st; st = st->next )  	{  		pst = st->data; -		if( g_strcasecmp( state_txt, purple_status_type_get_name( pst ) ) == 0 ) +		if( state_txt == NULL && +		    purple_status_type_get_primitive( st->data ) == PURPLE_STATUS_AVAILABLE ) +			break; + +		if( state_txt != NULL && +		    g_strcasecmp( state_txt, purple_status_type_get_name( pst ) ) == 0 )  			break;  	} -	purple_account_set_status( pa, st ? purple_status_type_get_id( pst ) : "away", -	                           TRUE, "message", message, NULL ); +	if( message ) +	{ +		args = g_list_append( args, "message" ); +		args = g_list_append( args, message ); +	} +	 +	purple_account_set_status_list( pa, st ? purple_status_type_get_id( pst ) : "away", +		                        TRUE, args ); + +	g_list_free( args );  }  static void purple_add_buddy( struct im_connection *ic, char *who, char *group ) | 
