summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-26 20:43:15 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-26 20:43:15 +0000
commitd58d9fb4957168c134ae1e89005ff03154366a2a (patch)
treed26b3ee3e6d7fe6555d192f6316d60da78721ffd /src
parent3a7af31bcd081debd490aa57a1d142bebf430b61 (diff)
Add option to set invite announcements to nobody, ops only, or all users, based on options:announceinvites. Part of bug #386, should not be backported.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7837 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/cmd_invite.cpp14
-rw-r--r--src/configreader.cpp17
2 files changed, 28 insertions, 3 deletions
diff --git a/src/cmd_invite.cpp b/src/cmd_invite.cpp
index f4368071a..a6e82d281 100644
--- a/src/cmd_invite.cpp
+++ b/src/cmd_invite.cpp
@@ -78,8 +78,18 @@ CmdResult cmd_invite::Handle (const char** parameters, int pcnt, userrec *user)
u->InviteTo(c->name);
u->WriteFrom(user,"INVITE %s :%s",u->nick,c->name);
user->WriteServ("341 %s %s %s",user->nick,u->nick,c->name);
- if (ServerInstance->Config->AnnounceInvites)
- c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s invited %s into the channel", c->name, user->nick, u->nick);
+ switch (ServerInstance->Config->AnnounceInvites)
+ {
+ case ServerConfig::INVITE_ANNOUNCE_ALL:
+ c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s invited %s into the channel", c->name, user->nick, u->nick);
+ break;
+ case ServerConfig::INVITE_ANNOUNCE_OPS:
+ c->WriteAllExceptSender(user, true, '@', "NOTICE %s :*** %s invited %s into the channel", c->name, user->nick, u->nick);
+ break;
+ default:
+ /* Nobody */
+ break;
+ }
FOREACH_MOD(I_OnUserInvite,OnUserInvite(user,u,c));
}
else
diff --git a/src/configreader.cpp b/src/configreader.cpp
index e6aa30de3..06a86a775 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -353,6 +353,20 @@ bool ValidateExemptChanOps(ServerConfig* conf, const char* tag, const char* valu
return true;
}
+bool ValidateInvite(ServerConfig* conf, const char* tag, const char* value, ValueItem &data)
+{
+ std::string v = data.GetString();
+
+ if (v == "ops")
+ conf->AnnounceInvites = ServerConfig::INVITE_ANNOUNCE_OPS;
+ else if (v == "all")
+ conf->AnnounceInvites = ServerConfig::INVITE_ANNOUNCE_ALL;
+ else
+ conf->AnnounceInvites = ServerConfig::INVITE_ANNOUNCE_NONE;
+
+ return true;
+}
+
bool ValidateWhoWas(ServerConfig* conf, const char* tag, const char* value, ValueItem &data)
{
conf->WhoWasMaxKeep = conf->GetInstance()->Duration(data.GetString());
@@ -605,6 +619,7 @@ void ServerConfig::Read(bool bail, userrec* user)
static char maxkeep[MAXBUF]; /* Temporary buffer for WhoWasMaxKeep value */
static char hidemodes[MAXBUF]; /* Modes to not allow listing from users below halfop */
static char exemptchanops[MAXBUF]; /* Exempt channel ops from these modes */
+ static char announceinvites[MAXBUF]; /* options:announceinvites setting */
int rem = 0, add = 0; /* Number of modules added, number of modules removed */
std::ostringstream errstr; /* String stream containing the error output */
@@ -649,7 +664,7 @@ void ServerConfig::Read(bool bail, userrec* user)
{"options", "syntaxhints", "0", new ValueContainerBool (&this->SyntaxHints), DT_BOOLEAN, NoValidation},
{"options", "cyclehosts", "0", new ValueContainerBool (&this->CycleHosts), DT_BOOLEAN, NoValidation},
{"options", "ircumsgprefix","0", new ValueContainerBool (&this->UndernetMsgPrefix), DT_BOOLEAN, NoValidation},
- {"options", "announceinvites", "1", new ValueContainerBool (&this->AnnounceInvites), DT_BOOLEAN, NoValidation},
+ {"options", "announceinvites", "1", new ValueContainerChar (announceinvites), DT_CHARPTR, ValidateInvite},
{"options", "hostintopic", "1", new ValueContainerBool (&this->FullHostInTopic), DT_BOOLEAN, NoValidation},
{"options", "hidemodes", "", new ValueContainerChar (hidemodes), DT_CHARPTR, ValidateModeLists},
{"options", "exemptchanops","", new ValueContainerChar (exemptchanops), DT_CHARPTR, ValidateExemptChanOps},