summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-10-14 17:25:21 -0400
committerTingPing <tingping@tingping.se>2013-10-14 17:25:21 -0400
commit490b9a91e4e17ef1efad992a315ad264293907cf (patch)
tree9b7eccfbd0f2b97f6b52af8c87dd22a0627ae3c4 /src/common
parent80cbc74b2b97e637822449600805752e8b399beb (diff)
Don't overwrite existing ignores when flooded
Closes #792
Diffstat (limited to 'src/common')
-rw-r--r--src/common/ignore.c17
-rw-r--r--src/common/ignore.h2
-rw-r--r--src/common/outbound.c2
3 files changed, 10 insertions, 11 deletions
diff --git a/src/common/ignore.c b/src/common/ignore.c
index 5bd6a6a5..045224ba 100644
--- a/src/common/ignore.c
+++ b/src/common/ignore.c
@@ -77,7 +77,7 @@ ignore_exists (char *mask)
  */
 
 int
-ignore_add (char *mask, int type)
+ignore_add (char *mask, int type, gboolean overwrite)
 {
 	struct ignore *ig = 0;
 	int change_only = FALSE;
@@ -94,7 +94,11 @@ ignore_add (char *mask, int type)
 		return 0;
 
 	ig->mask = strdup (mask);
-	ig->type = type;
+
+	if (!overwrite && change_only)
+		ig->type |= type;
+	else
+		ig->type = type;
 
 	if (!change_only)
 		ignore_list = g_slist_prepend (ignore_list, ig);
@@ -376,16 +380,14 @@ flood_check (char *nick, char *ip, server *serv, session *sess, int what)	/*0=ct
 						if (ip[i] == '@')
 							break;
 					snprintf (real_ip, sizeof (real_ip), "*!*%s", &ip[i]);
-					/*ignore_add (char *mask, int priv, int noti, int chan,
-					   int ctcp, int invi, int unignore, int no_save) */
 
 					snprintf (buf, sizeof (buf),
 								 _("You are being CTCP flooded from %s, ignoring %s\n"),
 								 nick, real_ip);
 					PrintText (sess, buf);
 
-					/*FIXME: only ignore ctcp or all?, its ignoring ctcps for now */
-					ignore_add (real_ip, IG_CTCP);
+					/* ignore CTCP */
+					ignore_add (real_ip, IG_CTCP, FALSE);
 					return 0;
 				}
 			}
@@ -410,12 +412,9 @@ flood_check (char *nick, char *ip, server *serv, session *sess, int what)	/*0=ct
 					PrintText (sess, buf);
 					serv->msg_last_time = current_time;	/*we got the flood, restore all the vars for next one */
 					serv->msg_counter = 0;
-					/*ignore_add (char *mask, int priv, int noti, int chan,
-					   int ctcp, int invi, int unignore, int no_save) */
 
 					if (prefs.hex_gui_autoopen_dialog)
 					{
-						/*FIXME: only ignore ctcp or all?, its ignoring ctcps for now */
 						prefs.hex_gui_autoopen_dialog = 0;
 						/* turn it back on in 30 secs */
 						fe_timeout_add (30000, flood_autodialog_timeout, NULL);
diff --git a/src/common/ignore.h b/src/common/ignore.h
index 3263a940..674e6285 100644
--- a/src/common/ignore.h
+++ b/src/common/ignore.h
@@ -44,7 +44,7 @@ struct ignore
 };
 
 struct ignore *ignore_exists (char *mask);
-int ignore_add (char *mask, int type);
+int ignore_add (char *mask, int type, gboolean overwrite);
 void ignore_showlist (session *sess);
 int ignore_del (char *mask, struct ignore *ig);
 int ignore_check (char *mask, int type);
diff --git a/src/common/outbound.c b/src/common/outbound.c
index b4a8f4d4..4257912c 100644
--- a/src/common/outbound.c
+++ b/src/common/outbound.c
@@ -2278,7 +2278,7 @@ cmd_ignore (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 				snprintf (tbuf, TBUFSIZE, "%s!*@*", word[2]);
 			}
 
-			i = ignore_add (mask, type);
+			i = ignore_add (mask, type, TRUE);
 			if (quiet)
 				return TRUE;
 			switch (i)