diff options
| author | Adam <Adam@anope.org> | 2012-02-19 20:54:55 -0500 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2012-02-19 20:54:55 -0500 |
| commit | b84e0804636d3868684c6ec2670207e7ae1cadeb (patch) | |
| tree | 059be9a9da7b530970bc44f2c8eee5f61497a82e /modules/protocol | |
| parent | 0ba58d7d0eea4e2a0e0d18a66880f84af6fea60e (diff) | |
Made our message sources actual clients/servers, and put in a few more default messages for very standard things (KICK etc)
Diffstat (limited to 'modules/protocol')
| -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 |
8 files changed, 162 insertions, 251 deletions
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; |
