summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorTingPing <tngpng@gmail.com>2013-03-21 15:02:32 -0700
committerTingPing <tngpng@gmail.com>2013-03-21 15:02:32 -0700
commitd37ef26104d3b302d983cf444595f8226e0bbb30 (patch)
tree41f38be53105089f26c84f619024618635af2205 /src/common
parentc5404b8e25afdc30b5bcafdd2a21b169443e00cc (diff)
parentec576f315aacd314fd2688a553efb9a14761a2c5 (diff)
Merge pull request #459 from RichardHitt/banlist1
Redesign the Ban List window.  Closes #303, closes #342, closes #427
Diffstat (limited to 'src/common')
-rw-r--r--src/common/fe.h5
-rw-r--r--src/common/hexchat.h1
-rw-r--r--src/common/inbound.c11
-rw-r--r--src/common/modes.c4
-rw-r--r--src/common/proto-irc.c33
-rw-r--r--src/common/server.c1
6 files changed, 41 insertions, 14 deletions
diff --git a/src/common/fe.h b/src/common/fe.h
index 4903ef0e..337c4b47 100644
--- a/src/common/fe.h
+++ b/src/common/fe.h
@@ -59,9 +59,8 @@ int fe_is_chanwindow (struct server *serv);
 void fe_add_chan_list (struct server *serv, char *chan, char *users,
 							  char *topic);
 void fe_chan_list_end (struct server *serv);
-int fe_is_banwindow (struct session *sess);
-void fe_add_ban_list (struct session *sess, char *mask, char *who, char *when, int is_exemption);
-void fe_ban_list_end (struct session *sess, int is_exemption);
+gboolean fe_add_ban_list (struct session *sess, char *mask, char *who, char *when, int rplcode);
+gboolean fe_ban_list_end (struct session *sess, int rplcode);
 void fe_notify_update (char *name);
 void fe_notify_ask (char *name, char *networks);
 void fe_text_clear (struct session *sess, int lines);
diff --git a/src/common/hexchat.h b/src/common/hexchat.h
index fcc77251..8e459306 100644
--- a/src/common/hexchat.h
+++ b/src/common/hexchat.h
@@ -575,6 +575,7 @@ typedef struct server
 	unsigned int have_idmsg:1;		/* freenode's IDENTIFY-MSG */
 	unsigned int have_sasl:1;		/* SASL capability */
 	unsigned int have_except:1;	/* ban exemptions +e */
+	unsigned int have_invite:1;	/* invite exemptions +I */
 	unsigned int using_cp1255:1;	/* encoding is CP1255/WINDOWS-1255? */
 	unsigned int using_irc:1;		/* encoding is "IRC" (CP1252/UTF-8 hybrid)? */
 	unsigned int use_who:1;			/* whether to use WHO command to get dcc_ip */
diff --git a/src/common/inbound.c b/src/common/inbound.c
index 898dcf4b..bd882aea 100644
--- a/src/common/inbound.c
+++ b/src/common/inbound.c
@@ -1272,12 +1272,14 @@ inbound_user_info (session *sess, char *chan, char *user, char *host,
 }
 
 int
-inbound_banlist (session *sess, time_t stamp, char *chan, char *mask, char *banner, int is_exemption)
+inbound_banlist (session *sess, time_t stamp, char *chan, char *mask, char *banner, int rplcode)
 {
 	char *time_str = ctime (&stamp);
 	server *serv = sess->server;
+	char *nl;
 
-	time_str[19] = 0;	/* get rid of the \n */
+	if ((nl = strchr (time_str, '\n')))
+		*nl = 0;
 	if (stamp == 0)
 		time_str = "";
 
@@ -1288,18 +1290,17 @@ inbound_banlist (session *sess, time_t stamp, char *chan, char *mask, char *bann
 		goto nowindow;
 	}
 
-   if (!fe_is_banwindow (sess))
+	if (!fe_add_ban_list (sess, mask, banner, time_str, rplcode))
 	{
 nowindow:
 		/* let proto-irc.c do the 'goto def' for exemptions */
-		if (is_exemption)
+		if (rplcode != 367)	/* RPL_EXCEPTLIST */
 			return FALSE;
 
 		EMIT_SIGNAL (XP_TE_BANLIST, sess, chan, mask, banner, time_str, 0);
 		return TRUE;
 	}
 
-	fe_add_ban_list (sess, mask, banner, time_str, is_exemption);
 	return TRUE;
 }
 
diff --git a/src/common/modes.c b/src/common/modes.c
index 6caa46b9..7326b6fe 100644
--- a/src/common/modes.c
+++ b/src/common/modes.c
@@ -824,6 +824,10 @@ inbound_005 (server * serv, char *word[])
 #ifndef WIN32
 			serv->have_except = TRUE;
 #endif
+		} else if (strcmp (word[w], "INVEX") == 0)
+		{
+			/* supports mode letter +I, default channel invite */
+			serv->have_invite = TRUE;
 		} else if (strncmp (word[w], "ELIST=", 6) == 0)
 		{
 			/* supports LIST >< min/max user counts? */
diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c
index 18015607..13147016 100644
--- a/src/common/proto-irc.c
+++ b/src/common/proto-irc.c
@@ -778,8 +778,18 @@ process_numeric (session * sess, int n,
 		}
 		break;
 
+	case 346:	/* +I-list entry */
+		if (!inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], 346))
+			goto def;
+		break;
+
+	case 347:	/* end of invite list */
+		if (!fe_ban_list_end (sess, 347))
+			goto def;
+		break;
+
 	case 348:	/* +e-list entry */
-		if (!inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], TRUE))
+		if (!inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], 348))
 			goto def;
 		break;
 
@@ -790,9 +800,8 @@ process_numeric (session * sess, int n,
 			sess = serv->front_session;
 			goto def;
 		}
-		if (!fe_is_banwindow (sess))
+		if (!fe_ban_list_end (sess, 349))
 			goto def;
-		fe_ban_list_end (sess, TRUE);
 		break;
 
 	case 353:						  /* NAMES */
@@ -806,7 +815,8 @@ process_numeric (session * sess, int n,
 		break;
 
 	case 367: /* banlist entry */
-		inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], FALSE);
+		if (!inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], 367))
+			goto def;
 		break;
 
 	case 368:
@@ -816,9 +826,8 @@ process_numeric (session * sess, int n,
 			sess = serv->front_session;
 			goto def;
 		}
-		if (!fe_is_banwindow (sess))
+		if (!fe_ban_list_end (sess, 368))
 			goto def;
-		fe_ban_list_end (sess, FALSE);
 		break;
 
 	case 369:	/* WHOWAS end */
@@ -881,6 +890,18 @@ process_numeric (session * sess, int n,
 		notify_set_online (serv, word[4]);
 		break;
 
+	case 728:	/* +q-list entry */
+		/* NOTE:  FREENODE returns these results inconsistent with e.g. +b */
+		/* Who else has imlemented MODE_QUIET, I wonder? */
+		if (!inbound_banlist (sess, atol (word[8]), word[4], word[6], word[7], 728))
+			goto def;
+		break;
+
+	case 729:	/* end of quiet list */
+		if (!fe_ban_list_end (sess, 729))
+			goto def;
+		break;
+
 	case 903:	/* successful SASL auth */
 	case 904:	/* aborted SASL auth */
 	case 905:	/* failed SASL auth */
diff --git a/src/common/server.c b/src/common/server.c
index 42cae85f..8ad1d6ca 100644
--- a/src/common/server.c
+++ b/src/common/server.c
@@ -1890,6 +1890,7 @@ server_set_defaults (server *serv)
 	serv->have_idmsg = FALSE;
 	serv->have_sasl = FALSE;
 	serv->have_except = FALSE;
+	serv->have_invite = FALSE;
 }
 
 char *