about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2013-02-03 21:32:53 +0100
committerAlexander Barton <alex@barton.de>2013-02-03 21:32:53 +0100
commit84a599ece472c4f2ef6d2f553addf898e0ed73f9 (patch)
tree8b5a89ee95c79f0b656bda3416b678d8d56cd5b7
parent999c11ad49ea1e9c2615e4668f23aae483e549dc (diff)
downloadngircd-84a599ece472c4f2ef6d2f553addf898e0ed73f9.tar.gz
ngircd-84a599ece472c4f2ef6d2f553addf898e0ed73f9.zip
Enable WHOIS to display information about IRC Services
This patch introduces the new numeric 310(RPL_WHOISSERVICE) and enables
WHOIS to display information about IRC services. This numeric is used
for this purpose by InspIRCd, for example -- but as usual, other numerics
are in use, too, like 613 in UltimateIRCd ...

Please note that neither the Operator (+o) not the "bot status" (+B)
of an IRC service id displayed in the output.

Change suggested by Federico G. Schwindt <fgsch@lodoss.net>, Thanks.
-rw-r--r--src/ngircd/irc-info.c13
-rw-r--r--src/ngircd/messages.h1
2 files changed, 11 insertions, 3 deletions
diff --git a/src/ngircd/irc-info.c b/src/ngircd/irc-info.c
index aaa607dd..e9c1ff53 100644
--- a/src/ngircd/irc-info.c
+++ b/src/ngircd/irc-info.c
@@ -1133,14 +1133,20 @@ IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c)
 			return DISCONNECTED;
 	}
 
+	/* Service? */
+	if (Client_Type(c) == CLIENT_SERVICE &&
+	    !IRC_WriteStrClient(from, RPL_WHOISSERVICE_MSG,
+				Client_ID(from), Client_ID(c)))
+		return DISCONNECTED;
+
 	/* IRC-Operator? */
-	if (Client_HasMode(c, 'o') &&
+	if (Client_HasMode(c, 'o') && Client_Type(c) != CLIENT_SERVICE &&
 	    !IRC_WriteStrClient(from, RPL_WHOISOPERATOR_MSG,
 				Client_ID(from), Client_ID(c)))
 		return DISCONNECTED;
 
 	/* IRC-Bot? */
-	if (Client_HasMode(c, 'B') &&
+	if (Client_HasMode(c, 'B') && Client_Type(c) != CLIENT_SERVICE &&
 	    !IRC_WriteStrClient(from, RPL_WHOISBOT_MSG,
 				Client_ID(from), Client_ID(c)))
 		return DISCONNECTED;
@@ -1262,7 +1268,8 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req )
 		 */
 		if (!has_wildcards || is_remote) {
 			c = Client_Search(query);
-			if (c && Client_Type(c) == CLIENT_USER) {
+			if (c && (Client_Type(c) == CLIENT_USER
+				  || Client_Type(c) == CLIENT_SERVICE)) {
 				if (!IRC_WHOIS_SendReply(Client, from, c))
 					return DISCONNECTED;
 			} else {
diff --git a/src/ngircd/messages.h b/src/ngircd/messages.h
index a6a6d8c2..371abc26 100644
--- a/src/ngircd/messages.h
+++ b/src/ngircd/messages.h
@@ -56,6 +56,7 @@
 #define RPL_UNAWAY_MSG			"305 %s :You are no longer marked as being away"
 #define RPL_NOWAWAY_MSG			"306 %s :You have been marked as being away"
 #define RPL_WHOISREGNICK_MSG		"307 %s %s :is a registered nick"
+#define RPL_WHOISSERVICE_MSG		"310 %s %s :is an IRC service"
 #define RPL_WHOISUSER_MSG		"311 %s %s %s %s * :%s"
 #define RPL_WHOISSERVER_MSG		"312 %s %s %s :%s"
 #define RPL_WHOISOPERATOR_MSG		"313 %s %s :is an IRC operator"