diff options
-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; |