summaryrefslogtreecommitdiff
path: root/modules/protocol/charybdis.cpp
diff options
context:
space:
mode:
authorMichael Hazell <Techman-@users.noreply.github.com>2016-07-21 23:27:20 -0400
committerGitHub <noreply@github.com>2016-07-21 23:27:20 -0400
commitb578ed2544e38ce7b7459951059651635b8e4255 (patch)
tree7e1eede32f2b75a3928a0920dc55f871875a292e /modules/protocol/charybdis.cpp
parent0a7f1670604433f5be3a6c4e18d96e8d7b45bbd0 (diff)
charybdis.cpp: Properly support RESVs
Properly support RESV and UNRESV in Charybdis, and improve RESV setting for pseudoclients when bursting.
Diffstat (limited to 'modules/protocol/charybdis.cpp')
-rw-r--r--modules/protocol/charybdis.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/modules/protocol/charybdis.cpp b/modules/protocol/charybdis.cpp
index c381ef124..f0d01c8cc 100644
--- a/modules/protocol/charybdis.cpp
+++ b/modules/protocol/charybdis.cpp
@@ -31,13 +31,29 @@ class ChannelModeLargeBan : public ChannelMode
class CharybdisProto : public IRCDProto
{
+ BotInfo *FindIntroduced()
+ {
+ BotInfo *bi = Config->GetClient("OperServ");
+
+ if (bi && bi->introduced)
+ return bi;
+
+ for (botinfo_map::iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it)
+ if (it->second->introduced)
+ return it->second;
+
+ return NULL;
+ }
+
public:
+
CharybdisProto(Module *creator) : IRCDProto(creator, "Charybdis 3.4+")
{
DefaultPseudoclientModes = "+oiS";
CanCertFP = true;
CanSNLine = true;
CanSQLine = true;
+ CanSQLineChannel = true;
CanSZLine = true;
CanSVSNick = true;
CanSVSHold = true;
@@ -54,7 +70,6 @@ class CharybdisProto : public IRCDProto
void SendSGLineDel(const XLine *x) anope_override { ratbox->SendSGLineDel(x); }
void SendAkill(User *u, XLine *x) anope_override { ratbox->SendAkill(u, x); }
void SendAkillDel(const XLine *x) anope_override { ratbox->SendAkillDel(x); }
- void SendSQLineDel(const XLine *x) anope_override { ratbox->SendSQLineDel(x); }
void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override { ratbox->SendJoin(user, c, status); }
void SendServer(const Server *server) anope_override { ratbox->SendServer(server); }
void SendChannel(Channel *c) anope_override { ratbox->SendChannel(c); }
@@ -77,7 +92,18 @@ class CharybdisProto : public IRCDProto
void SendSQLine(User *, const XLine *x) anope_override
{
- UplinkSocket::Message(Me) << "RESV * " << x->mask << " :" << x->GetReason();
+ /* Calculate the time left before this would expire, capping it at 2 days */
+ time_t timeleft = x->expires - Anope::CurTime;
+
+ if (timeleft > 172800 || !x->expires)
+ timeleft = 172800;
+
+ UplinkSocket::Message(FindIntroduced()) << "ENCAP * RESV " << timeleft << " " << x->mask << " 0 :" << x->GetReason();
+ }
+
+ void SendSQLineDel(const XLine *x) anope_override
+ {
+ UplinkSocket::Message(Config->GetClient("OperServ")) << "ENCAP * UNRESV " << x->mask;
}
void SendConnect() anope_override