commit - 87deb430125413cbb2ba415936b40d6420703572
commit + 9d97004a287589681342a0116746796f2764100c
blob - 8d7cdd70714d62d85844c68c28539615da33baef
blob + aee7491c20783051d24d65705637c25ac3779cac
--- doc/Modes.txt
+++ doc/Modes.txt
mode since description
a 0.3.0 User is away.
+ b 20 User blocks private messages and notices.
B 20 User is flagged as a "bot".
c 17 IRC operator wants to receive connect/disconnect NOTICEs.
C 19 Only users that share a channel are allowed to send messages.
blob - 37ca67640331d1aaef54181a7038e8f7b4cfa2ca
blob + 977bc74ed43e4416a4d3aa02161e64da0d996155
--- src/ngircd/defines.h
+++ src/ngircd/defines.h
#endif
/** Supported user modes. */
-#define USERMODES "aBcCioqrRswx"
+#define USERMODES "abBcCioqrRswx"
/** Supported channel modes. */
#define CHANMODES "abehiIklmMnoOPqQrRstvVz"
blob - c7d02c9101e224fe14d787ff2938e4cf165c0853
blob + ce4044d0bf7b154401e10096af47abed1911550b
--- src/ngircd/irc-mode.c
+++ src/ngircd/irc-mode.c
/* Validate modes */
x[0] = '\0';
switch (*mode_ptr) {
+ case 'b': /* Block private msgs */
case 'C': /* Only messages from clients sharing a channel */
case 'i': /* Invisible */
case 's': /* Server messages */
blob - ceb649ecf350159d1db1bc969d0a5bb496372a2a
blob + 1a57bec16274e96a78077829126cd9c086a1e3e4
--- src/ngircd/irc.c
+++ src/ngircd/irc.c
Req->command = "PRIVMSG";
}
#endif
+ if (Client_HasMode(cl, 'b') &&
+ !Client_HasMode(from, 'R') &&
+ !Client_HasMode(from, 'o') &&
+ !(Client_Type(from) == CLIENT_SERVER) &&
+ !(Client_Type(from) == CLIENT_SERVICE)) {
+ if (SendErrors && !IRC_WriteStrClient(from,
+ ERR_CANNOTSENDTONICK_MSG,
+ Client_ID(from), Client_ID(cl)))
+ return DISCONNECTED;
+ goto send_next_target;
+ }
if (Client_HasMode(cl, 'C')) {
cl2chan = Channel_FirstChannelOf(cl);
blob - ec7bb6fd495f78608a2ded2ec30a613580bd679c
blob + 59e9605d97f8b7a52a68fcdd863cefa0ef8c05e5
--- src/ngircd/messages.h
+++ src/ngircd/messages.h
#define ERR_UMODEUNKNOWNFLAG2_MSG "501 %s :Unknown mode \"%c%c\""
#define ERR_USERSDONTMATCH_MSG "502 %s :Can't set/get mode for other users"
#define ERR_NOINVITE_MSG "518 %s :Cannot invite to %s (+V)"
+#define ERR_CANNOTSENDTONICK_MSG "976 %s :Cannot send to user (+b) -- Only registered users can message %s"
#ifdef ZLIB
# define RPL_STATSLINKINFOZIP_MSG "211 %s %s %d %ld %ld/%ld %ld %ld/%ld :%ld"