diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2006-09-25 12:10:14 +0200 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2006-09-25 12:10:14 +0200 |
commit | ebe7b36af555d644357efbc0e63393927162bf06 (patch) | |
tree | f1fcf377ff52962ba904c102d617884d9c33b545 | |
parent | eab2ac45071373751a3041c85b0ab69460109032 (diff) |
Changing the resource string while online probably doesn't work.
-rw-r--r-- | protocols/jabber/jabber.c | 7 | ||||
-rw-r--r-- | protocols/jabber/jabber.h | 2 | ||||
-rw-r--r-- | protocols/jabber/jabber_util.c | 44 |
3 files changed, 23 insertions, 30 deletions
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 39a61bf3..7f679559 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -39,9 +39,10 @@ static void jabber_acc_init( account_t *acc ) s = set_add( &acc->set, "port", "5222", set_eval_int, acc ); s->flags |= ACC_SET_OFFLINE_ONLY; - s = set_add( &acc->set, "priority", "0", set_eval_resprio, acc ); + s = set_add( &acc->set, "priority", "0", set_eval_priority, acc ); - s = set_add( &acc->set, "resource", "BitlBee", set_eval_resprio, acc ); + s = set_add( &acc->set, "resource", "BitlBee", NULL, acc ); + s->flags |= ACC_SET_OFFLINE_ONLY; s = set_add( &acc->set, "server", NULL, set_eval_account, acc ); s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY; @@ -233,6 +234,8 @@ static void jabber_rem_permit( struct gaim_connection *gc, char *who ) presence_send_request( gc, who, "unsubscribed" ); } +/* XMPP doesn't have both a block- and and allow-list, so these two functions + will be no-ops: */ static void jabber_add_deny( struct gaim_connection *gc, char *who ) { } diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h index f05c1c55..8ca7d545 100644 --- a/protocols/jabber/jabber.h +++ b/protocols/jabber/jabber.h @@ -84,7 +84,7 @@ int presence_send_update( struct gaim_connection *gc ); int presence_send_request( struct gaim_connection *gc, char *handle, char *request ); /* jabber_util.c */ -char *set_eval_resprio( set_t *set, char *value ); +char *set_eval_priority( set_t *set, char *value ); char *set_eval_tls( set_t *set, char *value ); struct xt_node *jabber_make_packet( char *name, char *type, char *to, struct xt_node *children ); void jabber_cache_packet( struct gaim_connection *gc, struct xt_node *node ); diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c index 3a0d2004..6764e7b3 100644 --- a/protocols/jabber/jabber_util.c +++ b/protocols/jabber/jabber_util.c @@ -25,42 +25,32 @@ static int next_id = 1; -char *set_eval_resprio( set_t *set, char *value ) +char *set_eval_priority( set_t *set, char *value ) { account_t *acc = set->data; char *ret; - if( strcmp( set->key, "priority" ) == 0 ) - ret = set_eval_int( set, value ); - else - ret = value; + ret = set_eval_int( set, 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 - { - } + /* 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 ); } return ret; |