diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-03-07 18:41:45 +0000 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-03-07 18:41:45 +0000 | 
| commit | c32f492758759c04d8b6239a7862648c9d32c4d8 (patch) | |
| tree | 628612ec0d2c431519a0a3741df7e4c6609db7f1 /account.c | |
| parent | 1c2eaa3c99a2e7fbe264b06e559f3d709b9a080d (diff) | |
| parent | 0e99548ba9c6ec9c78367e05b676dab90b5261a4 (diff) | |
Merging in improved away/status message code.
Diffstat (limited to 'account.c')
| -rw-r--r-- | account.c | 30 | 
1 files changed, 27 insertions, 3 deletions
| @@ -1,7 +1,7 @@    /********************************************************************\    * BitlBee -- An IRC to other IM-networks gateway                     *    *                                                                    * -  * Copyright 2002-2004 Wilmer van der Gaast and others                * +  * Copyright 2002-2010 Wilmer van der Gaast and others                *    \********************************************************************/  /* Account management functions                                         */ @@ -68,7 +68,16 @@ account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass )  	if( prpl->init )  		prpl->init( a ); -	return( a ); +	s = set_add( &a->set, "away", NULL, set_eval_account, a ); +	s->flags |= SET_NULL_OK; +	 +	if( a->flags & ACC_FLAG_STATUS_MESSAGE ) +	{ +		s = set_add( &a->set, "status", NULL, set_eval_account, a ); +		s->flags |= SET_NULL_OK; +	} +	 +	return a;  }  char *set_eval_account( set_t *set, char *value ) @@ -122,6 +131,21 @@ char *set_eval_account( set_t *set, char *value )  		acc->auto_connect = bool2int( value );  		return value;  	} +	else if( strcmp( set->key, "away" ) == 0 || +	         strcmp( set->key, "status" ) == 0 ) +	{ +		if( acc->ic && acc->ic->flags & OPT_LOGGED_IN ) +		{ +			/* If we're currently on-line, set the var now already +			   (bit of a hack) and send an update. */ +			g_free( set->value ); +			set->value = g_strdup( value ); +			 +			imc_away_send_update( acc->ic ); +		} +		 +		return value; +	}  	return SET_INVALID;  } @@ -266,7 +290,7 @@ int account_reconnect_delay_parse( char *value, struct account_reconnect_delay *  	/* A whole day seems like a sane "maximum maximum". */  	p->max = 86400; -	/* Format: /[0-9]+([*+][0-9]+(<[0-9+]))/ */ +	/* Format: /[0-9]+([*+][0-9]+(<[0-9+])?)?/ */  	while( *value && isdigit( *value ) )  		p->start = p->start * 10 + *value++ - '0'; | 
