about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDNS777 <dns@rbose.org>2012-08-23 09:25:30 +0000
committerAlexander Barton <alex@barton.de>2012-08-26 15:58:37 +0200
commitc2b39fdedef18b7cb634509bb3f1dd67bf47c214 (patch)
tree7977df70b71ea1b2bf4ba73acb37f5ac0724a998 /src
parent360a254be0e55e975998d0f3a5ff301ac3346f72 (diff)
downloadngircd-c2b39fdedef18b7cb634509bb3f1dd67bf47c214.tar.gz
ngircd-c2b39fdedef18b7cb634509bb3f1dd67bf47c214.zip
Implement an Unreal-like user mode "B" ("Bot mode")
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/defines.h2
-rw-r--r--src/ngircd/irc-info.c6
-rw-r--r--src/ngircd/irc-mode.c8
-rw-r--r--src/ngircd/messages.h1
4 files changed, 16 insertions, 1 deletions
diff --git a/src/ngircd/defines.h b/src/ngircd/defines.h
index cd0a1666..27eecf1d 100644
--- a/src/ngircd/defines.h
+++ b/src/ngircd/defines.h
@@ -161,7 +161,7 @@
 #endif
 
 /** Supported user modes. */
-#define USERMODES "acCiorRswx"
+#define USERMODES "aBcCiorRswx"
 
 /** Supported channel modes. */
 #define CHANMODES "beiIklmnoOPrRstvz"
diff --git a/src/ngircd/irc-info.c b/src/ngircd/irc-info.c
index 0ea85874..f5139d07 100644
--- a/src/ngircd/irc-info.c
+++ b/src/ngircd/irc-info.c
@@ -1111,6 +1111,12 @@ IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c)
 				Client_ID(from), Client_ID(c)))
 		return DISCONNECTED;
 
+	/* IRC-Bot? */
+	if (Client_HasMode(c, 'B') &&
+	    !IRC_WriteStrClient(from, RPL_WHOISBOT_MSG,
+				Client_ID(from), Client_ID(c)))
+		return DISCONNECTED;
+
 	/* Connected using SSL? */
 	if (Conn_UsesSSL(Client_Conn(c)) &&
 	    !IRC_WriteStrClient(from, RPL_WHOISSSL_MSG, Client_ID(from),
diff --git a/src/ngircd/irc-mode.c b/src/ngircd/irc-mode.c
index fa35cdd0..9cad3249 100644
--- a/src/ngircd/irc-mode.c
+++ b/src/ngircd/irc-mode.c
@@ -229,6 +229,14 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
 							ERR_NOPRIVILEGES_MSG,
 							Client_ID(Origin));
 			break;
+		case 'B': /* Bot */
+			if (Client_HasMode(Client, 'r'))
+				ok = IRC_WriteStrClient(Origin,
+							ERR_RESTRICTED_MSG,
+							Client_ID(Origin));
+			else
+				x[0] = 'B';
+			break;
 		case 'c': /* Receive connect notices
 			   * (only settable by IRC operators!) */
 			if (!set || Client_Type(Client) == CLIENT_SERVER
diff --git a/src/ngircd/messages.h b/src/ngircd/messages.h
index 9ad6be17..4858fea9 100644
--- a/src/ngircd/messages.h
+++ b/src/ngircd/messages.h
@@ -72,6 +72,7 @@
 #define RPL_NOTOPIC_MSG			"331 %s %s :No topic is set"
 #define RPL_TOPIC_MSG			"332 %s %s :%s"
 #define RPL_TOPICSETBY_MSG		"333 %s %s %s %u"
+#define RPL_WHOISBOT_MSG		"335 %s %s :is a IRC Bot"
 #define RPL_INVITING_MSG		"341 %s %s %s%s"
 #define RPL_INVITELIST_MSG		"346 %s %s %s"
 #define RPL_ENDOFINVITELIST_MSG		"347 %s %s :End of channel invite list"