Package: xchat-gnome
Version: 0.18-2
Severity: whishlist

Hi,

it would be nice to be able to have a whitelist for the msg flood detection for
important things.
Because a patch says more than a thousand words, I attach a proof of concept.

Kind regards

T.
-- 
Thomas Viehmann, http://thomas.viehmann.net/

diff -urN xchat-gnome-0.18~/src/common/cfgfiles.c xchat-gnome-0.18/src/common/cfgfiles.c
--- xchat-gnome-0.18~/src/common/cfgfiles.c	2007-06-13 02:03:17.000000000 +0200
+++ xchat-gnome-0.18/src/common/cfgfiles.c	2008-02-08 18:33:21.000000000 +0100
@@ -415,6 +415,7 @@
 	{"flood_ctcp_time", P_OFFINT (ctcp_time_limit), TYPE_INT},
 	{"flood_msg_num", P_OFFINT (msg_number_limit), TYPE_INT},
 	{"flood_msg_time", P_OFFINT (msg_time_limit), TYPE_INT},
+	{"flood_msg_whitelist", P_OFFSET (msg_whitelist), TYPE_STR},
 
 	{"gui_auto_open_chat", P_OFFINT (autoopendccchatwindow), TYPE_BOOL},
 	{"gui_auto_open_dialog", P_OFFINT (autodialog), TYPE_BOOL},
diff -urN xchat-gnome-0.18~/src/common/ignore.c xchat-gnome-0.18/src/common/ignore.c
--- xchat-gnome-0.18~/src/common/ignore.c	2007-03-06 23:47:37.000000000 +0100
+++ xchat-gnome-0.18/src/common/ignore.c	2008-02-08 18:37:07.000000000 +0100
@@ -350,6 +350,7 @@
 	int i;
 	time_t current_time;
 	current_time = time (NULL);
+	char* j;
 
 	if (what == 0)
 	{
@@ -386,6 +387,11 @@
 		}
 	} else
 	{
+		if (((j = strstr(prefs.msg_whitelist, ip)) != NULL) &&
+		    ((j == prefs.msg_whitelist) || (*(j-1)==' ')) &&
+		    ((*(j += strlen(ip))=='\0' ) || (*(j += strlen(ip))==' ' ))) {
+			return 1;
+		}
 		if (serv->msg_last_time == 0)
 		{
 			serv->msg_last_time = time (NULL);
diff -urN xchat-gnome-0.18~/src/common/xchat.h xchat-gnome-0.18/src/common/xchat.h
--- xchat-gnome-0.18~/src/common/xchat.h	2007-06-13 02:03:19.000000000 +0200
+++ xchat-gnome-0.18/src/common/xchat.h	2008-02-08 18:34:59.000000000 +0100
@@ -295,6 +295,7 @@
 
 	unsigned int msg_number_limit;	/*same deal */
 	unsigned int msg_time_limit;
+	char msg_whitelist[1024];
 
 	/* Tells us if we need to save, only when they've been edited.
 		This is so that we continue using internal defaults (which can

Reply via email to