1
0
mirror of https://github.com/anope/anope.git synced 2026-07-06 01:13:14 +02:00

Core prep for p10 stuff

This commit is contained in:
Adam
2014-05-21 08:50:40 -04:00
parent 5a1257b7f0
commit f627a3bacd
27 changed files with 166 additions and 138 deletions
+48 -1
View File
@@ -26,7 +26,7 @@ IRCDProto::IRCDProto(Module *creator, const Anope::string &p) : Service(creator,
{
DefaultPseudoclientModes = "+io";
CanSVSNick = CanSVSJoin = CanSetVHost = CanSetVIdent = CanSNLine = CanSQLine = CanSQLineChannel
= CanSZLine = CanSVSHold = CanSVSO = CanCertFP = RequiresID = false;
= CanSZLine = CanSVSHold = CanSVSO = CanCertFP = RequiresID = AmbiguousID = false;
MaxModes = 3;
MaxLine = 512;
@@ -45,6 +45,53 @@ const Anope::string &IRCDProto::GetProtocolName()
return this->proto_name;
}
static inline char& nextID(char &c)
{
if (c == 'Z')
c = '0';
else if (c != '9')
++c;
else
c = 'A';
return c;
}
Anope::string IRCDProto::UID_Retrieve()
{
if (!IRCD || !IRCD->RequiresID)
return "";
static Anope::string current_uid = "AAAAAA";
do
{
int current_len = current_uid.length() - 1;
while (current_len >= 0 && nextID(current_uid[current_len--]) == 'A');
}
while (User::Find(Me->GetSID() + current_uid) != NULL);
return Me->GetSID() + current_uid;
}
Anope::string IRCDProto::SID_Retrieve()
{
if (!IRCD || !IRCD->RequiresID)
return "";
static Anope::string current_sid = Config->GetBlock("serverinfo")->Get<const Anope::string>("id");
if (current_sid.empty())
current_sid = "00A";
do
{
int current_len = current_sid.length() - 1;
while (current_len >= 0 && nextID(current_sid[current_len--]) == 'A');
}
while (Server::Find(current_sid) != NULL);
return current_sid;
}
void IRCDProto::SendKill(const MessageSource &source, const Anope::string &target, const Anope::string &reason)
{
UplinkSocket::Message(source) << "KILL " << target << " :" << reason;