commit 1d3def0cc6271ff77b39deec07eee240e1968d52 from: Alexander Barton date: Mon Aug 27 21:27:30 2012 UTC Merge branch 'umode-B' This patch series allows ngIRCd to support the user mode "B" ("Bot flasg"): it is settable and unsettable by every (non-restricted) client. According to DNS777, this is how Unreal and InspIRCd do behave, so do we :-) By Alexander Barton (1) and DNS777 (1) * umode-B: Add new user mode "B" to doc/Modes.txt Implement an Unreal-like user mode "B" ("Bot mode") commit - e01e8f1cb6812ac24821fa540fd6ce4e61ccbc12 commit + 1d3def0cc6271ff77b39deec07eee240e1968d52 blob - 2b700f0cb66a5da6065eb07bf2e8ae2733908da3 blob + c2c533f2a67e1784561869cfee1ac49c5bf0fd90 --- doc/Modes.txt +++ doc/Modes.txt @@ -2,7 +2,7 @@ ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ - (c)2001-2011 Alexander Barton and Contributors. + (c)2001-2012 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. @@ -22,6 +22,7 @@ channels he is using at the moment. mode since description a 0.3.0 User is away. + 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. i 0.0.1 User is "invisible". blob - 310e0699857b2327cee44b440a44061386133805 blob + 82837599aadbb6485f0f044b447739d7b5f922fa --- src/ngircd/defines.h +++ src/ngircd/defines.h @@ -161,7 +161,7 @@ #endif /** Supported user modes. */ -#define USERMODES "acCiorRswx" +#define USERMODES "aBcCiorRswx" /** Supported channel modes. */ #define CHANMODES "beiIklmMnoOPrRstvz" blob - 0ea85874862b7114b6cd355d59467371055a4013 blob + f5139d07ebed78c68953bc56b19ed04424b9c884 --- src/ngircd/irc-info.c +++ src/ngircd/irc-info.c @@ -1108,6 +1108,12 @@ IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIE /* IRC-Operator? */ if (Client_HasMode(c, 'o') && !IRC_WriteStrClient(from, RPL_WHOISOPERATOR_MSG, + 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; blob - 8da4a65aefed06ed1f41f0b0de43c9fc348201cd blob + dc37ad00c83ed5dee4dbc047a6e8b1ce234484ff --- src/ngircd/irc-mode.c +++ src/ngircd/irc-mode.c @@ -227,7 +227,15 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Ori } else ok = IRC_WriteStrClient(Origin, 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!) */ blob - da861f9a8b45f8743f87575c912101de251daef4 blob + 2cfd45dbf2529e1c54695bff07bd87f91b7e962a --- src/ngircd/messages.h +++ 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"