summaryrefslogtreecommitdiff
path: root/src/modules/m_cap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_cap.cpp')
-rw-r--r--src/modules/m_cap.cpp31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp
index e9f4dae90..35c24fd23 100644
--- a/src/modules/m_cap.cpp
+++ b/src/modules/m_cap.cpp
@@ -19,9 +19,7 @@
#include "inspircd.h"
-#include "m_cap.h"
-
-/* $ModDesc: Provides the CAP negotiation mechanism seen in ratbox-derived ircds */
+#include "modules/cap.h"
/*
CAP LS
@@ -74,13 +72,13 @@ class CommandCAP : public Command
if (Data.ack.size() > 0)
{
- std::string AckResult = irc::stringjoiner(" ", Data.ack, 0, Data.ack.size() - 1).GetJoined();
+ std::string AckResult = irc::stringjoiner(Data.ack).GetJoined();
user->WriteServ("CAP %s ACK :%s", user->nick.c_str(), AckResult.c_str());
}
if (Data.wanted.size() > 0)
{
- std::string NakResult = irc::stringjoiner(" ", Data.wanted, 0, Data.wanted.size() - 1).GetJoined();
+ std::string NakResult = irc::stringjoiner(Data.wanted).GetJoined();
user->WriteServ("CAP %s NAK :%s", user->nick.c_str(), NakResult.c_str());
}
}
@@ -95,10 +93,7 @@ class CommandCAP : public Command
reghold.set(user, 1);
Data.Send();
- std::string Result;
- if (Data.wanted.size() > 0)
- Result = irc::stringjoiner(" ", Data.wanted, 0, Data.wanted.size() - 1).GetJoined();
-
+ std::string Result = irc::stringjoiner(Data.wanted).GetJoined();
user->WriteServ("CAP %s %s :%s", user->nick.c_str(), subcommand.c_str(), Result.c_str());
}
else if (subcommand == "CLEAR")
@@ -108,9 +103,7 @@ class CommandCAP : public Command
reghold.set(user, 1);
Data.Send();
- std::string Result;
- if (!Data.ack.empty())
- Result = irc::stringjoiner(" ", Data.ack, 0, Data.ack.size() - 1).GetJoined();
+ std::string Result = irc::stringjoiner(Data.ack).GetJoined();
user->WriteServ("CAP %s ACK :%s", user->nick.c_str(), Result.c_str());
}
else
@@ -132,16 +125,13 @@ class ModuleCAP : public Module
{
}
- void init()
+ void init() CXX11_OVERRIDE
{
ServerInstance->Modules->AddService(cmd);
ServerInstance->Modules->AddService(cmd.reghold);
-
- Implementation eventlist[] = { I_OnCheckReady };
- ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
- ModResult OnCheckReady(LocalUser* user)
+ ModResult OnCheckReady(LocalUser* user) CXX11_OVERRIDE
{
/* Users in CAP state get held until CAP END */
if (cmd.reghold.get(user))
@@ -150,15 +140,10 @@ class ModuleCAP : public Module
return MOD_RES_PASSTHRU;
}
- ~ModuleCAP()
- {
- }
-
- Version GetVersion()
+ Version GetVersion() CXX11_OVERRIDE
{
return Version("Client CAP extension support", VF_VENDOR);
}
};
MODULE_INIT(ModuleCAP)
-