aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/account.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-07-13 01:17:37 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2010-07-13 01:17:37 +0100
commit06b39f28ca532b21c9ddb1ce36c17d3f7121c388 (patch)
tree1d1e44ca31a8286e126b7a7bcff1b0e07b7c6a87 /protocols/account.c
parentdb2cef1ab11cc58cc92c16fd9bccd0fe17e413e4 (diff)
Automatically convert nick_source settings to their nick_convert equivalent.
Diffstat (limited to 'protocols/account.c')
-rw-r--r--protocols/account.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/protocols/account.c b/protocols/account.c
index 2552b672..cf9cbe71 100644
--- a/protocols/account.c
+++ b/protocols/account.c
@@ -27,6 +27,8 @@
#include "bitlbee.h"
#include "account.h"
+static char *set_eval_nick_source( set_t *set, char *value );
+
account_t *account_add( bee_t *bee, struct prpl *prpl, char *user, char *pass )
{
account_t *a;
@@ -56,7 +58,8 @@ account_t *account_add( bee_t *bee, struct prpl *prpl, char *user, char *pass )
s = set_add( &a->set, "nick_format", NULL, NULL, a );
s->flags |= SET_NULL_OK;
- s = set_add( &a->set, "nick_source", "handle", NULL, a );
+ s = set_add( &a->set, "nick_source", "handle", set_eval_nick_source, a );
+ s->flags |= ACC_SET_NOSAVE; /* Just for bw compatibility! */
s = set_add( &a->set, "password", NULL, set_eval_account, a );
s->flags |= ACC_SET_NOSAVE | SET_NULL_OK;
@@ -154,6 +157,21 @@ char *set_eval_account( set_t *set, char *value )
return SET_INVALID;
}
+/* For bw compatibility, have this write-only setting. */
+static char *set_eval_nick_source( set_t *set, char *value )
+{
+ account_t *a = set->data;
+
+ if( strcmp( value, "full_name" ) == 0 )
+ set_setstr( &a->set, "nick_format", "%full_name" );
+ else if( strcmp( value, "first_name" ) == 0 )
+ set_setstr( &a->set, "nick_format", "%first_name" );
+ else
+ set_setstr( &a->set, "nick_format", "%-@nick" );
+
+ return value;
+}
+
account_t *account_get( bee_t *bee, char *id )
{
account_t *a, *ret = NULL;