diff options
author | Adam <Adam@Anope.org> | 2010-05-24 23:36:40 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-06-18 21:04:05 -0400 |
commit | 2fba686904e6f78ebab35df171c5757afeebf05d (patch) | |
tree | 523782bccc479606206f271cd6708b2f70fe8278 /src/protocol | |
parent | 3a2c2a916a26f4fa1844e71a9f1c2fc25337fd2b (diff) |
Burned slist, rewrote operservs XLine code
Diffstat (limited to 'src/protocol')
-rw-r--r-- | src/protocol/bahamut.c | 46 | ||||
-rw-r--r-- | src/protocol/inspircd11.c | 32 | ||||
-rw-r--r-- | src/protocol/inspircd12.cpp | 34 | ||||
-rw-r--r-- | src/protocol/ratbox.c | 30 | ||||
-rw-r--r-- | src/protocol/unreal32.c | 48 |
5 files changed, 82 insertions, 108 deletions
diff --git a/src/protocol/bahamut.c b/src/protocol/bahamut.c index 14dc68cb5..040144737 100644 --- a/src/protocol/bahamut.c +++ b/src/protocol/bahamut.c @@ -23,7 +23,7 @@ IRCDVar myIrcd[] = { "+o", /* Channel Umode used by Botserv bots */ 1, /* SVSNICK */ 0, /* Vhost */ - 1, /* Supports SGlines */ + 1, /* Supports SNlines */ 1, /* Supports SQlines */ 1, /* Supports SZlines */ 3, /* Number of server args */ @@ -141,35 +141,33 @@ class BahamutIRCdProto : public IRCDProto } /* SQLINE */ - void SendSQLine(const std::string &mask, const std::string &reason) + void SendSQLine(XLine *x) { - if (mask.empty() || reason.empty()) - return; - send_cmd(NULL, "SQLINE %s :%s", mask.c_str(), reason.c_str()); + send_cmd(NULL, "SQLINE %s :%s", x->Mask.c_str(), x->Reason.c_str()); } - /* UNSGLINE */ - void SendSGLineDel(SXLine *sx) + /* UNSLINE */ + void SendSGLineDel(XLine *x) { - send_cmd(NULL, "UNSGLINE 0 :%s", sx->mask); + send_cmd(NULL, "UNSGLINE 0 :%s", x->Mask.c_str()); } /* UNSZLINE */ - void SendSZLineDel(SXLine *sx) + void SendSZLineDel(XLine *x) { /* this will likely fail so its only here for legacy */ - send_cmd(NULL, "UNSZLINE 0 %s", sx->mask); + send_cmd(NULL, "UNSZLINE 0 %s", x->Mask.c_str()); /* this is how we are supposed to deal with it */ - send_cmd(NULL, "RAKILL %s *", sx->mask); + send_cmd(NULL, "RAKILL %s *", x->Mask.c_str()); } /* SZLINE */ - void SendSZLine(SXLine *sx) + void SendSZLine(XLine *x) { /* this will likely fail so its only here for legacy */ - send_cmd(NULL, "SZLINE %s :%s", sx->mask, sx->reason); + send_cmd(NULL, "SZLINE %s :%s", x->Mask.c_str(), x->Reason.c_str()); /* this is how we are supposed to deal with it */ - send_cmd(NULL, "AKILL %s * %d %s %ld :%s", sx->mask, 172800, sx->by, static_cast<long>(time(NULL)), sx->reason); + send_cmd(NULL, "AKILL %s * %d %s %ld :%s", x->Mask.c_str(), 172800, x->By.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str()); } /* SVSNOOP */ @@ -179,15 +177,15 @@ class BahamutIRCdProto : public IRCDProto } /* SGLINE */ - void SendSGLine(SXLine *sx) + void SendSGLine(XLine *x) { - send_cmd(NULL, "SGLINE %d :%s:%s", static_cast<int>(strlen(sx->mask)), sx->mask, sx->reason); + send_cmd(NULL, "SGLINE %d :%s:%s", x->Mask.length(), x->Mask.c_str(), x->Reason.c_str()); } /* RAKILL */ - void SendAkillDel(Akill *ak) + void SendAkillDel(XLine *x) { - send_cmd(NULL, "RAKILL %s %s", ak->host, ak->user); + send_cmd(NULL, "RAKILL %s %s", x->GetHost().c_str(), x->GetUser().c_str()); } /* TOPIC */ @@ -197,11 +195,9 @@ class BahamutIRCdProto : public IRCDProto } /* UNSQLINE */ - void SendSQLineDel(const std::string &user) + void SendSQLineDel(XLine *x) { - if (user.empty()) - return; - send_cmd(NULL, "UNSQLINE %s", user.c_str()); + send_cmd(NULL, "UNSQLINE %s", x->Mask.c_str()); } /* JOIN - SJOIN */ @@ -210,12 +206,12 @@ class BahamutIRCdProto : public IRCDProto send_cmd(user->nick, "SJOIN %ld %s", static_cast<long>(chantime), channel); } - void SendAkill(Akill *ak) + void SendAkill(XLine *x) { // Calculate the time left before this would expire, capping it at 2 days - time_t timeleft = ak->expires - time(NULL); + time_t timeleft = x->Expires - time(NULL); if (timeleft > 172800) timeleft = 172800; - send_cmd(NULL, "AKILL %s %s %d %s %ld :%s", ak->host, ak->user, static_cast<int>(timeleft), ak->by, static_cast<long>(time(NULL)), ak->reason); + send_cmd(NULL, "AKILL %s %s %d %s %ld :%s", x->GetHost().c_str(), x->GetUser().c_str(), static_cast<int>(timeleft), x->By.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str()); } /* diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.c index 4c698edad..8fe766824 100644 --- a/src/protocol/inspircd11.c +++ b/src/protocol/inspircd11.c @@ -40,7 +40,7 @@ IRCDVar myIrcd[] = { "+ao", /* Channel Umode used by Botserv bots */ 1, /* SVSNICK */ 1, /* Vhost */ - 1, /* Supports SGlines */ + 1, /* Supports SNlines */ 1, /* Supports SQlines */ 1, /* Supports SZlines */ 4, /* Number of server args */ @@ -119,9 +119,9 @@ void inspircd_cmd_pass(const char *pass) class InspIRCdProto : public IRCDProto { - void SendAkillDel(Akill *ak) + void SendAkillDel(XLine *x) { - send_cmd(Config.s_OperServ, "GLINE %s@%s", ak->user, ak->host); + send_cmd(Config.s_OperServ, "GLINE %s", x->Mask.c_str()); } void SendTopic(BotInfo *whosets, Channel *c, const char *whosetit, const char *topic) @@ -142,13 +142,13 @@ class InspIRCdProto : public IRCDProto } } - void SendAkill(Akill *ak) + void SendAkill(XLine *x) { // Calculate the time left before this would expire, capping it at 2 days - time_t timeleft = ak->expires - time(NULL); + time_t timeleft = x->Expires - time(NULL); if (timeleft > 172800) timeleft = 172800; - send_cmd(Config.ServerName, "ADDLINE G %s@%s %s %ld %ld :%s", ak->user, ak->host, ak->by, static_cast<long>(time(NULL)), static_cast<long>(timeleft), ak->reason); + send_cmd(Config.ServerName, "ADDLINE G %s %s %ld %ld :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(time(NULL)), static_cast<long>(timeleft), x->Reason.c_str()); } void SendSVSKillInternal(BotInfo *source, User *user, const char *buf) @@ -214,19 +214,15 @@ class InspIRCdProto : public IRCDProto } /* UNSQLINE */ - void SendSQLineDel(const std::string &user) + void SendSQLineDel(XLine *x) { - if (user.empty()) - return; - send_cmd(Config.s_OperServ, "QLINE %s", user.c_str()); + send_cmd(Config.s_OperServ, "QLINE %s", x->Mask.c_str()); } /* SQLINE */ - void SendSQLine(const std::string &mask, const std::string &reason) + void SendSQLine(XLine *x) { - if (mask.empty() || reason.empty()) - return; - send_cmd(Config.ServerName, "ADDLINE Q %s %s %ld 0 :%s", mask.c_str(), Config.s_OperServ, static_cast<long>(time(NULL)), reason.c_str()); + send_cmd(Config.ServerName, "ADDLINE Q %s %s %ld 0 :%s", x->Mask.c_str(), Config.s_OperServ, static_cast<long>(time(NULL)), x->Reason.c_str()); } /* SQUIT */ @@ -281,15 +277,15 @@ class InspIRCdProto : public IRCDProto } /* UNSZLINE */ - void SendSZLineDel(SXLine *sx) + void SendSZLineDel(XLine *x) { - send_cmd(Config.s_OperServ, "ZLINE %s", sx->mask); + send_cmd(Config.s_OperServ, "ZLINE %s", x->Mask.c_str()); } /* SZLINE */ - void SendSZLine(SXLine *sx) + void SendSZLine(XLine *x) { - send_cmd(Config.ServerName, "ADDLINE Z %s %s %ld 0 :%s", sx->mask, sx->by, static_cast<long>(time(NULL)), sx->reason); + send_cmd(Config.ServerName, "ADDLINE Z %s %s %ld 0 :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str()); } /* SVSMODE +- */ diff --git a/src/protocol/inspircd12.cpp b/src/protocol/inspircd12.cpp index d326b6820..5fa330197 100644 --- a/src/protocol/inspircd12.cpp +++ b/src/protocol/inspircd12.cpp @@ -40,7 +40,7 @@ IRCDVar myIrcd[] = { "+ao", /* Channel Umode used by Botserv bots */ 1, /* SVSNICK */ 1, /* Vhost */ - 0, /* Supports SGlines */ + 0, /* Supports SNlines */ 1, /* Supports SQlines */ 1, /* Supports SZlines */ 4, /* Number of server args */ @@ -123,10 +123,10 @@ void inspircd_cmd_pass(const char *pass) class InspIRCdProto : public IRCDProto { - void SendAkillDel(Akill *ak) + void SendAkillDel(XLine *x) { BotInfo *bi = OperServ; - send_cmd(bi->uid, "GLINE %s@%s", ak->user, ak->host); + send_cmd(bi->uid, "GLINE %s", x->Mask.c_str()); } void SendTopic(BotInfo *whosets, Channel *c, const char *whosetit, const char *topic) @@ -147,14 +147,14 @@ class InspIRCdProto : public IRCDProto } } - void SendAkill(Akill *ak) + void SendAkill(XLine *x) { // Calculate the time left before this would expire, capping it at 2 days - time_t timeleft = ak->expires - time(NULL); - if (timeleft > 172800 || !ak->expires) + time_t timeleft = x->Expires - time(NULL); + if (timeleft > 172800 || !x->Expires) timeleft = 172800; BotInfo *bi = OperServ; - send_cmd(bi->uid, "ADDLINE G %s@%s %s %ld %ld :%s", ak->user, ak->host, ak->by, static_cast<long>(time(NULL)), static_cast<long>(timeleft), ak->reason); + send_cmd(bi->uid, "ADDLINE G %s@%s %s %ld %ld :%s", x->GetUser().c_str(), x->GetHost().c_str(), x->By.c_str(), static_cast<long>(time(NULL)), static_cast<long>(timeleft), x->Reason.c_str()); } void SendSVSKillInternal(BotInfo *source, User *user, const char *buf) @@ -219,19 +219,15 @@ class InspIRCdProto : public IRCDProto } /* UNSQLINE */ - void SendSQLineDel(const std::string &user) + void SendSQLineDel(XLine *x) { - if (user.empty()) - return; - send_cmd(TS6SID, "DELLINE Q %s", user.c_str()); + send_cmd(TS6SID, "DELLINE Q %s", x->Mask.c_str()); } /* SQLINE */ - void SendSQLine(const std::string &mask, const std::string &reason) + void SendSQLine(XLine *x) { - if (mask.empty() || reason.empty()) - return; - send_cmd(TS6SID, "ADDLINE Q %s %s %ld 0 :%s", mask.c_str(), Config.s_OperServ, static_cast<long>(time(NULL)), reason.c_str()); + send_cmd(TS6SID, "ADDLINE Q %s %s %ld 0 :%s", x->Mask.c_str(), Config.s_OperServ, static_cast<long>(time(NULL)), x->Reason.c_str()); } /* SQUIT */ @@ -288,15 +284,15 @@ class InspIRCdProto : public IRCDProto } /* UNSZLINE */ - void SendSZLineDel(SXLine *sx) + void SendSZLineDel(XLine *x) { - send_cmd(TS6SID, "DELLINE Z %s", sx->mask); + send_cmd(TS6SID, "DELLINE Z %s", x->Mask.c_str()); } /* SZLINE */ - void SendSZLine(SXLine *sx) + void SendSZLine(XLine *x) { - send_cmd(TS6SID, "ADDLINE Z %s %s %ld 0 :%s", sx->mask, sx->by, static_cast<long>(time(NULL)), sx->reason); + send_cmd(TS6SID, "ADDLINE Z %s %s %ld 0 :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str()); } /* SVSMODE -r */ diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c index 58ab14154..95ccf6392 100644 --- a/src/protocol/ratbox.c +++ b/src/protocol/ratbox.c @@ -23,7 +23,7 @@ IRCDVar myIrcd[] = { "+o", /* Channel Umode used by Botserv bots */ 0, /* SVSNICK */ 0, /* Vhost */ - 1, /* Supports SGlines */ + 1, /* Supports SNlines */ 1, /* Supports SQlines */ 0, /* Supports SZlines */ 3, /* Number of server args */ @@ -136,36 +136,32 @@ class RatboxProto : public IRCDTS6Proto send_cmd(TS6SID, "OPERWALL :%s", buf); } - void SendSQLine(const std::string &mask, const std::string &reason) + void SendSQLine(XLine *x) { - if (mask.empty() || reason.empty()) - return; - send_cmd(TS6SID, "RESV * %s :%s", mask.c_str(), reason.c_str()); + send_cmd(TS6SID, "RESV * %s :%s", x->Mask.c_str(), x->Reason.c_str()); } - void SendSGLineDel(SXLine *sx) + void SendSGLineDel(XLine *x) { BotInfo *bi = OperServ; - send_cmd(bi ? bi->uid : Config.s_OperServ, "UNXLINE * %s", sx->mask); + send_cmd(bi ? bi->uid : Config.s_OperServ, "UNXLINE * %s", x->Mask.c_str()); } - void SendSGLine(SXLine *sx) + void SendSGLine(XLine *x) { BotInfo *bi = OperServ; - send_cmd(bi ? bi->uid : Config.s_OperServ, "XLINE * %s 0 :%s", sx->mask, sx->reason); + send_cmd(bi ? bi->uid : Config.s_OperServ, "XLINE * %s 0 :%s", x->Mask.c_str(), x->Reason.c_str()); } - void SendAkillDel(Akill *ak) + void SendAkillDel(XLine *x) { BotInfo *bi = OperServ; - send_cmd(bi ? bi->uid : Config.s_OperServ, "UNKLINE * %s %s", ak->user, ak->host); + send_cmd(bi ? bi->uid : Config.s_OperServ, "UNKLINE * %s %s", x->GetUser().c_str(), x->GetHost().c_str()); } - void SendSQLineDel(const std::string &user) + void SendSQLineDel(XLine *x) { - if (user.empty()) - return; - send_cmd(TS6SID, "UNRESV * %s", user.c_str()); + send_cmd(TS6SID, "UNRESV * %s", x->Mask.c_str()); } void SendJoin(BotInfo *user, const char *channel, time_t chantime) @@ -173,10 +169,10 @@ class RatboxProto : public IRCDTS6Proto send_cmd(NULL, "SJOIN %ld %s + :%s", static_cast<long>(chantime), channel, user->uid.c_str()); } - void SendAkill(Akill *ak) + void SendAkill(XLine *x) { BotInfo *bi = OperServ; - send_cmd(bi ? bi->uid : Config.s_OperServ, "KLINE * %ld %s %s :%s", static_cast<long>(ak->expires - time(NULL)), ak->user, ak->host, ak->reason); + send_cmd(bi ? bi->uid : Config.s_OperServ, "KLINE * %ld %s %s :%s", static_cast<long>(x->Expires - time(NULL)), x->GetUser().c_str(), x->GetHost().c_str(), x->Reason.c_str()); } void SendSVSKillInternal(BotInfo *source, User *user, const char *buf) diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c index b14c48343..4d90e6bcf 100644 --- a/src/protocol/unreal32.c +++ b/src/protocol/unreal32.c @@ -23,7 +23,7 @@ IRCDVar myIrcd[] = { "+ao", /* Channel Umode used by Botserv bots */ 1, /* SVSNICK */ 1, /* Vhost */ - 1, /* Supports SGlines */ + 1, /* Supports SNlines */ 1, /* Supports SQlines */ 1, /* Supports SZlines */ 3, /* Number of server args */ @@ -133,9 +133,9 @@ class UnrealIRCdProto : public IRCDProto send_cmd(NULL, "f %s %s", server, set ? "+" : "-"); } - void SendAkillDel(Akill *ak) + void SendAkillDel(XLine *x) { - send_cmd(NULL, "BD - G %s %s %s", ak->user, ak->host, Config.s_OperServ); + send_cmd(NULL, "BD - G %s %s %s", x->GetUser().c_str(), x->GetHost().c_str(), Config.s_OperServ); } void SendTopic(BotInfo *whosets, Channel *c, const char *whosetit, const char *topic) @@ -153,12 +153,12 @@ class UnrealIRCdProto : public IRCDProto ModeManager::ProcessModes(); } - void SendAkill(Akill *ak) + void SendAkill(XLine *x) { // Calculate the time left before this would expire, capping it at 2 days - time_t timeleft = ak->expires - time(NULL); + time_t timeleft = x->Expires - time(NULL); if (timeleft > 172800) timeleft = 172800; - send_cmd(NULL, "BD + G %s %s %s %ld %ld :%s", ak->user, ak->host, ak->by, static_cast<long>(time(NULL) + timeleft), static_cast<long>(ak->expires), ak->reason); + send_cmd(NULL, "BD + G %s %s %s %ld %ld :%s", x->GetUser().c_str(), x->GetHost().c_str(), x->By.c_str(), static_cast<long>(time(NULL) + timeleft), static_cast<long>(x->Expires), x->Reason.c_str()); } void SendSVSKillInternal(BotInfo *source, User *user, const char *buf) @@ -228,31 +228,21 @@ class UnrealIRCdProto : public IRCDProto } /* unsqline - ** parv[0] = sender - ** parv[1] = nickmask */ - void SendSQLineDel(const std::string &user) + void SendSQLineDel(XLine *x) { - if (user.empty()) - return; - send_cmd(NULL, "d %s", user.c_str()); + send_cmd(NULL, "d %s", x->Mask.c_str()); } /* SQLINE */ /* - ** parv[0] = sender - ** parv[1] = nickmask - ** parv[2] = reason - ** ** - Unreal will translate this to TKL for us ** */ - void SendSQLine(const std::string &mask, const std::string &reason) + void SendSQLine(XLine *x) { - if (mask.empty() || reason.empty()) - return; - send_cmd(NULL, "c %s :%s", mask.c_str(), reason.c_str()); + send_cmd(NULL, "c %s :%s", x->Mask.c_str(), x->Reason.c_str()); } /* @@ -309,33 +299,33 @@ class UnrealIRCdProto : public IRCDProto /* * SVSNLINE - :realname mask */ - void SendSGLineDel(SXLine *sx) + void SendSGLineDel(XLine *x) { - send_cmd(NULL, "BR - :%s", sx->mask); + send_cmd(NULL, "BR - :%s", x->Mask.c_str()); } /* UNSZLINE */ - void SendSZLineDel(SXLine *sx) + void SendSZLineDel(XLine *x) { - send_cmd(NULL, "BD - Z * %s %s", sx->mask, Config.s_OperServ); + send_cmd(NULL, "BD - Z * %s %s", x->Mask.c_str(), Config.s_OperServ); } /* SZLINE */ - void SendSZLine(SXLine *sx) + void SendSZLine(XLine *x) { - send_cmd(NULL, "BD + Z * %s %s %ld %ld :%s", sx->mask, sx->by, static_cast<long>(time(NULL) + 172800), static_cast<long>(time(NULL)), sx->reason); + send_cmd(NULL, "BD + Z * %s %s %ld %ld :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(time(NULL) + 172800), static_cast<long>(time(NULL)), x->Reason.c_str()); } /* SGLINE */ /* * SVSNLINE + reason_where_is_space :realname mask with spaces */ - void SendSGLine(SXLine *sx) + void SendSGLine(XLine *x) { char edited_reason[BUFSIZE]; - strlcpy(edited_reason, sx->reason, BUFSIZE); + strlcpy(edited_reason, x->Reason.c_str(), BUFSIZE); strnrepl(edited_reason, BUFSIZE, " ", "_"); - send_cmd(NULL, "BR + %s :%s", edited_reason, sx->mask); + send_cmd(NULL, "BR + %s :%s", edited_reason, x->Mask.c_str()); } /* SVSMODE -b */ |