diff --git a/src/fe-common/core/Makefile.am b/src/fe-common/core/Makefile.am index 962b4f5b..711f6455 100644 --- a/src/fe-common/core/Makefile.am +++ b/src/fe-common/core/Makefile.am @@ -13,6 +13,7 @@ libfe_common_core_a_SOURCES = \ fe-channels.c \ fe-common-core.c \ fe-core-commands.c \ + fe-ignore.c \ fe-log.c \ fe-messages.c \ fe-modules.c \ diff --git a/src/fe-common/core/fe-common-core.c b/src/fe-common/core/fe-common-core.c index f3828b2a..32de1e9e 100644 --- a/src/fe-common/core/fe-common-core.c +++ b/src/fe-common/core/fe-common-core.c @@ -46,6 +46,9 @@ void fe_channels_deinit(void); void fe_core_log_init(void); void fe_core_log_deinit(void); +void fe_ignore_init(void); +void fe_ignore_deinit(void); + void fe_log_init(void); void fe_log_deinit(void); @@ -100,6 +103,7 @@ void fe_common_core_init(void) printtext_init(); fe_channels_init(); fe_queries_init(); + fe_ignore_init(); fe_log_init(); fe_messages_init(); fe_modules_init(); @@ -125,6 +129,7 @@ void fe_common_core_deinit(void) fe_channels_deinit(); fe_queries_deinit(); fe_messages_deinit(); + fe_ignore_deinit(); fe_log_deinit(); fe_modules_deinit(); fe_server_deinit(); diff --git a/src/fe-common/irc/fe-ignore.c b/src/fe-common/core/fe-ignore.c similarity index 95% rename from src/fe-common/irc/fe-ignore.c rename to src/fe-common/core/fe-ignore.c index 5869b3bc..051d7767 100644 --- a/src/fe-common/irc/fe-ignore.c +++ b/src/fe-common/core/fe-ignore.c @@ -25,8 +25,7 @@ #include "levels.h" #include "misc.h" -#include "irc.h" -#include "irc-servers.h" +#include "servers.h" #include "ignore.h" static void fe_unignore(IGNORE_REC *rec); @@ -175,7 +174,8 @@ static void cmd_ignore(const char *data) if (*levels == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); - if (ischannel(*mask)) { + if (active_win->active_server != NULL && + active_win->active_server->ischannel(*mask)) { chanarg = mask; mask = NULL; } @@ -251,6 +251,9 @@ static void cmd_unignore(const char *data) IGNORE_REC *rec; GSList *tmp; + if (*data == '\0') + cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS); + if (is_numeric(data, ' ')) { /* with index number */ tmp = g_slist_nth(ignores, atoi(data)-1); @@ -259,8 +262,12 @@ static void cmd_unignore(const char *data) /* with mask */ const char *chans[2] = { "*", NULL }; - if (ischannel(*data)) chans[0] = data; - rec = ignore_find("*", ischannel(*data) ? NULL : data, (char **) chans); + if (active_win->active_server != NULL && + active_win->active_server->ischannel(*data)) { + chans[0] = data; + data = NULL; + } + rec = ignore_find("*", data, (char **) chans); } if (rec == NULL) diff --git a/src/fe-common/core/module-formats.c b/src/fe-common/core/module-formats.c index 905e5965..ee4c99d8 100644 --- a/src/fe-common/core/module-formats.c +++ b/src/fe-common/core/module-formats.c @@ -182,6 +182,17 @@ FORMAT_REC fecommon_core_formats[] = { { "format_subtitle", "%K[%W$0%K]", 1, { 0 } }, { "format_item", "$0 %K=%n $1", 2, { 0, 0 } }, + /* ---- */ + { NULL, "Ignores", 0 }, + + { "ignored", "Ignoring %_$1%_ from %_$0%_", 2, { 0, 0 } }, + { "unignored", "Unignored %_$0%_", 1, { 0 } }, + { "ignore_not_found", "%_$0%_ is not being ignored", 1, { 0 } }, + { "ignore_no_ignores", "There are no ignores", 0 }, + { "ignore_header", "Ignorance List:", 0 }, + { "ignore_line", "$[-4]0 $1: $2 $3 $4", 4, { 1, 0, 0, 0 } }, + { "ignore_footer", "", 0 }, + /* ---- */ { NULL, "Misc", 0 }, diff --git a/src/fe-common/core/module-formats.h b/src/fe-common/core/module-formats.h index b25cf7b5..01390a15 100644 --- a/src/fe-common/core/module-formats.h +++ b/src/fe-common/core/module-formats.h @@ -152,6 +152,16 @@ enum { IRCTXT_FILL_12, + IRCTXT_IGNORED, + IRCTXT_UNIGNORED, + IRCTXT_IGNORE_NOT_FOUND, + IRCTXT_IGNORE_NO_IGNORES, + IRCTXT_IGNORE_HEADER, + IRCTXT_IGNORE_LINE, + IRCTXT_IGNORE_FOOTER, + + IRCTXT_FILL_13, + IRCTXT_NOT_TOGGLE, IRCTXT_PERL_ERROR, IRCTXT_BIND_KEY, diff --git a/src/fe-common/irc/Makefile.am b/src/fe-common/irc/Makefile.am index 9e3055c1..759d017b 100644 --- a/src/fe-common/irc/Makefile.am +++ b/src/fe-common/irc/Makefile.am @@ -19,7 +19,6 @@ libfe_common_irc_a_SOURCES = \ fe-ctcp.c \ fe-events.c \ fe-events-numeric.c \ - fe-ignore.c \ fe-netjoin.c \ fe-netsplit.c \ fe-common-irc.c \ diff --git a/src/fe-common/irc/fe-common-irc.c b/src/fe-common/irc/fe-common-irc.c index 8410623f..39c0a2c9 100644 --- a/src/fe-common/irc/fe-common-irc.c +++ b/src/fe-common/irc/fe-common-irc.c @@ -55,9 +55,6 @@ void fe_events_deinit(void); void fe_events_numeric_init(void); void fe_events_numeric_deinit(void); -void fe_ignore_init(void); -void fe_ignore_deinit(void); - void irc_completion_init(void); void irc_completion_deinit(void); @@ -105,7 +102,6 @@ void fe_common_irc_init(void) fe_ctcp_init(); fe_events_init(); fe_events_numeric_init(); - fe_ignore_init(); fe_netsplit_init(); fe_netjoin_init(); irc_completion_init(); @@ -124,7 +120,6 @@ void fe_common_irc_deinit(void) fe_ctcp_deinit(); fe_events_deinit(); fe_events_numeric_deinit(); - fe_ignore_deinit(); fe_netsplit_deinit(); fe_netjoin_deinit(); irc_completion_deinit(); diff --git a/src/fe-common/irc/module-formats.c b/src/fe-common/irc/module-formats.c index d5b44252..d71152f9 100644 --- a/src/fe-common/irc/module-formats.c +++ b/src/fe-common/irc/module-formats.c @@ -155,13 +155,5 @@ FORMAT_REC fecommon_irc_formats[] = { { "unsilenced", "Unsilenced %_$0%_", 1, { 0 } }, { "silence_line", "%_$0%_: silence %c$1", 2, { 0, 0 } }, - { "ignored", "Ignoring %_$1%_ from %_$0%_", 2, { 0, 0 } }, - { "unignored", "Unignored %_$0%_", 1, { 0 } }, - { "ignore_not_found", "%_$0%_ is not being ignored", 1, { 0 } }, - { "ignore_no_ignores", "There are no ignores", 0 }, - { "ignore_header", "Ignorance List:", 0 }, - { "ignore_line", "$[-4]0 $1: $2 $3 $4", 4, { 1, 0, 0, 0 } }, - { "ignore_footer", "", 0 }, - { NULL, NULL, 0 } }; diff --git a/src/fe-common/irc/module-formats.h b/src/fe-common/irc/module-formats.h index f7111060..46e91322 100644 --- a/src/fe-common/irc/module-formats.h +++ b/src/fe-common/irc/module-formats.h @@ -123,15 +123,7 @@ enum { IRCTXT_SILENCED, IRCTXT_UNSILENCED, - IRCTXT_SILENCE_LINE, - - IRCTXT_IGNORED, - IRCTXT_UNIGNORED, - IRCTXT_IGNORE_NOT_FOUND, - IRCTXT_IGNORE_NO_IGNORES, - IRCTXT_IGNORE_HEADER, - IRCTXT_IGNORE_LINE, - IRCTXT_IGNORE_FOOTER + IRCTXT_SILENCE_LINE }; extern FORMAT_REC fecommon_irc_formats[];