summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorTingPing <tngpng@gmail.com>2013-03-14 13:29:53 -0700
committerTingPing <tngpng@gmail.com>2013-03-14 13:29:53 -0700
commit8cd2921387de2986c17d341e420c083bef4838f8 (patch)
treed83ecbd9514f9800e76c85ed6c6f7864acb46a49 /src/common
parentcd2f775fe47ee91262e17c7299e0e6b135caa86b (diff)
parent1d41eda1015301afd11483dd1271e5af71a37676 (diff)
Merge pull request #444 from TingPing/noticepos2
Add irc_notice_pos setting
Diffstat (limited to 'src/common')
-rw-r--r--src/common/cfgfiles.c2
-rw-r--r--src/common/hexchat.h2
-rw-r--r--src/common/inbound.c42
3 files changed, 25 insertions, 21 deletions
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c
index 9aac5a4f..5ea6d42c 100644
--- a/src/common/cfgfiles.c
+++ b/src/common/cfgfiles.c
@@ -450,7 +450,6 @@ const struct prefs vars[] =
 	{"gui_tab_icons", P_OFFINT (hex_gui_tab_icons), TYPE_BOOL},
 	{"gui_tab_layout", P_OFFINT (hex_gui_tab_layout), TYPE_INT},
 	{"gui_tab_newtofront", P_OFFINT (hex_gui_tab_newtofront), TYPE_INT},
-	{"gui_tab_notices", P_OFFINT (hex_gui_tab_notices), TYPE_BOOL},
 	{"gui_tab_pos", P_OFFINT (hex_gui_tab_pos), TYPE_INT},
 	{"gui_tab_server", P_OFFINT (hex_gui_tab_server), TYPE_BOOL},
 	{"gui_tab_small", P_OFFINT (hex_gui_tab_small), TYPE_INT},
@@ -523,6 +522,7 @@ const struct prefs vars[] =
 	{"irc_nick3", P_OFFSET (hex_irc_nick3), TYPE_STR},
 	{"irc_nick_hilight", P_OFFSET (hex_irc_nick_hilight), TYPE_STR},
 	{"irc_no_hilight", P_OFFSET (hex_irc_no_hilight), TYPE_STR},
+	{"irc_notice_pos", P_OFFINT (hex_irc_notice_pos), TYPE_INT},
 	{"irc_part_reason", P_OFFSET (hex_irc_part_reason), TYPE_STR},
 	{"irc_quit_reason", P_OFFSET (hex_irc_quit_reason), TYPE_STR},
 	{"irc_raw_modes", P_OFFINT (hex_irc_raw_modes), TYPE_BOOL},
diff --git a/src/common/hexchat.h b/src/common/hexchat.h
index dfd2fd5a..fcc77251 100644
--- a/src/common/hexchat.h
+++ b/src/common/hexchat.h
@@ -146,7 +146,6 @@ struct hexchatprefs
 	unsigned int hex_gui_tab_dialogs;
 	unsigned int hex_gui_tab_dots;
 	unsigned int hex_gui_tab_icons;
-	unsigned int hex_gui_tab_notices;
 	unsigned int hex_gui_tab_server;
 	unsigned int hex_gui_tab_sort;
 	unsigned int hex_gui_tab_utils;
@@ -276,6 +275,7 @@ struct hexchatprefs
 	int hex_input_balloon_time;
 	int hex_irc_ban_type;
 	int hex_irc_join_delay;
+	int hex_irc_notice_pos;
 	int hex_net_ping_timeout;
 	int hex_net_proxy_port;
 	int hex_net_proxy_type;				/* 0=disabled, 1=wingate 2=socks4, 3=socks5, 4=http */
diff --git a/src/common/inbound.c b/src/common/inbound.c
index d5c47b8f..898dcf4b 100644
--- a/src/common/inbound.c
+++ b/src/common/inbound.c
@@ -867,7 +867,27 @@ inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip, int id)
 	if (!sess)
 	{
 		ptr = 0;
-		if (prefs.hex_gui_tab_notices)
+		if (prefs.hex_irc_notice_pos == 0)
+		{
+											/* paranoia check */
+			if (msg[0] == '[' && (!serv->have_idmsg || id))
+			{
+				/* guess where chanserv meant to post this -sigh- */
+				if (!g_ascii_strcasecmp (nick, "ChanServ") && !find_dialog (serv, nick))
+				{
+					char *dest = strdup (msg + 1);
+					char *end = strchr (dest, ']');
+					if (end)
+					{
+						*end = 0;
+						sess = find_channel (serv, dest);
+					}
+					free (dest);
+				}
+			}
+			if (!sess)
+				sess = find_session_from_nick (nick, serv);
+		} else if (prefs.hex_irc_notice_pos == 1)
 		{
 			int stype = server_notice ? SESS_SNOTICES : SESS_NOTICES;
 			sess = find_session_from_type (stype, serv);
@@ -888,25 +908,9 @@ inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip, int id)
 				msg += 14;
 		} else
 		{
-											/* paranoia check */
-			if (msg[0] == '[' && (!serv->have_idmsg || id))
-			{
-				/* guess where chanserv meant to post this -sigh- */
-				if (!g_ascii_strcasecmp (nick, "ChanServ") && !find_dialog (serv, nick))
-				{
-					char *dest = strdup (msg + 1);
-					char *end = strchr (dest, ']');
-					if (end)
-					{
-						*end = 0;
-						sess = find_channel (serv, dest);
-					}
-					free (dest);
-				}
-			}
-			if (!sess)
-				sess = find_session_from_nick (nick, serv);
+			sess = serv->front_session;
 		}
+
 		if (!sess)
 		{
 			if (server_notice)