Commit Diff


commit - dc9fcb0fb2716757ef336e60febeb58f59325388
commit + fc82efc3e8931e1670972e594140e03671370c1f
blob - 301da5337d32430592cfe1fe9e88838064b1c232
blob + 736412f1fcdde91459540de1b51df995b2003e70
--- src/ngircd/irc-info.c
+++ src/ngircd/irc-info.c
@@ -28,8 +28,10 @@
 #include "conn-func.h"
 #include "conn-zip.h"
 #include "channel.h"
+#include "class.h"
 #include "conf.h"
 #include "defines.h"
+#include "lists.h"
 #include "log.h"
 #include "messages.h"
 #include "match.h"
@@ -478,6 +480,8 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
 	COMMAND *cmd;
 	time_t time_now;
 	unsigned int days, hrs, mins;
+	struct list_head list;
+	struct list_elem *list_item;
 
 	assert(Client != NULL);
 	assert(Req != NULL);
@@ -516,6 +520,28 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
 		query = '*';
 
 	switch (query) {
+	case 'g':	/* Network-wide bans ("G-Lines") */
+	case 'G':
+	case 'k':	/* Server-local bans ("K-Lines") */
+	case 'K':
+		if (!Client_HasMode(from, 'o'))
+		    return IRC_WriteStrClient(from, ERR_NOPRIVILEGES_MSG,
+					      Client_ID(from));
+		if (query == 'g' || query == 'G')
+			list = Class_GetList(CLASS_GLINE);
+		else
+			list = Class_GetList(CLASS_KLINE);
+			list_item = Lists_GetFirst(&list);
+			while (list_item) {
+				if (!IRC_WriteStrClient(from, RPL_STATSXLINE_MSG,
+						Client_ID(from), query,
+						Lists_GetMask(list_item),
+						Lists_GetValidity(list_item),
+						Lists_GetReason(list_item)))
+					return DISCONNECTED;
+				list_item = Lists_GetNext(list_item);
+			}
+		break;
 	case 'l':	/* Link status (servers and own link) */
 	case 'L':
 		time_now = time(NULL);
blob - 78ac06893c6347e4c0fe9871d314c9eb5e176ff8
blob + 7bf7367e56ea03a671c55ba4a5c3382f3c975233
--- src/ngircd/messages.h
+++ src/ngircd/messages.h
@@ -29,6 +29,7 @@
 #define RPL_TRACESERVER_MSG		"206 %s Serv 1 0S 0C %s[%s@%s] *!*@%s :V%s"
 #define RPL_STATSLINKINFO_MSG		"211 %s %s %d %ld %ld %ld %ld :%ld"
 #define RPL_STATSCOMMANDS_MSG		"212 %s %s %ld %ld %ld"
+#define RPL_STATSXLINE_MSG		"216 %s %c %s %ld :%s"
 #define RPL_ENDOFSTATS_MSG		"219 %s %c :End of STATS report"
 #define RPL_UMODEIS_MSG			"221 %s +%s"
 #define RPL_SERVLIST_MSG		"234 %s %s %s %s %d %d :%s"