about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@lodoss.net>2013-09-18 23:51:44 +0100
committerAlexander Barton <alex@barton.de>2013-09-24 21:17:35 +0200
commitec5ab4fcd1bc361cacb56e999b2b8f0a00caf5a9 (patch)
tree3ea2056db0b965c5d4c0ee43e72efc8eebfe37ca /src
parent13a5358a3d9a439e2f6d70f7770d4b7673bfbbc1 (diff)
downloadngircd-ec5ab4fcd1bc361cacb56e999b2b8f0a00caf5a9.tar.gz
ngircd-ec5ab4fcd1bc361cacb56e999b2b8f0a00caf5a9.zip
Add support to show user links using "STATS L"
Change "stats L" to show servers and user links and restrict it to
IRC Operators.
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/irc-info.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/ngircd/irc-info.c b/src/ngircd/irc-info.c
index 1c250a44..79a157c2 100644
--- a/src/ngircd/irc-info.c
+++ b/src/ngircd/irc-info.c
@@ -41,6 +41,7 @@
 #include "irc-macros.h"
 #include "irc-write.h"
 #include "client-cap.h"
+#include "op.h"
 
 #include "exp.h"
 #include "irc-info.h"
@@ -865,6 +866,7 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
 	unsigned int days, hrs, mins;
 	struct list_head *list;
 	struct list_elem *list_item;
+	bool more_links = false;
 
 	assert(Client != NULL);
 	assert(Req != NULL);
@@ -909,16 +911,20 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
 				list_item = Lists_GetNext(list_item);
 			}
 		break;
+	case 'L':	/* Link status (servers and user links) */
+		if (!Op_Check(from, Req))
+			return Op_NoPrivileges(from, Req);
+		more_links = true;
+
 	case 'l':	/* Link status (servers and own link) */
-	case 'L':
 		time_now = time(NULL);
 		for (con = Conn_First(); con != NONE; con = Conn_Next(con)) {
 			cl = Conn_GetClient(con);
 			if (!cl)
 				continue;
-			if ((Client_Type(cl) == CLIENT_SERVER)
-			    || (cl == Client)) {
-				/* Server link or our own connection */
+			if (Client_Type(cl) == CLIENT_SERVER ||
+			    cl == Client ||
+			    (more_links && Client_Type(cl) == CLIENT_USER)) {
 #ifdef ZLIB
 				if (Conn_Options(con) & CONN_ZIP) {
 					if (!IRC_WriteStrClient