1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

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
This commit is contained in:
Timo Sirainen 2002-06-05 20:11:10 +00:00 committed by cras
parent d1e55d91b7
commit 5cfaa5bb7a
5 changed files with 20 additions and 9 deletions

View File

@ -45,6 +45,7 @@ noinst_HEADERS = \
completion.h \ completion.h \
fe-channels.h \ fe-channels.h \
fe-common-core.h \ fe-common-core.h \
fe-core-commands.h \
fe-exec.h \ fe-exec.h \
fe-messages.h \ fe-messages.h \
fe-queries.h \ fe-queries.h \

View File

@ -31,6 +31,7 @@
#include "servers-setup.h" #include "servers-setup.h"
#include "autorun.h" #include "autorun.h"
#include "fe-core-commands.h"
#include "fe-queries.h" #include "fe-queries.h"
#include "hilight-text.h" #include "hilight-text.h"
#include "command-history.h" #include "command-history.h"
@ -91,9 +92,6 @@ void fe_settings_deinit(void);
void window_commands_init(void); void window_commands_init(void);
void window_commands_deinit(void); void window_commands_deinit(void);
void fe_core_commands_init(void);
void fe_core_commands_deinit(void);
static void print_version(void) static void print_version(void)
{ {
printf(PACKAGE" " IRSSI_VERSION" (%d %04d)\n", printf(PACKAGE" " IRSSI_VERSION" (%d %04d)\n",

View File

@ -50,11 +50,12 @@ static int ret_texts[] = {
TXT_NOT_GOOD_IDEA TXT_NOT_GOOD_IDEA
}; };
int command_hide_output;
/* keep the whole command line here temporarily. we need it in /* 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 "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.. */ the line had one or two command chars, and which one.. */
static const char *current_cmdline; static const char *current_cmdline;
static int hide_output;
static GTimeVal time_command_last, time_command_now; static GTimeVal time_command_last, time_command_now;
static int last_command_cmd, command_cmd; 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); cmdchar = strchr(settings_get_str("cmdchars"), *data);
if (cmdchar != NULL && (data[1] == '^' || if (cmdchar != NULL && (data[1] == '^' ||
(data[1] == *cmdchar && data[2] == '^'))) { (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 starting", (SIGNAL_FUNC) sig_stop);
signal_add_first("print format", (SIGNAL_FUNC) sig_stop); signal_add_first("print format", (SIGNAL_FUNC) sig_stop);
signal_add_first("print text", (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) static void event_command_last(const char *data)
{ {
if (hide_output) { if (command_hide_output) {
hide_output = FALSE; command_hide_output = FALSE;
signal_remove("print starting", (SIGNAL_FUNC) sig_stop); signal_remove("print starting", (SIGNAL_FUNC) sig_stop);
signal_remove("print format", (SIGNAL_FUNC) sig_stop); signal_remove("print format", (SIGNAL_FUNC) sig_stop);
signal_remove("print text", (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) void fe_core_commands_init(void)
{ {
hide_output = FALSE; command_hide_output = FALSE;
command_cmd = FALSE; command_cmd = FALSE;
memset(&time_command_now, 0, sizeof(GTimeVal)); memset(&time_command_now, 0, sizeof(GTimeVal));

View File

@ -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

View File

@ -30,6 +30,7 @@
#include "servers.h" #include "servers.h"
#include "queries.h" #include "queries.h"
#include "fe-core-commands.h"
#include "fe-windows.h" #include "fe-windows.h"
#include "window-items.h" #include "window-items.h"
#include "printtext.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); g_return_val_if_fail(nick != NULL, NULL);
query = query_find(server, nick); 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"))) { (!own || settings_get_bool("autocreate_own_query"))) {
query = CHAT_PROTOCOL(server)-> query = CHAT_PROTOCOL(server)->
query_create(server->tag, nick, TRUE); query_create(server->tag, nick, TRUE);