diff options
author | Marius Halden <marius.h@lden.org> | 2016-04-12 13:23:28 +0200 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2016-05-07 14:31:03 +0200 |
commit | 762067ea952f8b985f3704d5256c73fb7fb9af13 (patch) | |
tree | 0cd969426686bb1049f632b0698f40fa22a72b83 /protocols/account.c | |
parent | 6a75f2c17d647d4890406936f8c2b9a2b56b5a97 (diff) |
Revert "Better handling of set account"
This reverts commit 8ad3c8517ecb1d9ac7cf04236f8634c16b9adde0.
Diffstat (limited to 'protocols/account.c')
-rw-r--r-- | protocols/account.c | 88 |
1 files changed, 1 insertions, 87 deletions
diff --git a/protocols/account.c b/protocols/account.c index 6f6ad339..e25e40c7 100644 --- a/protocols/account.c +++ b/protocols/account.c @@ -163,55 +163,14 @@ char *set_eval_account(set_t *set, char *value) return NULL; /* password shouldn't be visible in plaintext! */ } else if (strcmp(set->key, "tag") == 0) { account_t *oa; - irc_t *irc; - GSList *l; - char *old; /* Enforce uniqueness. */ if ((oa = account_by_tag(acc->bee, value)) && oa != acc) { return SET_INVALID; } - old = acc->tag; + g_free(acc->tag); acc->tag = g_strdup(value); - - irc = acc->bee->ui_data; - for (l = irc->channels; l; l = l->next) { - irc_channel_t *ic = l->data; - - if (g_strcasecmp(set_getstr(&ic->set, "type"), "control") == 0) { - gboolean found = FALSE; - char **account, **accounts; - char *saccount = set_getstr(&ic->set, "account"); - - if (saccount == NULL || *saccount == '\0') { - continue; - } - - accounts = g_strsplit(saccount, ",", 0); - for (account = accounts; *account; account++) { - if (g_strcasecmp(*account, old) == 0) { - fprintf(stderr, "Found\n"); - found = TRUE; - g_free(*account); - *account = g_strdup(value); - break; - } - } - - if (found) { - saccount = g_strjoinv(",", accounts); - g_strfreev(accounts); - - fprintf(stderr, "%s\n", saccount); - set_setstr(&ic->set, "account", saccount); - - g_free(saccount); - } - } - } - - g_free(old); return value; } else if (strcmp(set->key, "auto_connect") == 0) { if (!is_bool(value)) { @@ -335,8 +294,6 @@ account_t *account_by_tag(bee_t *bee, const char *tag) void account_del(bee_t *bee, account_t *acc) { account_t *a, *l = NULL; - GSList *accl; - irc_t *irc; if (acc->ic) { /* Caller should have checked, accounts still in use can't be deleted. */ @@ -360,49 +317,6 @@ void account_del(bee_t *bee, account_t *acc) } */ - irc = acc->bee->ui_data; - for (accl = irc->channels; accl; accl = accl->next) { - irc_channel_t *ic = accl->data; - - if (g_strcasecmp(set_getstr(&ic->set, "type"), "control") == 0) { - gboolean found = FALSE; - char **account, **accounts; - char *saccount = set_getstr(&ic->set, "account"); - - if (saccount == NULL || *saccount == '\0') { - continue; - } - - accounts = g_strsplit(saccount, ",", 0); - for (account = accounts; *account; account++) { - if (g_strcasecmp(*account, acc->tag) == 0) { - found = TRUE; - break; - } - } - - if (found) { - g_free(*account); - - for (;;) { - *account = *(account + 1); - - account++; - if (*account == NULL) { - break; - } - } - - saccount = g_strjoinv(",", accounts); - g_strfreev(accounts); - - set_setstr(&ic->set, "account", saccount); - - g_free(saccount); - } - } - } - while (a->set) { set_del(&a->set, a->set->key); } |