From f71afe835a36d53644fff6ad4673059f1282cee5 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sat, 3 Mar 2001 21:51:57 +0000 Subject: [PATCH] /JOIN #channel and /QUERY nick won't anymore automatically move channel/query to active window but send a notice to user how to move it. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1325 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/core/fe-channels.c | 21 +++++++++++++++++++-- src/fe-common/core/fe-queries.c | 19 ++++++++++++++++--- src/fe-common/core/module-formats.c | 2 ++ src/fe-common/core/module-formats.h | 2 ++ 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/fe-common/core/fe-channels.c b/src/fe-common/core/fe-channels.c index f4de4846..791ad144 100644 --- a/src/fe-common/core/fe-channels.c +++ b/src/fe-common/core/fe-channels.c @@ -131,14 +131,31 @@ static void cmd_wjoin_pre(const char *data) static void cmd_join(const char *data, SERVER_REC *server) { + WINDOW_REC *window; CHANNEL_REC *channel; if (strchr(data, ' ') != NULL || strchr(data, ',') != NULL) return; channel = channel_find(server, data); - if (channel != NULL) - window_item_set_active(active_win, (WI_ITEM_REC *) channel); + if (channel == NULL) + return; + + window = window_item_window(channel); + + if (window == active_win) { + /* channel is in active window, set it active */ + window_item_set_active(active_win, + (WI_ITEM_REC *) channel); + } else { + /* notify user how to move the channel to active + window. this was used to be done automatically + but it just confused everyone who did it + accidentally */ + printformat_window(active_win, MSGLEVEL_CLIENTNOTICE, + TXT_CHANNEL_MOVE_NOTIFY, channel->name, + window->refnum); + } } static void cmd_wjoin_post(const char *data) diff --git a/src/fe-common/core/fe-queries.c b/src/fe-common/core/fe-queries.c index ce11dd31..e7b0eb7e 100644 --- a/src/fe-common/core/fe-queries.c +++ b/src/fe-common/core/fe-queries.c @@ -228,9 +228,22 @@ static void cmd_query(const char *data, SERVER_REC *server, WI_ITEM_REC *item) if (query == NULL) CHAT_PROTOCOL(server)->query_create(server->tag, nick, FALSE); else { - /* query already existed - set query active / move it to this - window */ - window_item_set_active(active_win, (WI_ITEM_REC *) query); + /* query already exists */ + WINDOW_REC *window = window_item_window(query); + + if (window == active_win) { + /* query is in active window, set it active */ + window_item_set_active(active_win, + (WI_ITEM_REC *) query); + } else { + /* notify user how to move the query to active + window. this was used to be done automatically + but it just confused everyone who did it + accidentally */ + printformat_window(active_win, MSGLEVEL_CLIENTNOTICE, + TXT_QUERY_MOVE_NOTIFY, query->name, + window->refnum); + } } if (g_hash_table_lookup(optlist, "window") != NULL) { diff --git a/src/fe-common/core/module-formats.c b/src/fe-common/core/module-formats.c index 5b062612..a25e8e01 100644 --- a/src/fe-common/core/module-formats.c +++ b/src/fe-common/core/module-formats.c @@ -94,6 +94,7 @@ FORMAT_REC fecommon_core_formats[] = { { "chansetup_header", "Channel IRC net Password Settings", 0 }, { "chansetup_line", "{channel $[15]0} %|$[10]1 $[10]2 $3", 4, { 0, 0, 0, 0 } }, { "chansetup_footer", "", 0 }, + { "channel_move_notify", "{channel $0} is already joined in window $1, use \"/WINDOW ITEM MOVE $0\" to move it to this window", 2, { 0, 1 } }, /* ---- */ { NULL, "Messages", 0 }, @@ -119,6 +120,7 @@ FORMAT_REC fecommon_core_formats[] = { { "query_start", "Starting query with {nick $0}", 1, { 0 } }, { "no_query", "No query with {nick $0}", 1, { 0 } }, { "query_server_changed", "Query with {nick $0} changed to server {server $1}", 2, { 0, 0 } }, + { "query_move_notify", "Query with {nick $0} is already created to window $1, use \"/WINDOW ITEM MOVE $0\" to move it to this window", 2, { 0, 1 } }, /* ---- */ { NULL, "Highlighting", 0 }, diff --git a/src/fe-common/core/module-formats.h b/src/fe-common/core/module-formats.h index 2b634833..1818041c 100644 --- a/src/fe-common/core/module-formats.h +++ b/src/fe-common/core/module-formats.h @@ -70,6 +70,7 @@ enum { TXT_CHANSETUP_HEADER, TXT_CHANSETUP_LINE, TXT_CHANSETUP_FOOTER, + TXT_CHANNEL_MOVE_NOTIFY, TXT_FILL_4, @@ -93,6 +94,7 @@ enum { TXT_QUERY_STARTED, TXT_NO_QUERY, TXT_QUERY_SERVER_CHANGED, + TXT_QUERY_MOVE_NOTIFY, TXT_FILL_6,