summaryrefslogtreecommitdiff
path: root/modules/commands
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-10-01 01:56:57 -0400
committerAdam <Adam@anope.org>2012-10-01 01:56:57 -0400
commit89428a9d1032e3c2a6e397629a32862b3e58d708 (patch)
treed507904b3fa1cc084f0f3e688c839bcdd47f79d7 /modules/commands
parentb937d6310d9a7c0e2434200306b63d513cb2ae61 (diff)
Cleanup of all of the protocol modules, rewrote message handling system to be a bit more C++ ish
Diffstat (limited to 'modules/commands')
-rw-r--r--modules/commands/bs_bot.cpp7
-rw-r--r--modules/commands/cs_seen.cpp4
-rw-r--r--modules/commands/hs_on.cpp12
-rw-r--r--modules/commands/hs_request.cpp5
-rw-r--r--modules/commands/hs_set.cpp4
-rw-r--r--modules/commands/ns_cert.cpp2
-rw-r--r--modules/commands/ns_info.cpp2
-rw-r--r--modules/commands/os_defcon.cpp12
-rw-r--r--modules/commands/os_forbid.cpp2
-rw-r--r--modules/commands/os_jupe.cpp2
-rw-r--r--modules/commands/os_oline.cpp2
-rw-r--r--modules/commands/os_stats.cpp4
-rw-r--r--modules/commands/os_svsnick.cpp2
-rw-r--r--modules/commands/os_sxline.cpp21
14 files changed, 34 insertions, 47 deletions
diff --git a/modules/commands/bs_bot.cpp b/modules/commands/bs_bot.cpp
index 0b45ee71c..de7fa1128 100644
--- a/modules/commands/bs_bot.cpp
+++ b/modules/commands/bs_bot.cpp
@@ -218,11 +218,8 @@ class CommandBSBot : public Command
}
/* The new nick is really different, so we remove the Q line for the old nick. */
- if (ircd->sqline)
- {
- XLine x(bi->nick);
- ircdproto->SendSQLineDel(&x);
- }
+ XLine x_del(bi->nick);
+ ircdproto->SendSQLineDel(&x_del);
/* Add a Q line for the new nick */
XLine x(nick, "Reserved for services");
diff --git a/modules/commands/cs_seen.cpp b/modules/commands/cs_seen.cpp
index 289988867..ce88efa44 100644
--- a/modules/commands/cs_seen.cpp
+++ b/modules/commands/cs_seen.cpp
@@ -376,9 +376,9 @@ class CSSeen : public Module
UpdateUser(u, PART, u->nick, "", channel, msg);
}
- void OnUserKicked(Channel *c, User *target, const Anope::string &source, const Anope::string &msg) anope_override
+ void OnUserKicked(Channel *c, User *target, MessageSource &source, const Anope::string &msg) anope_override
{
- UpdateUser(target, KICK, target->nick, source, c->name, msg);
+ UpdateUser(target, KICK, target->nick, source.GetSource(), c->name, msg);
}
private:
diff --git a/modules/commands/hs_on.cpp b/modules/commands/hs_on.cpp
index 91fcaf10e..d02dd7dfe 100644
--- a/modules/commands/hs_on.cpp
+++ b/modules/commands/hs_on.cpp
@@ -27,6 +27,8 @@ class CommandHSOn : public Command
User *u = source.GetUser();
if (!u)
return;
+ else if (!ircdproto->CanSetVHost)
+ return; // HostServ wouldn't even be loaded at this point
const NickAlias *na = findnick(u->nick);
if (na && u->Account() == na->nc && na->HasVhost())
@@ -37,13 +39,9 @@ class CommandHSOn : public Command
source.Reply(_("Your vhost of \002%s\002 is now activated."), na->GetVhostHost().c_str());
Log(LOG_COMMAND, source, this) << "to enable their vhost of " << (!na->GetVhostIdent().empty() ? na->GetVhostIdent() + "@" : "") << na->GetVhostHost();
ircdproto->SendVhost(u, na->GetVhostIdent(), na->GetVhostHost());
- if (ircd->vhost)
- u->vhost = na->GetVhostHost();
- if (ircd->vident)
- {
- if (!na->GetVhostIdent().empty())
- u->SetVIdent(na->GetVhostIdent());
- }
+ u->vhost = na->GetVhostHost();
+ if (ircdproto->CanSetVIdent && !na->GetVhostIdent().empty())
+ u->SetVIdent(na->GetVhostIdent());
u->UpdateHost();
}
else
diff --git a/modules/commands/hs_request.cpp b/modules/commands/hs_request.cpp
index f4b710b7f..94b181f51 100644
--- a/modules/commands/hs_request.cpp
+++ b/modules/commands/hs_request.cpp
@@ -121,7 +121,7 @@ class CommandHSRequest : public Command
source.Reply(HOST_SET_IDENTTOOLONG, Config->UserLen);
return;
}
- else if (!ircd->vident)
+ else if (!ircdproto->CanSetVIdent)
{
source.Reply(HOST_NO_VIDENT);
return;
@@ -354,6 +354,9 @@ class HSRequest : public Module
{
this->SetAuthor("Anope");
+ if (!ircdproto || !ircdproto->CanSetVHost)
+ throw ModuleException("Your IRCd does not support vhosts");
+
Implementation i[] = { I_OnReload };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
diff --git a/modules/commands/hs_set.cpp b/modules/commands/hs_set.cpp
index b2509bcea..2189f2483 100644
--- a/modules/commands/hs_set.cpp
+++ b/modules/commands/hs_set.cpp
@@ -55,7 +55,7 @@ class CommandHSSet : public Command
if (!user.empty())
{
- if (!ircd->vident)
+ if (!ircdproto->CanSetVIdent)
{
source.Reply(HOST_NO_VIDENT);
return;
@@ -156,7 +156,7 @@ class CommandHSSetAll : public Command
if (!user.empty())
{
- if (!ircd->vident)
+ if (!ircdproto->CanSetVIdent)
{
source.Reply(HOST_NO_VIDENT);
return;
diff --git a/modules/commands/ns_cert.cpp b/modules/commands/ns_cert.cpp
index da3cb2aa1..a06dd1a3a 100644
--- a/modules/commands/ns_cert.cpp
+++ b/modules/commands/ns_cert.cpp
@@ -225,7 +225,7 @@ class NSCert : public Module
{
this->SetAuthor("Anope");
- if (!ircd || !ircd->certfp)
+ if (!ircdproto || !ircdproto->CanCertFP)
throw ModuleException("Your IRCd does not support ssl client certificates");
Implementation i[] = { I_OnFingerprint };
diff --git a/modules/commands/ns_info.cpp b/modules/commands/ns_info.cpp
index b3b734a39..5daf2357e 100644
--- a/modules/commands/ns_info.cpp
+++ b/modules/commands/ns_info.cpp
@@ -102,7 +102,7 @@ class CommandNSInfo : public Command
{
if (na->HasVhost())
{
- if (ircd->vident && !na->GetVhostIdent().empty())
+ if (ircdproto->CanSetVIdent && !na->GetVhostIdent().empty())
info[_("VHost")] = na->GetVhostIdent() + "@" + na->GetVhostHost();
else
info[_("VHost")] = na->GetVhostHost();
diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp
index 741eb9d43..1d684bc27 100644
--- a/modules/commands/os_defcon.cpp
+++ b/modules/commands/os_defcon.cpp
@@ -323,14 +323,6 @@ class OSDefcon : public Module
Log() << "DefConChanModes must lock mode +l as well to lock mode +L";
}
-
- /* Some ircd we can't set NOKNOCK without INVITE */
- /* So check if we need there is a NOKNOCK MODE and that we need INVITEONLY */
- if (ircd->knock_needs_i && (cm = ModeManager::FindChannelModeByName(CMODE_NOKNOCK)) && DConfig.DefConModesOn.HasFlag(cm->Name) && !DConfig.DefConModesOn.HasFlag(CMODE_INVITE))
- {
- DConfig.DefConModesOn.UnsetFlag(CMODE_NOKNOCK);
- Log() << "DefConChanModes must lock mode +i as well to lock mode +K";
- }
}
public:
@@ -437,7 +429,7 @@ class OSDefcon : public Module
return EVENT_CONTINUE;
}
- EventReturn OnChannelModeSet(Channel *c, User *setter, ChannelModeName Name, const Anope::string &param) anope_override
+ EventReturn OnChannelModeSet(Channel *c, MessageSource &, ChannelModeName Name, const Anope::string &param) anope_override
{
ChannelMode *cm = ModeManager::FindChannelModeByName(Name);
@@ -451,7 +443,7 @@ class OSDefcon : public Module
return EVENT_CONTINUE;
}
- EventReturn OnChannelModeUnset(Channel *c, User *setter, ChannelModeName Name, const Anope::string &) anope_override
+ EventReturn OnChannelModeUnset(Channel *c, MessageSource &, ChannelModeName Name, const Anope::string &) anope_override
{
ChannelMode *cm = ModeManager::FindChannelModeByName(Name);
diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp
index 4862d5ea9..5f1d1d0ed 100644
--- a/modules/commands/os_forbid.cpp
+++ b/modules/commands/os_forbid.cpp
@@ -278,7 +278,7 @@ class OSForbid : public Module
ForbidData *d = this->forbidService.FindForbid(c->name, FT_CHAN);
if (bi != NULL && d != NULL)
{
- if (ircd->chansqline)
+ if (ircdproto->CanSQLineChannel)
{
XLine x(c->name, bi->nick, Anope::CurTime + Config->CSInhabit, d->reason);
ircdproto->SendSQLine(NULL, &x);
diff --git a/modules/commands/os_jupe.cpp b/modules/commands/os_jupe.cpp
index 34c28a864..cfe917c13 100644
--- a/modules/commands/os_jupe.cpp
+++ b/modules/commands/os_jupe.cpp
@@ -37,7 +37,7 @@ class CommandOSJupe : public Command
Anope::string rbuf = "Juped by " + source.GetNick() + (!reason.empty() ? ": " + reason : "");
if (server)
ircdproto->SendSquit(server, rbuf);
- Server *juped_server = new Server(Me, jserver, 1, rbuf, ircd->ts6 ? ts6_sid_retrieve() : "", SERVER_JUPED);
+ Server *juped_server = new Server(Me, jserver, 1, rbuf, ts6_sid_retrieve(), SERVER_JUPED);
ircdproto->SendServer(juped_server);
Log(LOG_ADMIN, source, this) << "on " << jserver << " (" << rbuf << ")";
diff --git a/modules/commands/os_oline.cpp b/modules/commands/os_oline.cpp
index a468281e0..ccf053f7e 100644
--- a/modules/commands/os_oline.cpp
+++ b/modules/commands/os_oline.cpp
@@ -72,7 +72,7 @@ class OSOLine : public Module
{
this->SetAuthor("Anope");
- if (!ircd || !ircd->omode)
+ if (!ircdproto || !ircdproto->CanSVSO)
throw ModuleException("Your IRCd does not support OMODE.");
}
diff --git a/modules/commands/os_stats.cpp b/modules/commands/os_stats.cpp
index 7b593e421..dd5bf9ee0 100644
--- a/modules/commands/os_stats.cpp
+++ b/modules/commands/os_stats.cpp
@@ -84,7 +84,7 @@ class CommandOSStats : public Command
else
source.Reply(_("Default AKILL expiry time: \002No expiration\002"));
}
- if (ircd->snline && snlines)
+ if (ircdproto->CanSNLine && snlines)
{
/* SNLINEs */
source.Reply(_("Current number of SNLINEs: \002%d\002"), snlines->GetCount());
@@ -104,7 +104,7 @@ class CommandOSStats : public Command
else
source.Reply(_("Default SNLINE expiry time: \002No expiration\002"));
}
- if (ircd->sqline && sqlines)
+ if (ircdproto->CanSQLine && sqlines)
{
/* SQLINEs */
source.Reply(_("Current number of SQLINEs: \002%d\002"), sqlines->GetCount());
diff --git a/modules/commands/os_svsnick.cpp b/modules/commands/os_svsnick.cpp
index aeaa38a59..4c6329acb 100644
--- a/modules/commands/os_svsnick.cpp
+++ b/modules/commands/os_svsnick.cpp
@@ -81,7 +81,7 @@ class OSSVSNick : public Module
{
this->SetAuthor("Anope");
- if (!ircd || !ircd->svsnick)
+ if (!ircdproto || !ircdproto->CanSVSNick)
throw ModuleException("Your IRCd does not support SVSNICK");
}
diff --git a/modules/commands/os_sxline.cpp b/modules/commands/os_sxline.cpp
index 20e76a94d..8cd3d9f7a 100644
--- a/modules/commands/os_sxline.cpp
+++ b/modules/commands/os_sxline.cpp
@@ -250,7 +250,7 @@ class CommandOSSNLine : public CommandOSSXLineBase
void OnAdd(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
- if (!this->xlm() ||! ircd->snline)
+ if (!this->xlm() || !ircdproto->CanSNLine)
{
source.Reply(_("Your IRCd does not support SNLINE"));
return;
@@ -384,18 +384,15 @@ class CommandOSSNLine : public CommandOSSXLineBase
{
this->xlm()->Send(source.GetUser(), x);
- if (!ircd->sglineenforce)
- {
- Anope::string rreason = "G-Lined: " + reason;
+ Anope::string rreason = "G-Lined: " + reason;
- for (Anope::insensitive_map<User *>::const_iterator it = UserListByNick.begin(); it != UserListByNick.end();)
- {
- User *user = it->second;
- ++it;
+ for (Anope::insensitive_map<User *>::const_iterator it = UserListByNick.begin(); it != UserListByNick.end();)
+ {
+ User *user = it->second;
+ ++it;
- if (!user->HasMode(UMODE_OPER) && user->server != Me && Anope::Match(user->realname, x->Mask, false, true))
- user->Kill(Config->ServerName, rreason);
- }
+ if (!user->HasMode(UMODE_OPER) && user->server != Me && Anope::Match(user->realname, x->Mask, false, true))
+ user->Kill(Config->ServerName, rreason);
}
}
@@ -474,7 +471,7 @@ class CommandOSSQLine : public CommandOSSXLineBase
void OnAdd(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
- if (!this->xlm() || !ircd->sqline)
+ if (!this->xlm() || !ircdproto->CanSQLine)
{
source.Reply(_("Your IRCd does not support SQLINE"));
return;