From 5cfaa5bb7afd44dca2759977ad71349f44ac5014 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 5 Jun 2002 20:11:10 +0000 Subject: [PATCH] Finally - /^msg nick never autocreates an empty window anymore. Added new extern int command_hide_output which can be used to check if /^ was used. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2839 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/core/Makefile.am | 1 + src/fe-common/core/fe-common-core.c | 4 +--- src/fe-common/core/fe-core-commands.c | 11 ++++++----- src/fe-common/core/fe-core-commands.h | 9 +++++++++ src/fe-common/core/fe-queries.c | 4 +++- 5 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 src/fe-common/core/fe-core-commands.h diff --git a/src/fe-common/core/Makefile.am b/src/fe-common/core/Makefile.am index 201c9c0c..98f220c7 100644 --- a/src/fe-common/core/Makefile.am +++ b/src/fe-common/core/Makefile.am @@ -45,6 +45,7 @@ noinst_HEADERS = \ completion.h \ fe-channels.h \ fe-common-core.h \ + fe-core-commands.h \ fe-exec.h \ fe-messages.h \ fe-queries.h \ diff --git a/src/fe-common/core/fe-common-core.c b/src/fe-common/core/fe-common-core.c index 94e18fc1..ddac0fa3 100644 --- a/src/fe-common/core/fe-common-core.c +++ b/src/fe-common/core/fe-common-core.c @@ -31,6 +31,7 @@ #include "servers-setup.h" #include "autorun.h" +#include "fe-core-commands.h" #include "fe-queries.h" #include "hilight-text.h" #include "command-history.h" @@ -91,9 +92,6 @@ void fe_settings_deinit(void); void window_commands_init(void); void window_commands_deinit(void); -void fe_core_commands_init(void); -void fe_core_commands_deinit(void); - static void print_version(void) { printf(PACKAGE" " IRSSI_VERSION" (%d %04d)\n", diff --git a/src/fe-common/core/fe-core-commands.c b/src/fe-common/core/fe-core-commands.c index d50b23e5..366dbc04 100644 --- a/src/fe-common/core/fe-core-commands.c +++ b/src/fe-common/core/fe-core-commands.c @@ -50,11 +50,12 @@ static int ret_texts[] = { TXT_NOT_GOOD_IDEA }; +int command_hide_output; + /* keep the whole command line here temporarily. we need it in "default command" event handler, but there we don't know if the start of the line had one or two command chars, and which one.. */ static const char *current_cmdline; -static int hide_output; static GTimeVal time_command_last, time_command_now; static int last_command_cmd, command_cmd; @@ -218,7 +219,7 @@ static void event_command(const char *data) cmdchar = strchr(settings_get_str("cmdchars"), *data); if (cmdchar != NULL && (data[1] == '^' || (data[1] == *cmdchar && data[2] == '^'))) { - hide_output = TRUE; + command_hide_output = TRUE; signal_add_first("print starting", (SIGNAL_FUNC) sig_stop); signal_add_first("print format", (SIGNAL_FUNC) sig_stop); signal_add_first("print text", (SIGNAL_FUNC) sig_stop); @@ -227,8 +228,8 @@ static void event_command(const char *data) static void event_command_last(const char *data) { - if (hide_output) { - hide_output = FALSE; + if (command_hide_output) { + command_hide_output = FALSE; signal_remove("print starting", (SIGNAL_FUNC) sig_stop); signal_remove("print format", (SIGNAL_FUNC) sig_stop); signal_remove("print text", (SIGNAL_FUNC) sig_stop); @@ -318,7 +319,7 @@ static void event_list_subcommands(const char *command) void fe_core_commands_init(void) { - hide_output = FALSE; + command_hide_output = FALSE; command_cmd = FALSE; memset(&time_command_now, 0, sizeof(GTimeVal)); diff --git a/src/fe-common/core/fe-core-commands.h b/src/fe-common/core/fe-core-commands.h new file mode 100644 index 00000000..261303de --- /dev/null +++ b/src/fe-common/core/fe-core-commands.h @@ -0,0 +1,9 @@ +#ifndef __FE_CORE_COMMANDS_H +#define __FE_CORE_COMMANDS_H + +extern int command_hide_output; + +void fe_core_commands_init(void); +void fe_core_commands_deinit(void); + +#endif diff --git a/src/fe-common/core/fe-queries.c b/src/fe-common/core/fe-queries.c index 93f13040..762aa034 100644 --- a/src/fe-common/core/fe-queries.c +++ b/src/fe-common/core/fe-queries.c @@ -30,6 +30,7 @@ #include "servers.h" #include "queries.h" +#include "fe-core-commands.h" #include "fe-windows.h" #include "window-items.h" #include "printtext.h" @@ -46,7 +47,8 @@ QUERY_REC *privmsg_get_query(SERVER_REC *server, const char *nick, g_return_val_if_fail(nick != NULL, NULL); query = query_find(server, nick); - if (query == NULL && (querycreate_level & level) != 0 && + if (query == NULL && !command_hide_output && + (querycreate_level & level) != 0 && (!own || settings_get_bool("autocreate_own_query"))) { query = CHAT_PROTOCOL(server)-> query_create(server->tag, nick, TRUE);