mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 18:49:03 -04:00
Merge pull request #169 from attilamolnar/insp21+spanningtreeapi
[2.1] Stop exposing the raw linking protocol to modules
This commit is contained in:
commit
4ee279810e
@ -53,10 +53,10 @@ class SyncTarget : public classbase
|
||||
*/
|
||||
virtual void SendEncap(const std::string& cmd, const parameterlist ¶ms) = 0;
|
||||
/**
|
||||
* Send a line s2s during netburst. The line should begin with the command you
|
||||
* are sending; ":SID " will be prepended prior to sending.
|
||||
* Send an ENCAP * command during netburst (for network sync)
|
||||
* @param line The rest of the line to send after ENCAP * (the receiver should have a handler for this)
|
||||
*/
|
||||
virtual void SendCommand(const std::string &line) = 0;
|
||||
virtual void SendEncap(const std::string &line) = 0;
|
||||
};
|
||||
|
||||
class ProtocolInterface
|
||||
|
@ -408,15 +408,15 @@ class ModuleAccount : public Module
|
||||
for (AccountDB::const_iterator i = cmd.prov.db.begin(); i != cmd.prov.db.end(); ++i)
|
||||
{
|
||||
std::string name = i->first, ts = ConvToStr(i->second->ts);
|
||||
target->SendCommand("ENCAP * SVSACCOUNT ADD " + name + " :" + ts);
|
||||
target->SendCommand("ENCAP * SVSACCOUNT SET " + name + " " + ts + " hash_password "
|
||||
target->SendEncap("SVSACCOUNT ADD " + name + " :" + ts);
|
||||
target->SendEncap("SVSACCOUNT SET " + name + " " + ts + " hash_password "
|
||||
+ ConvToStr(i->second->hash_password_ts) + " :" + i->second->hash + " " + i->second->password);
|
||||
for(Extensible::ExtensibleStore::const_iterator it = i->second->GetExtList().begin(); it != i->second->GetExtList().end(); ++it)
|
||||
{
|
||||
ExtensionItem* item = it->first;
|
||||
std::string value = item->serialize(FORMAT_NETWORK, i->second, it->second);
|
||||
if (!value.empty())
|
||||
target->SendCommand("ENCAP * SVSACCOUNT SET " + name + " " + ts + " " + item->name + " " + value);
|
||||
target->SendEncap("SVSACCOUNT SET " + name + " " + ts + " " + item->name + " " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -554,7 +554,7 @@ class ModuleAccountRegister : public Module
|
||||
virtual void OnSyncNetwork(SyncTarget* target)
|
||||
{
|
||||
for (std::set<irc::string>::const_iterator i = recentlydropped.begin(); i != recentlydropped.end(); ++i)
|
||||
target->SendCommand("ENCAP * RECENTLYDROPPED " + i->value);
|
||||
target->SendEncap("RECENTLYDROPPED " + i->value);
|
||||
}
|
||||
|
||||
void OnGarbageCollect()
|
||||
|
@ -54,9 +54,9 @@ void SpanningTreeSyncTarget::SendEncap(const std::string& cmd, const parameterli
|
||||
ts.WriteLine(line);
|
||||
}
|
||||
|
||||
void SpanningTreeSyncTarget::SendCommand(const std::string &line)
|
||||
void SpanningTreeSyncTarget::SendEncap(const std::string &line)
|
||||
{
|
||||
ts.WriteLine(":" + ServerInstance->Config->GetSID() + " " + line);
|
||||
ts.WriteLine(":" + ServerInstance->Config->GetSID() + " ENCAP * " + line);
|
||||
}
|
||||
|
||||
void SpanningTreeProtocolInterface::GetServerList(ProtoServerList &sl)
|
||||
|
@ -90,7 +90,7 @@ class SpanningTreeSyncTarget : public SyncTarget
|
||||
SpanningTreeSyncTarget(TreeSocket* t) : ts(*t) {}
|
||||
void SendMetaData(Extensible* target, const std::string &extname, const std::string &extdata);
|
||||
void SendEncap(const std::string& cmd, const parameterlist &encap);
|
||||
void SendCommand(const std::string& line);
|
||||
void SendEncap(const std::string& line);
|
||||
};
|
||||
|
||||
/** Every SERVER connection inbound or outbound is represented by an object of
|
||||
|
@ -357,7 +357,7 @@ class ModuleTimedModes : public Module
|
||||
int maxModeLength = MAXBUF - 24 - channel->name.length() - ConvToStr(i->expire).length();
|
||||
irc::modestacker modes = i->modes;
|
||||
while(!modes.sequence.empty())
|
||||
target->SendCommand("ENCAP * TMODE " + channel->name + " " + ConvToStr(i->expire) + " " + modes.popModeLine(FORMAT_NETWORK, maxModeLength, INT_MAX));
|
||||
target->SendEncap("TMODE " + channel->name + " " + ConvToStr(i->expire) + " " + modes.popModeLine(FORMAT_NETWORK, maxModeLength, INT_MAX));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user