summaryrefslogtreecommitdiff
path: root/src/fe-common
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-02-15 14:54:00 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-02-15 14:54:00 +0000
commitd84c0540245b4681861add6a8356a1f6bff60ad6 (patch)
tree58df73c4e6d004d0d0edf0bc1de38328f2024d61 /src/fe-common
parent9d1506ebca9f9c695b6a2d042fd93412a478256f (diff)
downloadirssi-d84c0540245b4681861add6a8356a1f6bff60ad6.zip
Added /SET window_check_level_first and /SET window_default_level. This allows you to keep all messages with specific level in it's own window, even if it was supposed to be printed in channel window. patch by mike@po.cs.msu.su
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2452 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common')
-rw-r--r--src/fe-common/core/fe-windows.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/fe-common/core/fe-windows.c b/src/fe-common/core/fe-windows.c
index d3f068e5..985d05c4 100644
--- a/src/fe-common/core/fe-windows.c
+++ b/src/fe-common/core/fe-windows.c
@@ -70,6 +70,7 @@ WINDOW_REC *window_create(WI_ITEM_REC *item, int automatic)
rec = g_new0(WINDOW_REC, 1);
rec->refnum = window_get_new_refnum();
+ rec->level = level2bits(settings_get_str("window_default_level"));
windows = g_slist_prepend(windows, rec);
signal_emit("window created", 2, rec, GINT_TO_POINTER(automatic));
@@ -259,14 +260,18 @@ WINDOW_REC *window_find_level(void *server, int level)
WINDOW_REC *window_find_closest(void *server, const char *name, int level)
{
- WINDOW_REC *window;
+ WINDOW_REC *window,*namewindow=NULL;
WI_ITEM_REC *item;
/* match by name */
item = name == NULL ? NULL :
window_item_find(server, name);
- if (item != NULL)
- return window_item_window(item);
+ if (item != NULL) {
+ namewindow = window_item_window(item);
+ if (namewindow != NULL && ((namewindow->level & level) != 0 ||
+ !settings_get_bool("window_check_level_first")))
+ return namewindow;
+ }
/* match by level */
if (level != MSGLEVEL_HILIGHT)
@@ -278,6 +283,9 @@ WINDOW_REC *window_find_closest(void *server, const char *name, int level)
window = window_find_level(NULL, level);
if (window != NULL) return window;
+ /* still return item's window if we didnt find anything */
+ if (namewindow != NULL) return namewindow;
+
/* fallback to active */
return active_win;
}
@@ -602,6 +610,8 @@ void windows_init(void)
daycheck = 0; daytag = -1;
settings_add_bool("lookandfeel", "window_auto_change", FALSE);
settings_add_bool("lookandfeel", "windows_auto_renumber", TRUE);
+ settings_add_bool("lookandfeel", "window_check_level_first", FALSE);
+ settings_add_str("lookandfeel", "window_default_level", "NONE");
read_settings();
signal_add("server looking", (SIGNAL_FUNC) sig_server_looking);