1
0
mirror of https://github.com/anope/anope.git synced 2026-07-07 09:45:44 +02:00

Remove send_cmd and replace it with a stringstream

This commit is contained in:
Adam
2011-11-25 00:44:31 -05:00
parent 12d0a7302f
commit cef3eb78df
17 changed files with 417 additions and 581 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+3 -46
View File
@@ -54,28 +54,6 @@ static bool has_servicesmod = false;
static bool has_svsholdmod = false;
static bool has_hidechansmod = false;
/* CHGHOST */
void inspircd_cmd_chghost(const Anope::string &nick, const Anope::string &vhost)
{
if (!has_chghostmod)
{
Log() << "CHGHOST not loaded!";
return;
}
User *u = finduser(nick);
send_cmd(u ? u->GetUID() : Config->Numeric, "CHGHOST %s %s", nick.c_str(), vhost.c_str());
}
bool event_idle(const Anope::string &source, const std::vector<Anope::string> &params)
{
BotInfo *bi = findbot(params[0]);
send_cmd(bi ? bi->GetUID() : params[0], "IDLE %s %ld %ld", source.c_str(), static_cast<long>(start_time), bi ? (static_cast<long>(Anope::CurTime - bi->lastmsg)) : 0);
return true;
}
bool event_ftopic(const Anope::string &source, const std::vector<Anope::string> &params)
{
/* :source FTOPIC channel ts setby :topic */
@@ -144,27 +122,6 @@ bool event_fmode(const Anope::string &source, const std::vector<Anope::string> &
return ircdmessage->OnMode(source, newparams);
}
bool event_time(const Anope::string &source, const std::vector<Anope::string> &params)
{
if (params.size() < 2)
return true;
send_cmd(Config->Numeric, "TIME %s %s %ld", source.c_str(), params[1].c_str(), static_cast<long>(Anope::CurTime));
return true;
}
bool event_rsquit(const Anope::string &source, const std::vector<Anope::string> &params)
{
/* On InspIRCd we must send a SQUIT when we recieve RSQUIT for a server we have juped */
Server *s = Server::Find(params[0]);
if (s && s->HasFlag(SERVER_JUPED))
send_cmd(Config->Numeric, "SQUIT %s :%s", s->GetSID().c_str(), params.size() > 1 ? params[1].c_str() : "");
ircdmessage->OnSQuit(source, params);
return true;
}
bool event_setname(const Anope::string &source, const std::vector<Anope::string> &params)
{
User *u = finduser(source);
@@ -693,21 +650,21 @@ class Inspircd12IRCdMessage : public InspircdIRCdMessage
{
if (!has_globopsmod)
{
send_cmd("", "ERROR :m_globops is not loaded. This is required by Anope");
UplinkSocket::Message() << "ERROR :m_globops is not loaded. This is required by Anope";
quitmsg = "Remote server does not have the m_globops module loaded, and this is required.";
quitting = true;
return false;
}
if (!has_servicesmod)
{
send_cmd("", "ERROR :m_services_account.so is not loaded. This is required by Anope");
UplinkSocket::Message() << "ERROR :m_services_account.so is not loaded. This is required by Anope";
quitmsg = "ERROR: Remote server does not have the m_services_account module loaded, and this is required.";
quitting = true;
return false;
}
if (!has_hidechansmod)
{
send_cmd("", "ERROR :m_hidechans.so is not loaded. This is required by Anope");
UplinkSocket::Message() << "ERROR :m_hidechans.so is not loaded. This is required by Anope";
quitmsg = "ERROR: Remote server does not have the m_hidechans module loaded, and this is required.";
quitting = true;
return false;
+8 -50
View File
@@ -53,38 +53,17 @@ IRCDVar myIrcd[] = {
static bool has_servicesmod = false;
static bool has_svsholdmod = false;
/* CHGHOST */
void inspircd_cmd_chghost(const Anope::string &nick, const Anope::string &vhost)
{
if (!has_chghostmod)
{
Log() << "CHGHOST not loaded!";
return;
}
User *u = finduser(nick);
send_cmd(u ? u->GetUID() : Config->Numeric, "CHGHOST %s %s", nick.c_str(), vhost.c_str());
}
bool event_idle(const Anope::string &source, const std::vector<Anope::string> &params)
{
BotInfo *bi = findbot(params[0]);
send_cmd(bi ? bi->GetUID() : params[0], "IDLE %s %ld %ld", source.c_str(), static_cast<long>(start_time), bi ? (static_cast<long>(Anope::CurTime - bi->lastmsg)) : 0);
return true;
}
class InspIRCdProto : public InspIRCdTS6Proto
{
void SendConnect()
{
send_cmd("", "CAPAB START 1202");
send_cmd("", "CAPAB CAPABILITIES :PROTOCOL=1202");
send_cmd("", "CAPAB END");
UplinkSocket::Message() << "CAPAB START 1202";
UplinkSocket::Message() << "CAPAB CAPABILITIES :PROTOCOL=1202";
UplinkSocket::Message() << "CAPAB END";
SendServer(Me);
send_cmd(Config->Numeric, "BURST");
UplinkSocket::Message(Config->Numeric) << "BURST";
Module *enc = ModuleManager::FindFirstOf(ENCRYPTION);
send_cmd(Config->Numeric, "VERSION :Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, enc ? enc->name.c_str() : "unknown", Anope::VersionBuildString().c_str());
UplinkSocket::Message(Config->Numeric) << "VERSION :Anope-" << Anope::Version() << " " << Me->GetName() << " :" << ircd->name <<" - (" << (enc ? enc->name : "unknown") << ") -- " << Anope::VersionBuildString();
}
};
@@ -155,27 +134,6 @@ bool event_fmode(const Anope::string &source, const std::vector<Anope::string> &
return ircdmessage->OnMode(source, newparams);
}
bool event_time(const Anope::string &source, const std::vector<Anope::string> &params)
{
if (params.size() < 2)
return true;
send_cmd(Config->Numeric, "TIME %s %s %ld", source.c_str(), params[1].c_str(), static_cast<long>(Anope::CurTime));
return true;
}
bool event_rsquit(const Anope::string &source, const std::vector<Anope::string> &params)
{
/* On InspIRCd we must send a SQUIT when we recieve RSQUIT for a server we have juped */
Server *s = Server::Find(params[0]);
if (s && s->HasFlag(SERVER_JUPED))
send_cmd(Config->Numeric, "SQUIT %s :%s", s->GetSID().c_str(), params.size() > 1 ? params[1].c_str() : "");
ircdmessage->OnSQuit(source, params);
return true;
}
bool event_setname(const Anope::string &source, const std::vector<Anope::string> &params)
{
User *u = finduser(source);
@@ -429,7 +387,7 @@ class Inspircd20IRCdMessage : public InspircdIRCdMessage
{
if (params.size() < 2 || (Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0) < 1202)
{
send_cmd("", "ERROR :Protocol mismatch, no or invalid protocol version given in CAPAB START");
UplinkSocket::Message() << "ERROR :Protocol mismatch, no or invalid protocol version given in CAPAB START";
quitmsg = "Protocol mismatch, no or invalid protocol version given in CAPAB START";
quitting = true;
return false;
@@ -713,14 +671,14 @@ class Inspircd20IRCdMessage : public InspircdIRCdMessage
{
if (!has_servicesmod)
{
send_cmd("", "ERROR :m_services_account.so is not loaded. This is required by Anope");
UplinkSocket::Message() << "ERROR :m_services_account.so is not loaded. This is required by Anope";
quitmsg = "ERROR: Remote server does not have the m_services_account module loaded, and this is required.";
quitting = true;
return false;
}
if (!ModeManager::FindUserModeByName(UMODE_PRIV))
{
send_cmd("", "ERROR :m_hidechans.so is not loaded. This is required by Anope");
UplinkSocket::Message() << "ERROR :m_hidechans.so is not loaded. This is required by Anope";
quitmsg = "ERROR: Remote server does not have the m_hidechans module loaded, and this is required.";
quitting = true;
return false;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff