diff options
author | attilamolnar <attilamolnar@hush.com> | 2012-10-05 19:24:35 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2012-10-07 03:15:42 +0200 |
commit | bda3b1fa3a396e19fb04eda2f66d246e49572c20 (patch) | |
tree | f2feb08fc00bcf476108c65bf1a0f71245afeb3e | |
parent | 2d9541c4c8f5c725e95c55a2ccb8181c8d5f8be3 (diff) |
InspIRCd: Make functions that send ADDLINE and DELLINE, call them from the rest of the module
-rw-r--r-- | modules/protocol/inspircd-ts6.h | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/modules/protocol/inspircd-ts6.h b/modules/protocol/inspircd-ts6.h index 1f516baaf..8d4246570 100644 --- a/modules/protocol/inspircd-ts6.h +++ b/modules/protocol/inspircd-ts6.h @@ -47,6 +47,18 @@ class InspIRCdTS6Proto : public IRCDProto UplinkSocket::Message(Me) << "CHGHOST " << nick << " " << vhost; } + void SendAddLine(const Anope::string &type, const Anope::string &mask, time_t duration, const Anope::string &addedby, const Anope::string &reason) + { + const BotInfo *bi = findbot(Config->OperServ); + UplinkSocket::Message(bi) << "ADDLINE " << type << " " << mask << " " << addedby << " " << Anope::CurTime << " " << duration << " :" << reason; + } + + void SendDelLine(const Anope::string &type, const Anope::string &mask) + { + const BotInfo *bi = findbot(Config->OperServ); + UplinkSocket::Message(bi) << "DELLINE " << type << " " << mask; + } + protected: InspIRCdTS6Proto(const Anope::string &name) : IRCDProto(name) { @@ -83,13 +95,13 @@ class InspIRCdTS6Proto : public IRCDProto size_t h = x->Mask.find('#'); if (h != Anope::string::npos) mask = mask.replace(h, 1, ' '); - UplinkSocket::Message(bi) << "RLINE " << mask; + SendDelLine("R", mask); return; } else if (x->IsRegex() || x->HasNickOrReal()) return; - UplinkSocket::Message(bi) << "GLINE " << x->Mask; + SendDelLine("G", x->mask); } void SendTopic(BotInfo *whosets, Channel *c) anope_override @@ -128,7 +140,7 @@ class InspIRCdTS6Proto : public IRCDProto size_t h = x->Mask.find('#'); if (h != Anope::string::npos) mask = mask.replace(h, 1, ' '); - UplinkSocket::Message(bi) << "RLINE " << mask << " " << timeleft << " :" << x->GetReason(); + SendAddLineOperserv("R", mask, timeleft, x->By, x->GetReason()); return; } else if (x->IsRegex() || x->HasNickOrReal()) @@ -165,8 +177,7 @@ class InspIRCdTS6Proto : public IRCDProto } } catch (const SocketException &) { } - - UplinkSocket::Message(bi) << "ADDLINE G " << x->GetUser() << "@" << x->GetHost() << " " << x->By << " " << Anope::CurTime << " " << timeleft << " :" << x->GetReason(); + SendAddLine("G", x->GetUser() + "@" + x->GetHost(), timeleft, x->By, x->GetReason()); } void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf) anope_override @@ -225,7 +236,7 @@ class InspIRCdTS6Proto : public IRCDProto /* UNSQLINE */ void SendSQLineDel(const XLine *x) anope_override { - UplinkSocket::Message(Me) << "DELLINE Q " << x->Mask; + SendDelLine("Q", x->Mask); } /* SQLINE */ @@ -235,7 +246,7 @@ class InspIRCdTS6Proto : public IRCDProto time_t timeleft = x->Expires - Anope::CurTime; if (timeleft > 172800 || !x->Expires) timeleft = 172800; - UplinkSocket::Message(Me) << "ADDLINE Q " << x->Mask << " " << Config->OperServ << " " << Anope::CurTime << " " << timeleft << " :" << x->GetReason(); + SendAddLine("Q", x->Mask, timeleft, x->By, x->GetReason()); } /* Functions that use serval cmd functions */ @@ -275,7 +286,7 @@ class InspIRCdTS6Proto : public IRCDProto /* UNSZLINE */ void SendSZLineDel(const XLine *x) anope_override { - UplinkSocket::Message(Me) << "DELLINE Z " << x->GetHost(); + SendDelLine("Z", x->GetHost()); } /* SZLINE */ @@ -285,7 +296,7 @@ class InspIRCdTS6Proto : public IRCDProto time_t timeleft = x->Expires - Anope::CurTime; if (timeleft > 172800 || !x->Expires) timeleft = 172800; - UplinkSocket::Message(Me) << "ADDLINE Z " << x->GetHost() << " " << x->By << " " << Anope::CurTime << " " << timeleft <<" :" << x->GetReason(); + SendAddLine("Z", x->GetHost(), timeleft, x->By, x->GetReason()); } void SendSVSJoin(const BotInfo *source, const Anope::string &nick, const Anope::string &chan, const Anope::string &) anope_override |