diff options
author | Marius Halden <marius.h@lden.org> | 2016-04-12 13:23:42 +0200 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2016-05-07 14:31:03 +0200 |
commit | e693e93e1fb3a9b2cc6fdfe1b2f2076a8585deb4 (patch) | |
tree | 4cb3676a08719e78a5b1fa84dde61c67acf39e82 | |
parent | 762067ea952f8b985f3704d5256c73fb7fb9af13 (diff) |
Revert "Add support for multiple accounts in set account"
This reverts commit e9352b3581c2493bec222a259d71a072ac24b762.
-rw-r--r-- | irc_channel.c | 70 |
1 files changed, 5 insertions, 65 deletions
diff --git a/irc_channel.c b/irc_channel.c index 583b6d20..34ed54a9 100644 --- a/irc_channel.c +++ b/irc_channel.c @@ -861,66 +861,22 @@ static gboolean control_channel_join(irc_channel_t *ic) return TRUE; } -struct acclist { - struct account *acc; - struct acclist *next; -}; - static char *set_eval_by_account(set_t *set, char *value) { struct irc_channel *ic = set->data; struct irc_control_channel *icc = ic->data; account_t *acc; - struct acclist *accl, *tmp, *new_acc = NULL; - - char **accounts, **account; - accounts = g_strsplit(value, ",", 0); - if (accounts == NULL) { - goto fail; - } - - for (account = accounts; *account; account++) { - if (!(acc = account_get(ic->irc->b, *account))) { - goto fail; - } else { - tmp = g_malloc(sizeof(struct account)); - if (tmp == NULL) { - goto fail; - } else { - tmp->acc = acc; - tmp->next = new_acc; - new_acc = tmp; - } - } - } - accl = (struct acclist *)icc->account; - while (accl) { - tmp = accl->next; - g_free(accl); - accl = tmp; + if (!(acc = account_get(ic->irc->b, value))) { + return SET_INVALID; } - icc->account = (struct account *)new_acc; + icc->account = acc; if ((icc->type & IRC_CC_TYPE_MASK) == IRC_CC_TYPE_ACCOUNT) { bee_irc_channel_update(ic->irc, ic, NULL); } - g_strfreev(accounts); - - return g_strdup(value); - -fail: - accl = new_acc; - while (accl) { - tmp = accl->next; - g_free(accl); - accl = tmp; - } - - g_strfreev(accounts); - - return SET_INVALID; + return g_strdup(acc->tag); } static char *set_eval_fill_by(set_t *set, char *value) @@ -1044,7 +1000,6 @@ fail: gboolean irc_channel_wants_user(irc_channel_t *ic, irc_user_t *iu) { struct irc_control_channel *icc = ic->data; - struct acclist *accl; gboolean ret = FALSE; if (iu->bu == NULL) { @@ -1056,14 +1011,7 @@ gboolean irc_channel_wants_user(irc_channel_t *ic, irc_user_t *iu) ret = iu->bu->group == icc->group; break; case IRC_CC_TYPE_ACCOUNT: - accl = (struct acclist *)icc->account; - while (accl) { - if (iu->bu->ic->acc == accl->acc) { - ret = TRUE; - break; - } - accl = accl->next; - } + ret = iu->bu->ic->acc == icc->account; break; case IRC_CC_TYPE_PROTOCOL: ret = iu->bu->ic->acc->prpl == icc->protocol; @@ -1084,7 +1032,6 @@ gboolean irc_channel_wants_user(irc_channel_t *ic, irc_user_t *iu) static gboolean control_channel_free(irc_channel_t *ic) { struct irc_control_channel *icc = ic->data; - struct acclist *accl, *tmp; set_del(&ic->set, "account"); set_del(&ic->set, "fill_by"); @@ -1092,13 +1039,6 @@ static gboolean control_channel_free(irc_channel_t *ic) set_del(&ic->set, "protocol"); set_del(&ic->set, "show_users"); - accl = (struct acclist *)icc->account; - while (accl) { - tmp = accl->next; - g_free(accl); - accl = tmp; - } - g_free(icc); ic->data = NULL; |