diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2006-09-24 12:25:41 +0200 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2006-09-24 12:25:41 +0200 |
commit | 172a73f1a4b37fa20d1d50496a3faccb8fe6c769 (patch) | |
tree | daffad6b274d33928faa471303477761f13c6b4c /protocols/jabber/jabber_util.c | |
parent | 5e202b09f2cd9faff5f316ae6804facb5342eace (diff) |
Updated <presence> stuff to handle changing the priority setting.
Diffstat (limited to 'protocols/jabber/jabber_util.c')
-rw-r--r-- | protocols/jabber/jabber_util.c | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c index 21df5126..e7a161cc 100644 --- a/protocols/jabber/jabber_util.c +++ b/protocols/jabber/jabber_util.c @@ -28,17 +28,42 @@ static int next_id = 1; char *set_eval_resprio( set_t *set, char *value ) { account_t *acc = set->data; + char *ret; - /* Only run this stuff if the account is online ATM. */ - if( acc->gc ) + if( strcmp( set->key, "priority" ) == 0 ) + ret = set_eval_int( set, value ); + else + ret = value; + + /* Only run this stuff if the account is online ATM, + and if the setting seems to be acceptable. */ + if( acc->gc && ret ) { - /* ... */ + if( strcmp( set->key, "priority" ) == 0 ) + { + /* Although set_eval functions usually are very nice + and convenient, they have one disadvantage: If I + would just call p_s_u() now to send the new prio + setting, it would send the old setting because the + set->value gets changed when the eval returns a + non-NULL value. + + So now I can choose between implementing post-set + functions next to evals, or just do this little + hack: */ + g_free( set->value ); + set->value = g_strdup( ret ); + + /* (Yes, sorry, I prefer the hack. :-P) */ + + presence_send_update( acc->gc ); + } + else + { + } } - if( g_strcasecmp( set->key, "priority" ) == 0 ) - return set_eval_int( set, value ); - else - return value; + return ret; } char *set_eval_tls( set_t *set, char *value ) |