From 930629c5f23f59b43566aee2e75bddee6e53ff20 Mon Sep 17 00:00:00 2001 From: "B.Greenham" Date: Tue, 23 Feb 2010 00:21:24 -0500 Subject: [PATCH] Add umode +B, which marks users with it set as a bot in whois. --- help/opers/umode | 1 + help/users/umode | 1 + include/client.h | 2 ++ include/numeric.h | 3 +++ modules/m_whois.c | 5 +++++ src/messages.tab | 2 +- src/newconf.c | 1 + src/s_user.c | 2 +- 8 files changed, 15 insertions(+), 2 deletions(-) diff --git a/help/opers/umode b/help/opers/umode index 90c7892..3c78a53 100644 --- a/help/opers/umode +++ b/help/opers/umode @@ -13,6 +13,7 @@ Usermodes: (* designates that the umode is oper only) * +l - Can see oper locops (local wallops). * +s - Can see server notices (see /quote help snomask). * +z - Can see operwalls. + +B - Marks you as a bot in /whois. +C - Prevents you from receiving CTCPs other than ACTION. +D - Deaf - ignores all channel messages. +Q - Prevents you from being affected by channel forwarding. diff --git a/help/users/umode b/help/users/umode index eaa7d57..55e777a 100644 --- a/help/users/umode +++ b/help/users/umode @@ -9,6 +9,7 @@ Usermodes: +i - Designates this client 'invisible'. +g - "caller id" mode only allow accept clients to message you +w - Can see oper wallops. + +B - Marks you as a bot in /whois. +C - Prevents you from receiving CTCPs other than ACTION. +D - Deaf - ignores all channel messages. +Q - Prevents you from being affected by channel forwarding. diff --git a/include/client.h b/include/client.h index d866585..2d673cf 100644 --- a/include/client.h +++ b/include/client.h @@ -423,6 +423,7 @@ struct ListClient #define UMODE_REGONLYMSG 0x0200 /* only allow logged in users to msg */ #define UMODE_NOCTCP 0x0400 /* block CTCPs except for ACTION */ #define UMODE_NOINVITE 0x0800 /* block invites */ +#define UMODE_BOT 0x8000 /* mark as a bot in whois */ /* user information flags, only settable by remote mode or local oper */ #define UMODE_OPER 0x1000 /* Operator */ @@ -518,6 +519,7 @@ struct ListClient #define IsSetRegOnlyMsg(x) ((x)->umodes & UMODE_REGONLYMSG) #define IsSetNoCTCP(x) ((x)->umodes & UMODE_NOCTCP) #define IsSetNoInvite(x) ((x)->umodes & UMODE_NOINVITE) +#define IsSetBot(x) ((x)->umodes & UMODE_BOT) #define SetGotId(x) ((x)->flags |= FLAGS_GOTID) #define IsGotId(x) (((x)->flags & FLAGS_GOTID) != 0) diff --git a/include/numeric.h b/include/numeric.h index a099b75..a43c740 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -164,6 +164,9 @@ extern const char *form_str(int); #define RPL_NOTOPIC 331 #define RPL_TOPIC 332 #define RPL_TOPICWHOTIME 333 + +#define RPL_WHOISBOT 335 + #define RPL_WHOISACTUALLY 338 #define RPL_INVITING 341 diff --git a/modules/m_whois.c b/modules/m_whois.c index f4fb885..2519971 100644 --- a/modules/m_whois.c +++ b/modules/m_whois.c @@ -326,6 +326,11 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy) form_str(RPL_WHOISCERTFP), target_p->name, target_p->certfp); + if(IsSetBot(target_p)) + sendto_one_numeric(source_p, RPL_WHOISBOT, + form_str(RPL_WHOISBOT), + target_p->name); + if(MyClient(target_p)) { if (IsDynSpoof(target_p) && (IsOper(source_p) || source_p == target_p)) diff --git a/src/messages.tab b/src/messages.tab index a9ba1ea..2345a5b 100644 --- a/src/messages.tab +++ b/src/messages.tab @@ -356,7 +356,7 @@ static const char * replies[] = { /* 332 RPL_TOPIC, */ ":%s 332 %s %s :%s", /* 333 RPL_TOPICWHOTIME, */ ":%s 333 %s %s %s %lu", /* 334 */ NULL, -/* 335 */ NULL, +/* 335 RPL_WHOISBOT */ "%s :is a bot", /* 336 */ NULL, /* 337 */ NULL, /* 338 RPL_WHOISACTUALLY, */ "%s %s :actually using host", diff --git a/src/newconf.c b/src/newconf.c index b92778a..ab564cd 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -305,6 +305,7 @@ static struct mode_table umode_table[] = { {"operwall", UMODE_OPERWALL }, {"noctcp", UMODE_NOCTCP }, {"noinvite", UMODE_NOINVITE }, + {"bot", UMODE_BOT }, {NULL, 0} }; diff --git a/src/s_user.c b/src/s_user.c index 3ca5f8e..ce94bd8 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -68,7 +68,7 @@ int user_modes[256] = { /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x3F */ 0, /* @ */ 0, /* A */ - 0, /* B */ + UMODE_BOT, /* B */ UMODE_NOCTCP, /* C */ UMODE_DEAF, /* D */ 0, /* E */