diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/commands/cs_invite.cpp | 2 | ||||
-rw-r--r-- | modules/commands/ns_ajoin.cpp | 12 | ||||
-rw-r--r-- | modules/commands/os_oline.cpp | 4 | ||||
-rw-r--r-- | modules/protocol/bahamut.cpp | 46 | ||||
-rw-r--r-- | modules/protocol/inspircd-ts6.h | 86 | ||||
-rw-r--r-- | modules/protocol/inspircd11.cpp | 74 | ||||
-rw-r--r-- | modules/protocol/inspircd12.cpp | 9 | ||||
-rw-r--r-- | modules/protocol/inspircd20.cpp | 13 | ||||
-rw-r--r-- | modules/protocol/plexus.cpp | 78 | ||||
-rw-r--r-- | modules/protocol/ratbox.cpp | 66 | ||||
-rw-r--r-- | modules/protocol/unreal.cpp | 41 |
11 files changed, 171 insertions, 260 deletions
diff --git a/modules/commands/cs_invite.cpp b/modules/commands/cs_invite.cpp index b38828c9d..be3132907 100644 --- a/modules/commands/cs_invite.cpp +++ b/modules/commands/cs_invite.cpp @@ -71,7 +71,7 @@ class CommandCSInvite : public Command { bool override = !ci->AccessFor(u).HasPriv("INVITE"); - ircdproto->SendInvite(ci->WhoSends(), chan, u2->nick); + ircdproto->SendInvite(ci->WhoSends(), c, u2); if (u2 != u) { source.Reply(_("\002%s\002 has been invited to \002%s\002."), u2->nick.c_str(), c->name.c_str()); diff --git a/modules/commands/ns_ajoin.cpp b/modules/commands/ns_ajoin.cpp index 5a5dbe7f0..03b710356 100644 --- a/modules/commands/ns_ajoin.cpp +++ b/modules/commands/ns_ajoin.cpp @@ -194,8 +194,9 @@ class NSAJoin : public Module void OnNickIdentify(User *u) anope_override { AJoinList *channels = u->Account()->GetExt<AJoinList *>("ns_ajoin_channels"); + BotInfo *bi = findbot(Config->NickServ); - if (channels == NULL) + if (channels == NULL || bi == NULL) return; for (unsigned i = 0; i < channels->size(); ++i) @@ -255,15 +256,14 @@ class NSAJoin : public Module } } - if (need_invite) + if (need_invite && c != NULL) { - BotInfo *bi = findbot(Config->NickServ); - if (!bi || !ci->AccessFor(u).HasPriv("INVITE")) + if (!ci->AccessFor(u).HasPriv("INVITE")) continue; - ircdproto->SendInvite(bi, channels->at(i).first, u->nick); + ircdproto->SendInvite(bi, c, u); } - ircdproto->SendSVSJoin(Config->NickServ, u->nick, channels->at(i).first, key); + ircdproto->SendSVSJoin(bi, u->nick, channels->at(i).first, key); } } }; diff --git a/modules/commands/os_oline.cpp b/modules/commands/os_oline.cpp index 5992f296e..3076da434 100644 --- a/modules/commands/os_oline.cpp +++ b/modules/commands/os_oline.cpp @@ -34,7 +34,7 @@ class CommandOSOLine : public Command source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); else if (u2 && flag[0] == '+') { - ircdproto->SendSVSO(Config->OperServ, nick, flag); + ircdproto->SendSVSO(source.owner, nick, flag); u2->SetMode(source.owner, UMODE_OPER); u2->SendMessage(source.owner, _("You are now an IRC Operator.")); source.Reply(_("Operflags \002%s\002 have been added for \002%s\002."), flag.c_str(), nick.c_str()); @@ -42,7 +42,7 @@ class CommandOSOLine : public Command } else if (u2 && flag[0] == '-') { - ircdproto->SendSVSO(Config->OperServ, nick, flag); + ircdproto->SendSVSO(source.owner, nick, flag); source.Reply(_("Operflags \002%s\002 have been added for \002%s\002."), flag.c_str(), nick.c_str()); Log(LOG_ADMIN, u, this) << "for " << nick; } diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index 8645c7176..078e19a7d 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -13,8 +13,8 @@ #include "module.h" -IRCDVar myIrcd[] = { - {"Bahamut 1.8.x", /* ircd name */ +IRCDVar myIrcd = { + "Bahamut 1.8.x", /* ircd name */ "+", /* Modes used by pseudoclients */ 1, /* SVSNICK */ 0, /* Vhost */ @@ -35,10 +35,7 @@ IRCDVar myIrcd[] = { 0, /* ts6 */ "$", /* TLD Prefix for Global */ 6, /* Max number of modes we can send per line */ - 0, /* IRCd sends a SSL users certificate fingerprint */ - } - , - {NULL} + 0 /* IRCd sends a SSL users certificate fingerprint */ }; @@ -47,26 +44,34 @@ class BahamutIRCdProto : public IRCDProto void SendModeInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) anope_override { if (Capab.count("TSMODE") > 0) - UplinkSocket::Message(source ? source->nick : Config->ServerName) << "MODE " << dest->name << " " << dest->creation_time << " " << buf; + { + if (source) + UplinkSocket::Message(source) << "MODE " << dest->name << " " << dest->creation_time << " " << buf; + else + UplinkSocket::Message(Me) << "MODE " << dest->name << " " << dest->creation_time << " " << buf; + } else - UplinkSocket::Message(source ? source->nick : Config->ServerName) << "MODE " << dest->name << " " << buf; + IRCDProto::SendModeInternal(source, dest, buf); } void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) anope_override { - UplinkSocket::Message(bi ? bi->nick : Config->ServerName) << "SVSMODE " << u->nick << " " << u->timestamp << " " << buf; + if (bi) + UplinkSocket::Message(bi) << "SVSMODE " << u->nick << " " << u->timestamp << " " << buf; + else + UplinkSocket::Message(Me) << "SVSMODE " << u->nick << " " << u->timestamp << " " << buf; } /* SVSHOLD - set */ void SendSVSHold(const Anope::string &nick) anope_override { - UplinkSocket::Message(Config->ServerName) << "SVSHOLD " << nick << " " << Config->NSReleaseTimeout << " :Being held for registered user"; + UplinkSocket::Message(Me) << "SVSHOLD " << nick << " " << Config->NSReleaseTimeout << " :Being held for registered user"; } /* SVSHOLD - release */ void SendSVSHoldDel(const Anope::string &nick) anope_override { - UplinkSocket::Message(Config->ServerName) << "SVSHOLD " << nick << " 0"; + UplinkSocket::Message(Me) << "SVSHOLD " << nick << " 0"; } /* SQLINE */ @@ -124,7 +129,7 @@ class BahamutIRCdProto : public IRCDProto /* TOPIC */ void SendTopic(BotInfo *whosets, Channel *c) anope_override { - UplinkSocket::Message(whosets->nick) << "TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_time << " :" << c->topic; + UplinkSocket::Message(whosets) << "TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_time << " :" << c->topic; } /* UNSQLINE */ @@ -136,7 +141,7 @@ class BahamutIRCdProto : public IRCDProto /* JOIN - SJOIN */ void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override { - UplinkSocket::Message(user->nick) << "SJOIN " << c->creation_time << " " << c->name; + UplinkSocket::Message(user) << "SJOIN " << c->creation_time << " " << c->name; if (status) { /* First save the channel status incase uc->Status == status */ @@ -169,7 +174,10 @@ class BahamutIRCdProto : public IRCDProto */ void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf) anope_override { - UplinkSocket::Message(source ? source->nick : "") << "SVSKILL " << user->nick << " :" << buf; + if (source) + UplinkSocket::Message(source) << "SVSKILL " << user->nick << " :" << buf; + else + UplinkSocket::Message() << "SVSKILL " << user->nick << " :" << buf; } void SendBOB() anope_override @@ -182,14 +190,6 @@ class BahamutIRCdProto : public IRCDProto UplinkSocket::Message() << "BURST 0"; } - void SendKickInternal(const BotInfo *source, const Channel *chan, const User *user, const Anope::string &buf) anope_override - { - if (!buf.empty()) - UplinkSocket::Message(source->nick) << "KICK " << chan->name << " " << user->nick << " :" << buf; - else - UplinkSocket::Message(source->nick) << "KICK " << chan->name << " " << user->nick; - } - void SendClientIntroduction(const User *u) anope_override { Anope::string modes = "+" + u->GetModes(); @@ -544,7 +544,7 @@ class ProtoBahamut : public Module { this->SetAuthor("Anope"); - pmodule_ircd_var(myIrcd); + pmodule_ircd_var(&myIrcd); pmodule_ircd_proto(&this->ircd_proto); pmodule_ircd_message(&this->ircd_message); diff --git a/modules/protocol/inspircd-ts6.h b/modules/protocol/inspircd-ts6.h index 8ba879c4c..99b86d3ce 100644 --- a/modules/protocol/inspircd-ts6.h +++ b/modules/protocol/inspircd-ts6.h @@ -36,7 +36,7 @@ class InspIRCdTS6Proto : public IRCDProto if (!has_chgidentmod) Log() << "CHGIDENT not loaded!"; else - UplinkSocket::Message(Config->HostServ) << "CHGIDENT " << nick << " " << vIdent; + UplinkSocket::Message(findbot(Config->HostServ)) << "CHGIDENT " << nick << " " << vIdent; } void SendChgHostInternal(const Anope::string &nick, const Anope::string &vhost) @@ -44,20 +44,19 @@ class InspIRCdTS6Proto : public IRCDProto if (!has_chghostmod) Log() << "CHGHOST not loaded!"; else - UplinkSocket::Message(Config->Numeric) << "CHGHOST " << nick << " " << vhost; + UplinkSocket::Message(Me) << "CHGHOST " << nick << " " << vhost; } public: void SendAkillDel(const XLine *x) anope_override { - BotInfo *bi = findbot(Config->OperServ); - UplinkSocket::Message(bi ? bi->GetUID() : Config->Numeric) << "GLINE " << x->Mask; + UplinkSocket::Message(findbot(Config->OperServ)) << "GLINE " << x->Mask; } void SendTopic(BotInfo *whosets, Channel *c) anope_override { - UplinkSocket::Message(whosets->GetUID()) << "FTOPIC " << c->name << " " << Anope::CurTime << " " << c->topic_setter << " :" << c->topic; + UplinkSocket::Message(whosets) << "FTOPIC " << c->name << " " << Anope::CurTime << " " << c->topic_setter << " :" << c->topic; } void SendVhostDel(User *u) anope_override @@ -77,54 +76,41 @@ class InspIRCdTS6Proto : public IRCDProto time_t timeleft = x->Expires - Anope::CurTime; if (timeleft > 172800 || !x->Expires) timeleft = 172800; - User *u = finduser(Config->OperServ); - UplinkSocket::Message(u ? u->GetUID() : Config->Numeric) << "ADDLINE G " << x->GetUser() << "@" << x->GetHost() << " " << x->By << " " << Anope::CurTime << " " << timeleft << " :" << x->Reason; - } - - void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf) anope_override - { - UplinkSocket::Message(source ? source->GetUID() : Config->Numeric) << "KILL " << user->GetUID() << " :" << buf; + BotInfo *bi = findbot(Config->OperServ); + UplinkSocket::Message(bi) << "ADDLINE G " << x->GetUser() << "@" << x->GetHost() << " " << x->By << " " << Anope::CurTime << " " << timeleft << " :" << x->Reason; } - void SendNumericInternal(const Anope::string &source, int numeric, const Anope::string &dest, const Anope::string &buf) anope_override + void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf) anope_override { - UplinkSocket::Message(Config->Numeric) << "PUSH " << dest << " ::" << source << " " << numeric << " " << dest << " " << buf; + UplinkSocket::Message() << "PUSH " << dest << " ::" << Me->GetName() << " " << numeric << " " << dest << " " << buf; } void SendModeInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) anope_override { - UplinkSocket::Message(source ? source->GetUID() : Config->Numeric) << "FMODE " << dest->name << " " << dest->creation_time << " " << buf; + UplinkSocket::Message(source) << "FMODE " << dest->name << " " << dest->creation_time << " " << buf; } void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) anope_override { - UplinkSocket::Message(bi ? bi->GetUID() : Config->Numeric) << "MODE " << u->GetUID() << " " << buf; + UplinkSocket::Message(bi) << "MODE " << u->GetUID() << " " << buf; } void SendClientIntroduction(const User *u) anope_override { Anope::string modes = "+" + u->GetModes(); - UplinkSocket::Message(Config->Numeric) << "UID " << u->GetUID() << " " << u->timestamp << " " << u->nick << " " << u->host << " " << u->host << " " << u->GetIdent() << " 0.0.0.0 " << u->my_signon << " " << modes << " :" << u->realname; - } - - void SendKickInternal(const BotInfo *source, const Channel *chan, const User *user, const Anope::string &buf) anope_override - { - if (!buf.empty()) - UplinkSocket::Message(source->GetUID()) << "KICK " << chan->name << " " << user->GetUID() << " :" << buf; - else - UplinkSocket::Message(source->GetUID()) << "KICK " << chan->name << " " << user->GetUID() << " :" << user->nick; + UplinkSocket::Message(Me) << "UID " << u->GetUID() << " " << u->timestamp << " " << u->nick << " " << u->host << " " << u->host << " " << u->GetIdent() << " 0.0.0.0 " << u->my_signon << " " << modes << " :" << u->realname; } /* SERVER services-dev.chatspike.net password 0 :Description here */ void SendServer(const Server *server) anope_override { - UplinkSocket::Message("") << "SERVER " << server->GetName() << " " << Config->Uplinks[CurrentUplink]->password << " " << server->GetHops() << " " << server->GetSID() << " :" << server->GetDescription(); + UplinkSocket::Message() << "SERVER " << server->GetName() << " " << Config->Uplinks[CurrentUplink]->password << " " << server->GetHops() << " " << server->GetSID() << " :" << server->GetDescription(); } /* JOIN */ void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override { - UplinkSocket::Message(Config->Numeric) << "FJOIN " << c->name << " " << c->creation_time << " +" << c->GetModes(true, true) << " :," << user->GetUID(); + UplinkSocket::Message(Me) << "FJOIN " << c->name << " " << c->creation_time << " +" << c->GetModes(true, true) << " :," << user->GetUID(); /* Note that we can send this with the FJOIN but choose not to * because the mode stacker will handle this and probably will * merge these modes with +nrt and other mlocked modes @@ -150,7 +136,7 @@ class InspIRCdTS6Proto : public IRCDProto /* UNSQLINE */ void SendSQLineDel(const XLine *x) anope_override { - UplinkSocket::Message(Config->Numeric) << "DELLINE Q " << x->Mask; + UplinkSocket::Message(Me) << "DELLINE Q " << x->Mask; } /* SQLINE */ @@ -160,7 +146,7 @@ class InspIRCdTS6Proto : public IRCDProto time_t timeleft = x->Expires - Anope::CurTime; if (timeleft > 172800 || !x->Expires) timeleft = 172800; - UplinkSocket::Message(Config->Numeric) << "ADDLINE Q " << x->Mask << " " << Config->OperServ << " " << Anope::CurTime << " " << timeleft << " :" << x->Reason; + UplinkSocket::Message(Me) << "ADDLINE Q " << x->Mask << " " << Config->OperServ << " " << Anope::CurTime << " " << timeleft << " :" << x->Reason; } /* Functions that use serval cmd functions */ @@ -176,9 +162,9 @@ class InspIRCdTS6Proto : public IRCDProto void SendConnect() anope_override { SendServer(Me); - UplinkSocket::Message(Config->Numeric) << "BURST"; + UplinkSocket::Message(Me) << "BURST"; Module *enc = ModuleManager::FindFirstOf(ENCRYPTION); - UplinkSocket::Message(Config->Numeric) << "VERSION :Anope-" << Anope::Version() << " " << Config->ServerName << " :" << ircd->name << " - (" << (enc ? enc->name : "unknown") << ") -- " << Anope::VersionBuildString(); + UplinkSocket::Message(Me) << "VERSION :Anope-" << Anope::Version() << " " << Config->ServerName << " :" << ircd->name << " - (" << (enc ? enc->name : "unknown") << ") -- " << Anope::VersionBuildString(); } /* SVSHOLD - set */ @@ -186,7 +172,7 @@ class InspIRCdTS6Proto : public IRCDProto { BotInfo *bi = findbot(Config->NickServ); if (bi) - UplinkSocket::Message(bi->GetUID()) << "SVSHOLD " << nick << " " << Config->NSReleaseTimeout << " :Being held for registered user"; + UplinkSocket::Message(bi) << "SVSHOLD " << nick << " " << Config->NSReleaseTimeout << " :Being held for registered user"; } /* SVSHOLD - release */ @@ -194,13 +180,13 @@ class InspIRCdTS6Proto : public IRCDProto { BotInfo *bi = findbot(Config->NickServ); if (bi) - UplinkSocket::Message(bi->GetUID()) << "SVSHOLD " << nick; + UplinkSocket::Message(bi) << "SVSHOLD " << nick; } /* UNSZLINE */ void SendSZLineDel(const XLine *x) anope_override { - UplinkSocket::Message(Config->Numeric) << "DELLINE Z " << x->GetHost(); + UplinkSocket::Message(Me) << "DELLINE Z " << x->GetHost(); } /* SZLINE */ @@ -210,39 +196,38 @@ class InspIRCdTS6Proto : public IRCDProto time_t timeleft = x->Expires - Anope::CurTime; if (timeleft > 172800 || !x->Expires) timeleft = 172800; - UplinkSocket::Message(Config->Numeric) << "ADDLINE Z " << x->GetHost() << " " << x->By << " " << Anope::CurTime << " " << timeleft <<" :" << x->Reason; + UplinkSocket::Message(Me) << "ADDLINE Z " << x->GetHost() << " " << x->By << " " << Anope::CurTime << " " << timeleft <<" :" << x->Reason; } - void SendSVSJoin(const Anope::string &source, const Anope::string &nick, const Anope::string &chan, const Anope::string &) anope_override + void SendSVSJoin(const BotInfo *source, const Anope::string &nick, const Anope::string &chan, const Anope::string &) anope_override { User *u = finduser(nick); - BotInfo *bi = findbot(source); - UplinkSocket::Message(bi->GetUID()) << "SVSJOIN " << u->GetUID() << " " << chan; + UplinkSocket::Message(source) << "SVSJOIN " << u->GetUID() << " " << chan; } - void SendSWhois(const Anope::string &, const Anope::string &who, const Anope::string &mask) anope_override + void SendSWhois(const BotInfo *, const Anope::string &who, const Anope::string &mask) anope_override { User *u = finduser(who); - UplinkSocket::Message(Config->Numeric) << "METADATA " << u->GetUID() << " swhois :" << mask; + UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " swhois :" << mask; } void SendBOB() anope_override { - UplinkSocket::Message(Config->Numeric) << "BURST " << Anope::CurTime; + UplinkSocket::Message(Me) << "BURST " << Anope::CurTime; } void SendEOB() anope_override { - UplinkSocket::Message(Config->Numeric) << "ENDBURST"; + UplinkSocket::Message(Me) << "ENDBURST"; } void SendGlobopsInternal(BotInfo *source, const Anope::string &buf) { if (has_globopsmod) - UplinkSocket::Message(source ? source->GetUID() : Config->Numeric) << "SNONOTICE g :" << buf; + UplinkSocket::Message(source) << "SNONOTICE g :" << buf; else - UplinkSocket::Message(source ? source->GetUID() : Config->Numeric) << "SNONOTICE A :" << buf; + UplinkSocket::Message(source) << "SNONOTICE A :" << buf; } void SendLogin(User *u) anope_override @@ -250,17 +235,17 @@ class InspIRCdTS6Proto : public IRCDProto if (!u->Account() || u->Account()->HasFlag(NI_UNCONFIRMED)) return; - UplinkSocket::Message(Config->Numeric) << "METADATA " << u->GetUID() << " accountname :" << u->Account()->display; + UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :" << u->Account()->display; } void SendLogout(User *u) anope_override { - UplinkSocket::Message(Config->Numeric) << "METADATA " << u->GetUID() << " accountname :"; + UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :"; } void SendChannel(Channel *c) anope_override { - UplinkSocket::Message(Config->Numeric) << "FJOIN " << c->name << " " << c->creation_time << " +" << c->GetModes(true, true) << " :"; + UplinkSocket::Message(Me) << "FJOIN " << c->name << " " << c->creation_time << " +" << c->GetModes(true, true) << " :"; } bool IsNickValid(const Anope::string &nick) anope_override @@ -455,7 +440,8 @@ class InspircdIRCdMessage : public IRCdMessage bool event_idle(const Anope::string &source, const std::vector<Anope::string> ¶ms) { BotInfo *bi = findbot(params[0]); - UplinkSocket::Message(bi ? bi->GetUID() : params[0]) << "IDLE " << source << " " << start_time << (bi ? Anope::CurTime - bi->lastmsg : 0); + if (bi) + UplinkSocket::Message(bi) << "IDLE " << source << " " << start_time << " " << (Anope::CurTime - bi->lastmsg); return true; } @@ -464,7 +450,7 @@ bool event_time(const Anope::string &source, const std::vector<Anope::string> &p if (params.size() < 2) return true; - UplinkSocket::Message(Config->Numeric) << "TIME " << source << " " << params[1] << " " << Anope::CurTime; + UplinkSocket::Message(Me) << "TIME " << source << " " << params[1] << " " << Anope::CurTime; return true; } @@ -473,7 +459,7 @@ bool event_rsquit(const Anope::string &source, const std::vector<Anope::string> /* On InspIRCd we must send a SQUIT when we recieve RSQUIT for a server we have juped */ Server *s = Server::Find(params[0]); if (s && s->HasFlag(SERVER_JUPED)) - UplinkSocket::Message(Config->Numeric) << "SQUIT " << s->GetSID() << " :" << (params.size() > 1 ? params[1].c_str() : ""); + UplinkSocket::Message(Me) << "SQUIT " << s->GetSID() << " :" << (params.size() > 1 ? params[1].c_str() : ""); ircdmessage->OnSQuit(source, params); diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp index 49a90f831..d25fd5a86 100644 --- a/modules/protocol/inspircd11.cpp +++ b/modules/protocol/inspircd11.cpp @@ -13,8 +13,8 @@ #include "module.h" -IRCDVar myIrcd[] = { - {"InspIRCd 1.1", /* ircd name */ +IRCDVar myIrcd = { + "InspIRCd 1.1", /* ircd name */ "+I", /* Modes used by pseudoclients */ 1, /* SVSNICK */ 1, /* Vhost */ @@ -35,10 +35,7 @@ IRCDVar myIrcd[] = { 0, /* ts6 */ "$", /* TLD Prefix for Global */ 20, /* Max number of modes we can send per line */ - 0, /* IRCd sends a SSL users certificate fingerprint */ - } - , - {NULL} + 0 /* IRCd sends a SSL users certificate fingerprint */ }; static bool has_servicesmod = false; @@ -51,15 +48,15 @@ static bool has_hidechansmod = false; /* CHGHOST */ void inspircd_cmd_chghost(const Anope::string &nick, const Anope::string &vhost) { + BotInfo *bi = findbot(Config->OperServ); if (has_chghostmod) { if (nick.empty() || vhost.empty()) return; - UplinkSocket::Message(Config->OperServ) << "CHGHOST " << nick << " " << vhost; + UplinkSocket::Message(bi) << "CHGHOST " << nick << " " << vhost; } else { - BotInfo *bi = findbot(Config->OperServ); if (bi) ircdproto->SendGlobops(bi, "CHGHOST not loaded!"); } @@ -67,8 +64,8 @@ void inspircd_cmd_chghost(const Anope::string &nick, const Anope::string &vhost) bool event_idle(const Anope::string &source, const std::vector<Anope::string> ¶ms) { - if (!params.empty()) - UplinkSocket::Message(params[0]) << "IDLE " << source << " " << Anope::CurTime << " 0"; + BotInfo *bi = findbot(params[0]); + UplinkSocket::Message(bi) << "IDLE " << source << " " << start_time << " " << (bi ? Anope::CurTime - bi->lastmsg : 0); return true; } @@ -84,12 +81,12 @@ class InspIRCdProto : public IRCDProto { void SendAkillDel(const XLine *x) anope_override { - UplinkSocket::Message(Config->OperServ) << "GLINE " << x->Mask; + UplinkSocket::Message(findbot(Config->OperServ)) << "GLINE " << x->Mask; } void SendTopic(BotInfo *whosets, Channel *c) anope_override { - UplinkSocket::Message(whosets->nick) << "FTOPIC " << c->name << " " << c->topic_time << " " << c->topic_setter <<" :" << c->topic; + UplinkSocket::Message(whosets) << "FTOPIC " << c->name << " " << c->topic_time << " " << c->topic_setter <<" :" << c->topic; } void SendVhostDel(User *u) anope_override @@ -109,54 +106,63 @@ class InspIRCdProto : public IRCDProto time_t timeleft = x->Expires - Anope::CurTime; if (timeleft > 172800 || !x->Expires) timeleft = 172800; - UplinkSocket::Message(Config->ServerName) << "ADDLINE G " << x->Mask << " " << x->By << " " << Anope::CurTime << " " << timeleft << " :" << x->Reason; + UplinkSocket::Message(Me) << "ADDLINE G " << x->Mask << " " << x->By << " " << Anope::CurTime << " " << timeleft << " :" << x->Reason; } void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf) anope_override { - UplinkSocket::Message(source ? source->nick : Config->ServerName) << "KILL " << user->nick << " :" << buf; + if (source) + UplinkSocket::Message(source) << "KILL " << user->nick << " :" << buf; + else + UplinkSocket::Message(Me) << "KILL " << user->nick << " :" << buf; } - void SendNumericInternal(const Anope::string &source, int numeric, const Anope::string &dest, const Anope::string &buf) anope_override + void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf) anope_override { - UplinkSocket::Message(source) << "PUSH " << dest << " ::" << source << " " << numeric << " " << dest << " " << buf; + UplinkSocket::Message() << "PUSH " << dest << " ::" << Me->GetName() << " " << numeric << " " << dest << " " << buf; } void SendModeInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) anope_override { - UplinkSocket::Message(source ? source->nick : Config->ServerName) << "FMODE " << dest->name << " " << dest->creation_time << " " << buf; + if (source) + UplinkSocket::Message(source) << "FMODE " << dest->name << " " << dest->creation_time << " " << buf; + else + UplinkSocket::Message(Me) << "FMODE " << dest->name << " " << dest->creation_time << " " << buf; } void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) anope_override { - UplinkSocket::Message(bi ? bi->nick : Config->ServerName) << "MODE " << u->nick << " " << buf; + if (bi) + UplinkSocket::Message(bi) << "MODE " << u->nick << " " << buf; + else + UplinkSocket::Message(Me) << "MODE " << u->nick << " " << buf; } void SendClientIntroduction(const User *u) anope_override { Anope::string modes = "+" + u->GetModes(); - UplinkSocket::Message(Config->ServerName) << "NICK " << u->timestamp << " " << u->nick << " " << u->host << " " << u->host << " " << u->GetIdent() << " " << modes << " 0.0.0.0 :" << u->realname; - UplinkSocket::Message(u->nick) << "OPERTYPE Service"; + UplinkSocket::Message(Me) << "NICK " << u->timestamp << " " << u->nick << " " << u->host << " " << u->host << " " << u->GetIdent() << " " << modes << " 0.0.0.0 :" << u->realname; + UplinkSocket::Message(u) << "OPERTYPE Service"; } void SendKickInternal(const BotInfo *source, const Channel *chan, const User *user, const Anope::string &buf) anope_override { if (!buf.empty()) - UplinkSocket::Message(source->nick) << "KICK " << chan->name << " " << user->nick << " :" << buf; + UplinkSocket::Message(source) << "KICK " << chan->name << " " << user->nick << " :" << buf; else - UplinkSocket::Message(source->nick) << "KICK " << chan->name << " " << user->nick << " :" << user->nick; + UplinkSocket::Message(source) << "KICK " << chan->name << " " << user->nick << " :" << user->nick; } /* SERVER services-dev.chatspike.net password 0 :Description here */ void SendServer(const Server *server) anope_override { - UplinkSocket::Message(Config->ServerName) << "SERVER " << server->GetName() << " " << currentpass << " " << server->GetHops() << " :" << server->GetDescription(); + UplinkSocket::Message(Me) << "SERVER " << server->GetName() << " " << currentpass << " " << server->GetHops() << " :" << server->GetDescription(); } /* JOIN */ void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override { - UplinkSocket::Message(user->nick) << "JOIN " << c->name << " " << c->creation_time; + UplinkSocket::Message(user) << "JOIN " << c->name << " " << c->creation_time; if (status) { /* First save the channel status incase uc->Status == status */ @@ -178,7 +184,7 @@ class InspIRCdProto : public IRCDProto /* UNSQLINE */ void SendSQLineDel(const XLine *x) anope_override { - UplinkSocket::Message(Config->OperServ) << "QLINE " << x->Mask; + UplinkSocket::Message(findbot(Config->OperServ)) << "QLINE " << x->Mask; } /* SQLINE */ @@ -188,7 +194,7 @@ class InspIRCdProto : public IRCDProto time_t timeleft = x->Expires - Anope::CurTime; if (timeleft > 172800 || !x->Expires) timeleft = 172800; - UplinkSocket::Message(Config->ServerName) << "ADDLINE Q " << x->Mask << " " << x->By << " " << Anope::CurTime << " " << timeleft << " :" << x->Reason; + UplinkSocket::Message(Me) << "ADDLINE Q " << x->Mask << " " << x->By << " " << Anope::CurTime << " " << timeleft << " :" << x->Reason; } /* Functions that use serval cmd functions */ @@ -207,7 +213,7 @@ class InspIRCdProto : public IRCDProto SendServer(Me); UplinkSocket::Message() << "BURST"; Module *enc = ModuleManager::FindFirstOf(ENCRYPTION); - UplinkSocket::Message(Config->ServerName) << "VERSION :Anope-" << Anope::Version() << " " << Me->GetName() << " :" << ircd->name << " - (" << (enc ? enc->name : "unknown") << ") -- " << Anope::VersionBuildString(); + UplinkSocket::Message(Me) << "VERSION :Anope-" << Anope::Version() << " " << Me->GetName() << " :" << ircd->name << " - (" << (enc ? enc->name : "unknown") << ") -- " << Anope::VersionBuildString(); } /* CHGIDENT */ @@ -217,7 +223,7 @@ class InspIRCdProto : public IRCDProto { if (nick.empty() || vIdent.empty()) return; - UplinkSocket::Message(Config->OperServ) << "CHGIDENT " << nick << " " << vIdent; + UplinkSocket::Message(findbot(Config->OperServ)) << "CHGIDENT " << nick << " " << vIdent; } else Log() << "CHGIDENT not loaded!"; @@ -226,19 +232,19 @@ class InspIRCdProto : public IRCDProto /* SVSHOLD - set */ void SendSVSHold(const Anope::string &nick) anope_override { - UplinkSocket::Message(Config->OperServ) << "SVSHOLD " << nick << " " << Config->NSReleaseTimeout << "s :Being held for registered user"; + UplinkSocket::Message(findbot(Config->OperServ)) << "SVSHOLD " << nick << " " << Config->NSReleaseTimeout << "s :Being held for registered user"; } /* SVSHOLD - release */ void SendSVSHoldDel(const Anope::string &nick) anope_override { - UplinkSocket::Message(Config->OperServ) << "SVSHOLD " << nick; + UplinkSocket::Message(findbot(Config->OperServ)) << "SVSHOLD " << nick; } /* UNSZLINE */ void SendSZLineDel(const XLine *x) anope_override { - UplinkSocket::Message(Config->OperServ) << "ZLINE " << x->GetHost(); + UplinkSocket::Message(findbot(Config->OperServ)) << "ZLINE " << x->GetHost(); } /* SZLINE */ @@ -248,10 +254,10 @@ class InspIRCdProto : public IRCDProto time_t timeleft = x->Expires - Anope::CurTime; if (timeleft > 172800 || !x->Expires) timeleft = 172800; - UplinkSocket::Message(Config->ServerName) << "ADDLINE Z " << x->GetHost() << " " << x->By << " " << Anope::CurTime << " " << timeleft << " :" << x->Reason; + UplinkSocket::Message(Me) << "ADDLINE Z " << x->GetHost() << " " << x->By << " " << Anope::CurTime << " " << timeleft << " :" << x->Reason; } - void SendSVSJoin(const Anope::string &source, const Anope::string &nick, const Anope::string &chan, const Anope::string &) anope_override + void SendSVSJoin(const BotInfo *source, const Anope::string &nick, const Anope::string &chan, const Anope::string &) anope_override { UplinkSocket::Message(source) << "SVSJOIN " << nick << " " << chan; } @@ -914,7 +920,7 @@ class ProtoInspIRCd : public Module { this->SetAuthor("Anope"); - pmodule_ircd_var(myIrcd); + pmodule_ircd_var(&myIrcd); pmodule_ircd_proto(&this->ircd_proto); pmodule_ircd_message(&this->ircd_message); diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp index e2ec39ebe..68014c52b 100644 --- a/modules/protocol/inspircd12.cpp +++ b/modules/protocol/inspircd12.cpp @@ -19,8 +19,8 @@ static bool has_chghostmod = false; static bool has_chgidentmod = false; #include "inspircd-ts6.h" -IRCDVar myIrcd[] = { - {"InspIRCd 1.2", /* ircd name */ +IRCDVar myIrcd = { + "InspIRCd 1.2", /* ircd name */ "+I", /* Modes used by pseudoclients */ 1, /* SVSNICK */ 1, /* Vhost */ @@ -42,9 +42,6 @@ IRCDVar myIrcd[] = { "$", /* TLD Prefix for Global */ 20, /* Max number of modes we can send per line */ 1, /* IRCd sends a SSL users certificate fingerprint */ - } - , - {NULL} }; static bool has_servicesmod = false; @@ -705,7 +702,7 @@ class ProtoInspIRCd : public Module { this->SetAuthor("Anope"); - pmodule_ircd_var(myIrcd); + pmodule_ircd_var(&myIrcd); pmodule_ircd_proto(&this->ircd_proto); pmodule_ircd_message(&this->ircd_message); diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index 619afdbde..c5034e47e 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -19,8 +19,8 @@ static bool has_chgidentmod = false; static bool has_globopsmod = true; // Not a typo #include "inspircd-ts6.h" -IRCDVar myIrcd[] = { - {"InspIRCd 2.0", /* ircd name */ +IRCDVar myIrcd = { + "InspIRCd 2.0", /* ircd name */ "+I", /* Modes used by pseudoclients */ 1, /* SVSNICK */ 1, /* Vhost */ @@ -42,9 +42,6 @@ IRCDVar myIrcd[] = { "$", /* TLD Prefix for Global */ 20, /* Max number of modes we can send per line */ 1, /* IRCd sends a SSL users certificate fingerprint */ - } - , - {NULL} }; static bool has_servicesmod = false; @@ -58,9 +55,9 @@ class InspIRCdProto : public InspIRCdTS6Proto UplinkSocket::Message() << "CAPAB CAPABILITIES :PROTOCOL=1202"; UplinkSocket::Message() << "CAPAB END"; SendServer(Me); - UplinkSocket::Message(Config->Numeric) << "BURST"; + UplinkSocket::Message(Me) << "BURST"; Module *enc = ModuleManager::FindFirstOf(ENCRYPTION); - UplinkSocket::Message(Config->Numeric) << "VERSION :Anope-" << Anope::Version() << " " << Me->GetName() << " :" << ircd->name <<" - (" << (enc ? enc->name : "unknown") << ") -- " << Anope::VersionBuildString(); + UplinkSocket::Message(Me) << "VERSION :Anope-" << Anope::Version() << " " << Me->GetName() << " :" << ircd->name <<" - (" << (enc ? enc->name : "unknown") << ") -- " << Anope::VersionBuildString(); } }; @@ -718,7 +715,7 @@ class ProtoInspIRCd : public Module { this->SetAuthor("Anope"); - pmodule_ircd_var(myIrcd); + pmodule_ircd_var(&myIrcd); pmodule_ircd_proto(&this->ircd_proto); pmodule_ircd_message(&this->ircd_message); diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index 0755ac327..3d28f9b7e 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -13,8 +13,8 @@ static Anope::string TS6UPLINK; -IRCDVar myIrcd[] = { - {"hybrid-7.2.3+plexus-3.0.1", /* ircd name */ +IRCDVar myIrcd = { + "hybrid-7.2.3+plexus-3.0.1", /* ircd name */ "+oi", /* Modes used by pseudoclients */ 1, /* SVSNICK */ 1, /* Vhost */ @@ -36,49 +36,46 @@ IRCDVar myIrcd[] = { "$$", /* TLD Prefix for Global */ 4, /* Max number of modes we can send per line */ 1, /* IRCd sends a SSL users certificate fingerprint */ - } - , - {NULL} }; class PlexusProto : public IRCDProto { void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf) anope_override { - UplinkSocket::Message(source ? source->GetUID() : Me->GetSID()) << "OPERWALL :" << buf; + UplinkSocket::Message(source) << "OPERWALL :" << buf; } void SendSQLine(User *, const XLine *x) anope_override { - UplinkSocket::Message(Me->GetSID()) << "RESV * " << x->Mask << " :" << x->Reason; + UplinkSocket::Message(Me) << "RESV * " << x->Mask << " :" << x->Reason; } void SendSGLineDel(const XLine *x) anope_override { BotInfo *bi = findbot(Config->OperServ); - UplinkSocket::Message(bi ? bi->GetUID() : Config->OperServ) << "UNXLINE * " << x->Mask; + UplinkSocket::Message(bi) << "UNXLINE * " << x->Mask; } void SendSGLine(User *, const XLine *x) anope_override { BotInfo *bi = findbot(Config->OperServ); - UplinkSocket::Message(bi ? bi->GetUID() : Config->OperServ) << "XLINE * " << x->Mask << " 0 :" << x->Reason; + UplinkSocket::Message(bi) << "XLINE * " << x->Mask << " 0 :" << x->Reason; } void SendAkillDel(const XLine *x) anope_override { BotInfo *bi = findbot(Config->OperServ); - UplinkSocket::Message(bi ? bi->GetUID() : Config->OperServ) << "UNKLINE * " << x->GetUser() << " " << x->GetHost(); + UplinkSocket::Message(bi) << "UNKLINE * " << x->GetUser() << " " << x->GetHost(); } void SendSQLineDel(const XLine *x) anope_override { - UplinkSocket::Message(Me->GetSID()) << "UNRESV * " << x->Mask; + UplinkSocket::Message(Me) << "UNRESV * " << x->Mask; } void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override { - UplinkSocket::Message(Me->GetSID()) << "SJOIN " << c->creation_time << " " << c->name << " +" << c->GetModes(true, true) << " :" << user->GetUID(); + UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name << " +" << c->GetModes(true, true) << " :" << user->GetUID(); if (status) { /* First save the channel status incase uc->Status == status */ @@ -104,12 +101,7 @@ class PlexusProto : public IRCDProto if (timeleft > 172800 || !x->Expires) timeleft = 172800; BotInfo *bi = findbot(Config->OperServ); - UplinkSocket::Message(bi ? bi->GetUID() : Config->OperServ) << "KLINE * " << timeleft << " " << x->GetUser() << " " << x->GetHost() << " :" << x->Reason; - } - - void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf) anope_override - { - UplinkSocket::Message(source ? source->GetUID() : Me->GetSID()) << "KILL " << user->GetUID() << " :" << buf; + UplinkSocket::Message(bi) << "KLINE * " << timeleft << " " << x->GetUser() << " " << x->GetHost() << " :" << x->Reason; } void SendServer(const Server *server) anope_override @@ -117,12 +109,12 @@ class PlexusProto : public IRCDProto if (server == Me) UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() << " :" << server->GetDescription(); else - UplinkSocket::Message(Me->GetSID()) << "SID " << server->GetName() << " " << server->GetHops() << " " << server->GetSID() << " :" << server->GetDescription(); + UplinkSocket::Message(Me) << "SID " << server->GetName() << " " << server->GetHops() << " " << server->GetSID() << " :" << server->GetDescription(); } void SendForceNickChange(const User *u, const Anope::string &newnick, time_t when) anope_override { - UplinkSocket::Message(Me->GetSID()) << "ENCAP " << u->server->GetName() << " SVSNICK " << u->GetUID() << " " << u->timestamp << " " << newnick << " " << when; + UplinkSocket::Message(Me) << "ENCAP " << u->server->GetName() << " SVSNICK " << u->GetUID() << " " << u->timestamp << " " << newnick << " " << when; } void SendVhostDel(User *u) anope_override @@ -137,8 +129,8 @@ class PlexusProto : public IRCDProto void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) anope_override { if (!ident.empty()) - UplinkSocket::Message(Me->GetSID()) << "ENCAP * CHGIDENT " << u->GetUID() << " " << ident; - UplinkSocket::Message(Me->GetSID()) << "ENCAP * CHGHOST " << u->GetUID() << " " << host; + UplinkSocket::Message(Me) << "ENCAP * CHGIDENT " << u->GetUID() << " " << ident; + UplinkSocket::Message(Me) << "ENCAP * CHGHOST " << u->GetUID() << " " << host; } void SendConnect() anope_override @@ -181,40 +173,12 @@ class PlexusProto : public IRCDProto void SendClientIntroduction(const User *u) anope_override { Anope::string modes = "+" + u->GetModes(); - UplinkSocket::Message(Me->GetSID()) << "UID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 255.255.255.255 " << u->GetUID() << " 0 " << u->host << " :" << u->realname; - } - - void SendPartInternal(const BotInfo *bi, const Channel *chan, const Anope::string &buf) anope_override - { - if (!buf.empty()) - UplinkSocket::Message(bi->GetUID()) << "PART " << chan->name << " :" << buf; - else - UplinkSocket::Message(bi->GetUID()) << "PART " << chan->name; - } - - void SendModeInternal(const BotInfo *bi, const Channel *dest, const Anope::string &buf) anope_override - { - UplinkSocket::Message(bi ? bi->GetUID() : Me->GetSID()) << "MODE " << dest->name << " " << buf; + UplinkSocket::Message(Me) << "UID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 255.255.255.255 " << u->GetUID() << " 0 " << u->host << " :" << u->realname; } void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) anope_override { - UplinkSocket::Message(bi ? bi->GetUID() : Me->GetSID()) << "ENCAP * SVSMODE " << u->GetUID() << " " << u->timestamp << " " << buf; - } - - void SendKickInternal(const BotInfo *bi, const Channel *chan, const User *user, const Anope::string &buf) anope_override - { - if (!buf.empty()) - UplinkSocket::Message(bi->GetUID()) << "KICK " << chan->name << " " << user->GetUID() << " :" << buf; - else - UplinkSocket::Message(bi->GetUID()) << "KICK " << chan->name << " " << user->GetUID(); - } - - /* INVITE */ - void SendInvite(const BotInfo *source, const Anope::string &chan, const Anope::string &nick) anope_override - { - User *u = finduser(nick); - UplinkSocket::Message(source->GetUID()) << "INVITE " << (u ? u->GetUID() : nick) << " " << chan; + UplinkSocket::Message(bi) << "ENCAP * SVSMODE " << u->GetUID() << " " << u->timestamp << " " << buf; } void SendLogin(User *u) anope_override @@ -222,17 +186,17 @@ class PlexusProto : public IRCDProto if (!u->Account()) return; - UplinkSocket::Message(Me->GetSID()) << "ENCAP * SU " << u->GetUID() << " " << u->Account()->display; + UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID() << " " << u->Account()->display; } void SendLogout(User *u) anope_override { - UplinkSocket::Message(Me->GetSID()) << "ENCAP * SU " << u->GetUID(); + UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID(); } void SendTopic(BotInfo *bi, Channel *c) anope_override { - UplinkSocket::Message(bi->GetUID()) << "ENCAP * TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_time + 1 << " :" << c->topic; + UplinkSocket::Message(bi) << "ENCAP * TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_time + 1 << " :" << c->topic; } void SendChannel(Channel *c) anope_override @@ -240,7 +204,7 @@ class PlexusProto : public IRCDProto Anope::string modes = c->GetModes(true, true); if (modes.empty()) modes = "+"; - UplinkSocket::Message(Me->GetSID()) << "SJOIN " << c->creation_time << " " << c->name << " " << modes << "%s :"; + UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name << " " << modes << " :"; } }; @@ -656,7 +620,7 @@ class ProtoPlexus : public Module { this->SetAuthor("Anope"); - pmodule_ircd_var(myIrcd); + pmodule_ircd_var(&myIrcd); pmodule_ircd_proto(&this->ircd_proto); pmodule_ircd_message(&this->ircd_message); diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index c694b1ddc..eeb0a50ac 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -13,8 +13,8 @@ static Anope::string TS6UPLINK; -IRCDVar myIrcd[] = { - {"Ratbox 2.0+", /* ircd name */ +IRCDVar myIrcd = { + "Ratbox 2.0+", /* ircd name */ "+oiS", /* Modes used by pseudoclients */ 0, /* SVSNICK */ 0, /* Vhost */ @@ -36,44 +36,41 @@ IRCDVar myIrcd[] = { "$$", /* TLD Prefix for Global */ 4, /* Max number of modes we can send per line */ 0, /* IRCd sends a SSL users certificate fingerprint */ - } - , - {NULL} }; class RatboxProto : public IRCDProto { void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf) anope_override { - UplinkSocket::Message(source ? source->GetUID() : Me->GetSID()) << "OPERWALL :" << buf; + UplinkSocket::Message(source) << "OPERWALL :" << buf; } void SendSQLine(User *, const XLine *x) anope_override { - UplinkSocket::Message(Me->GetSID()) << "RESV * " << x->Mask << " :" << x->Reason; + UplinkSocket::Message(Me) << "RESV * " << x->Mask << " :" << x->Reason; } void SendSGLineDel(const XLine *x) anope_override { BotInfo *bi = findbot(Config->OperServ); - UplinkSocket::Message(bi ? bi->GetUID() : Config->OperServ) << "UNXLINE * " << x->Mask; + UplinkSocket::Message(bi) << "UNXLINE * " << x->Mask; } void SendSGLine(User *, const XLine *x) anope_override { BotInfo *bi = findbot(Config->OperServ); - UplinkSocket::Message(bi ? bi->GetUID() : Config->OperServ) << "XLINE * " << x->Mask << " 0 :" << x->Reason; + UplinkSocket::Message(bi) << "XLINE * " << x->Mask << " 0 :" << x->Reason; } void SendAkillDel(const XLine *x) anope_override { BotInfo *bi = findbot(Config->OperServ); - UplinkSocket::Message(bi ? bi->GetUID() : Config->OperServ) << "UNKLINE * " << x->GetUser() << " " << x->GetHost(); + UplinkSocket::Message(bi) << "UNKLINE * " << x->GetUser() << " " << x->GetHost(); } void SendSQLineDel(const XLine *x) anope_override { - UplinkSocket::Message(Me->GetSID()) << "UNRESV * " << x->Mask; + UplinkSocket::Message(Me) << "UNRESV * " << x->Mask; } void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override @@ -99,12 +96,7 @@ class RatboxProto : public IRCDProto if (timeleft > 172800 || !x->Expires) timeleft = 172800; BotInfo *bi = findbot(Config->OperServ); - UplinkSocket::Message(bi ? bi->GetUID() : Config->OperServ) << "KLINE * " << timeleft << " " << x->GetUser() << " " << x->GetHost() << " :" << x->Reason; - } - - void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf) anope_override - { - UplinkSocket::Message(source ? source->GetUID() : Me->GetSID()) << "KILL " << user->GetUID() << " :" << buf; + UplinkSocket::Message(bi) << "KLINE * " << timeleft << " " << x->GetUser() << " " << x->GetHost() << " :" << x->Reason; } /* SERVER name hop descript */ @@ -151,40 +143,12 @@ class RatboxProto : public IRCDProto void SendClientIntroduction(const User *u) anope_override { Anope::string modes = "+" + u->GetModes(); - UplinkSocket::Message(Me->GetSID()) << "UID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 0 " << u->GetUID() << " :" << u->realname; - } - - void SendPartInternal(const BotInfo *bi, const Channel *chan, const Anope::string &buf) anope_override - { - if (!buf.empty()) - UplinkSocket::Message(bi->GetUID()) << "PART " << chan->name << " :" << buf; - else - UplinkSocket::Message(bi->GetUID()) << "PART " << chan->name; - } - - void SendModeInternal(const BotInfo *bi, const Channel *dest, const Anope::string &buf) anope_override - { - UplinkSocket::Message(bi ? bi->GetUID() : Me->GetSID()) << "MODE " << dest->name << " " << buf; + UplinkSocket::Message(Me) << "UID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 0 " << u->GetUID() << " :" << u->realname; } void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) anope_override { - UplinkSocket::Message(bi ? bi->GetUID() : Me->GetSID()) << "SVSMODE " << u->nick << " " << buf; - } - - void SendKickInternal(const BotInfo *bi, const Channel *chan, const User *user, const Anope::string &buf) anope_override - { - if (!buf.empty()) - UplinkSocket::Message(bi->GetUID()) << "KICK " << chan->name << " " << user->GetUID() << " :" << buf; - else - UplinkSocket::Message(bi->GetUID()) << "KICK " << chan->name << " " << user->GetUID(); - } - - /* INVITE */ - void SendInvite(const BotInfo *source, const Anope::string &chan, const Anope::string &nick) anope_override - { - User *u = finduser(nick); - UplinkSocket::Message(source->GetUID()) << "INVITE " << (u ? u->GetUID() : nick) << " " << chan; + UplinkSocket::Message(bi) << "SVSMODE " << u->nick << " " << buf; } void SendLogin(User *u) anope_override @@ -192,12 +156,12 @@ class RatboxProto : public IRCDProto if (!u->Account()) return; - UplinkSocket::Message(Me->GetSID()) << "ENCAP * SU " << u->GetUID() << " " << u->Account()->display; + UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID() << " " << u->Account()->display; } void SendLogout(User *u) anope_override { - UplinkSocket::Message(Me->GetSID()) << "ENCAP * SU " << u->GetUID(); + UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID(); } void SendChannel(Channel *c) anope_override @@ -226,7 +190,7 @@ class RatboxProto : public IRCDProto status.SetFlag(CMODE_OP); bi->Join(c, &status); } - UplinkSocket::Message(bi->GetUID()) << "TOPIC " << c->name << " :" << c->topic; + IRCDProto::SendTopic(bi, c); if (needjoin) bi->Part(c); } @@ -570,7 +534,7 @@ class ProtoRatbox : public Module { this->SetAuthor("Anope"); - pmodule_ircd_var(myIrcd); + pmodule_ircd_var(&myIrcd); pmodule_ircd_proto(&this->ircd_proto); pmodule_ircd_message(&this->ircd_message); diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index 78d4a04be..5a3a44bd7 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -13,8 +13,8 @@ #include "module.h" -IRCDVar myIrcd[] = { - {"UnrealIRCd 3.2.x", /* ircd name */ +IRCDVar myIrcd = { + "UnrealIRCd 3.2.x", /* ircd name */ "+Soiq", /* Modes used by pseudoclients */ 1, /* SVSNICK */ 1, /* Vhost */ @@ -35,10 +35,7 @@ IRCDVar myIrcd[] = { 0, /* ts6 */ "$", /* TLD Prefix for Global */ 12, /* Max number of modes we can send per line */ - 0, /* IRCd sends a SSL users certificate fingerprint */ - } - , - {NULL} + 0 /* IRCd sends a SSL users certificate fingerprint */ }; class UnrealIRCdProto : public IRCDProto @@ -56,7 +53,7 @@ class UnrealIRCdProto : public IRCDProto void SendTopic(BotInfo *whosets, Channel *c) anope_override { - UplinkSocket::Message(whosets->nick) << ") " << c->name << " " << c->topic_setter << " " << c->topic_time + 1 << " :" << c->topic; + UplinkSocket::Message(whosets) << ") " << c->name << " " << c->topic_setter << " " << c->topic_time + 1 << " :" << c->topic; } void SendVhostDel(User *u) anope_override @@ -72,24 +69,24 @@ class UnrealIRCdProto : public IRCDProto { // Calculate the time left before this would expire, capping it at 2 days time_t timeleft = x->Expires - Anope::CurTime; - if (timeleft > 172800) + if (timeleft > 172800 || !x->Expires) timeleft = 172800; UplinkSocket::Message() << "BD + G " << x->GetUser() << " " << x->GetHost() << " " << x->By << " " << Anope::CurTime + timeleft << " " << x->Created << " :" << x->Reason; } void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf) anope_override { - UplinkSocket::Message(source ? source->nick : Config->ServerName) << "h " << user->nick << " :" << buf; + UplinkSocket::Message(source) << "h " << user->nick << " :" << buf; } void SendModeInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) anope_override { - UplinkSocket::Message(source ? source->nick : Config->ServerName) << "G " << dest->name << " " << buf; + UplinkSocket::Message(source) << "G " << dest->name << " " << buf; } void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) anope_override { - UplinkSocket::Message(bi ? bi->nick : Config->ServerName) << "v " << u->nick <<" " << buf; + UplinkSocket::Message(bi) << "v " << u->nick <<" " << buf; } void SendClientIntroduction(const User *u) anope_override @@ -101,9 +98,9 @@ class UnrealIRCdProto : public IRCDProto void SendKickInternal(const BotInfo *source, const Channel *chan, const User *user, const Anope::string &buf) anope_override { if (!buf.empty()) - UplinkSocket::Message(source->nick) << "H " << chan->name << " " << user->nick << " :" << buf; + UplinkSocket::Message(source) << "H " << chan->name << " " << user->nick << " :" << buf; else - UplinkSocket::Message(source->nick) << "H " << chan->name << " " << user->nick; + UplinkSocket::Message(source) << "H " << chan->name << " " << user->nick; } /* SERVER name hop descript */ @@ -119,7 +116,7 @@ class UnrealIRCdProto : public IRCDProto /* JOIN */ void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override { - UplinkSocket::Message(Config->ServerName) << "~ " << c->creation_time << " " << c->name << " :" << user->nick; + UplinkSocket::Message(Me) << "~ " << c->creation_time << " " << c->name << " :" << user->nick; if (status) { /* First save the channel status incase uc->Status == status */ @@ -161,7 +158,7 @@ class UnrealIRCdProto : public IRCDProto ** parv[1] = nick ** parv[2] = options */ - void SendSVSO(const Anope::string &source, const Anope::string &nick, const Anope::string &flag) anope_override + void SendSVSO(const BotInfo *source, const Anope::string &nick, const Anope::string &flag) anope_override { UplinkSocket::Message(source) << "BB " << nick << " " << flag; } @@ -169,7 +166,7 @@ class UnrealIRCdProto : public IRCDProto /* NICK <newnick> */ void SendChangeBotNick(const BotInfo *oldnick, const Anope::string &newnick) anope_override { - UplinkSocket::Message(oldnick->nick) << "& " << newnick << " " << Anope::CurTime; + UplinkSocket::Message(oldnick) << "& " << newnick << " " << Anope::CurTime; } /* Functions that use serval cmd functions */ @@ -177,9 +174,9 @@ class UnrealIRCdProto : public IRCDProto void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) anope_override { if (!vIdent.empty()) - UplinkSocket::Message(Config->ServerName) << "AZ " << u->nick << " " << vIdent; + UplinkSocket::Message(Me) << "AZ " << u->nick << " " << vIdent; if (!vhost.empty()) - UplinkSocket::Message(Config->ServerName) << "AL " << u->nick << " " << vhost; + UplinkSocket::Message(Me) << "AL " << u->nick << " " << vhost; } void SendConnect() anope_override @@ -263,7 +260,7 @@ class UnrealIRCdProto : public IRCDProto /* In older Unreal SVSJOIN and SVSNLINE tokens were mixed so SVSJOIN and SVSNLINE are broken when coming from a none TOKEN'd server */ - void SendSVSJoin(const Anope::string &source, const Anope::string &nick, const Anope::string &chan, const Anope::string ¶m) anope_override + void SendSVSJoin(const BotInfo *source, const Anope::string &nick, const Anope::string &chan, const Anope::string ¶m) anope_override { if (!param.empty()) UplinkSocket::Message(source) << "BX " << nick << " " << chan << " :" << param; @@ -271,14 +268,14 @@ class UnrealIRCdProto : public IRCDProto UplinkSocket::Message(source) << "BX " << nick << " :" << chan; } - void SendSWhois(const Anope::string &source, const Anope::string &who, const Anope::string &mask) anope_override + void SendSWhois(const BotInfo *source, const Anope::string &who, const Anope::string &mask) anope_override { UplinkSocket::Message(source) << "BA " << who << " :" << mask; } void SendEOB() anope_override { - UplinkSocket::Message(Config->ServerName) << "ES"; + UplinkSocket::Message(Me) << "ES"; } bool IsNickValid(const Anope::string &nick) anope_override @@ -1157,7 +1154,7 @@ class ProtoUnreal : public Module { this->SetAuthor("Anope"); - pmodule_ircd_var(myIrcd); + pmodule_ircd_var(&myIrcd); pmodule_ircd_proto(&this->ircd_proto); pmodule_ircd_message(&this->ircd_message); |