summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/protocol.h22
-rw-r--r--include/uplink.h8
-rw-r--r--modules/commands/cs_invite.cpp2
-rw-r--r--modules/commands/ns_ajoin.cpp12
-rw-r--r--modules/commands/os_oline.cpp4
-rw-r--r--modules/protocol/bahamut.cpp46
-rw-r--r--modules/protocol/inspircd-ts6.h86
-rw-r--r--modules/protocol/inspircd11.cpp74
-rw-r--r--modules/protocol/inspircd12.cpp9
-rw-r--r--modules/protocol/inspircd20.cpp13
-rw-r--r--modules/protocol/plexus.cpp78
-rw-r--r--modules/protocol/ratbox.cpp66
-rw-r--r--modules/protocol/unreal.cpp41
-rw-r--r--src/main.cpp71
-rw-r--r--src/messages.cpp32
-rw-r--r--src/protocol.cpp78
16 files changed, 302 insertions, 340 deletions
diff --git a/include/protocol.h b/include/protocol.h
index f1bb9dbbe..40ddb75b3 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -48,11 +48,11 @@ struct IRCDVar
class CoreExport IRCDProto
{
- private:
- virtual void SendSVSKillInternal(const BotInfo *, const User *, const Anope::string &) = 0;
- virtual void SendModeInternal(const BotInfo *, const Channel *, const Anope::string &) = 0;
+ protected:
+ virtual void SendSVSKillInternal(const BotInfo *, const User *, const Anope::string &);
+ virtual void SendModeInternal(const BotInfo *, const Channel *, const Anope::string &);
virtual void SendModeInternal(const BotInfo *, const User *, const Anope::string &) = 0;
- virtual void SendKickInternal(const BotInfo *, const Channel *, const User *, const Anope::string &) = 0;
+ virtual void SendKickInternal(const BotInfo *, const Channel *, const User *, const Anope::string &);
virtual void SendMessageInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf);
virtual void SendNoticeInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &msg);
virtual void SendPrivmsgInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf);
@@ -60,12 +60,12 @@ class CoreExport IRCDProto
virtual void SendPartInternal(const BotInfo *bi, const Channel *chan, const Anope::string &buf);
virtual void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf);
virtual void SendCTCPInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf);
- virtual void SendNumericInternal(const Anope::string &source, int numeric, const Anope::string &dest, const Anope::string &buf);
+ virtual void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf);
public:
virtual ~IRCDProto() { }
virtual void SendSVSNOOP(const Server *, bool) { }
- virtual void SendTopic(BotInfo *, Channel *) = 0;
+ virtual void SendTopic(BotInfo *, Channel *);
virtual void SendVhostDel(User *) { }
virtual void SendAkill(User *, const XLine *) = 0;
virtual void SendAkillDel(const XLine *) = 0;
@@ -86,12 +86,12 @@ class CoreExport IRCDProto
virtual void SendPong(const Anope::string &servname, const Anope::string &who);
virtual void SendJoin(User *, Channel *, const ChannelStatus *) = 0;
virtual void SendSQLineDel(const XLine *x) { }
- virtual void SendInvite(const BotInfo *bi, const Anope::string &chan, const Anope::string &nick);
+ virtual void SendInvite(const BotInfo *bi, const Channel *c, const User *u);
virtual void SendPart(const BotInfo *bi, const Channel *chan, const char *fmt, ...);
virtual void SendGlobops(const BotInfo *source, const char *fmt, ...);
virtual void SendSQLine(User *, const XLine *x) { }
virtual void SendSquit(Server *, const Anope::string &message);
- virtual void SendSVSO(const Anope::string &, const Anope::string &, const Anope::string &) { }
+ virtual void SendSVSO(const BotInfo *, const Anope::string &, const Anope::string &) { }
virtual void SendChangeBotNick(const BotInfo *bi, const Anope::string &newnick);
virtual void SendForceNickChange(const User *u, const Anope::string &newnick, time_t when);
virtual void SendVhost(User *, const Anope::string &, const Anope::string &) { }
@@ -103,14 +103,14 @@ class CoreExport IRCDProto
virtual void SendSZLine(User *u, const XLine *) { }
virtual void SendSGLine(User *, const XLine *) { }
virtual void SendCTCP(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
- virtual void SendSVSJoin(const Anope::string &, const Anope::string &, const Anope::string &, const Anope::string &) { }
- virtual void SendSWhois(const Anope::string &, const Anope::string &, const Anope::string &) { }
+ virtual void SendSVSJoin(const BotInfo *bi, const Anope::string &, const Anope::string &, const Anope::string &) { }
+ virtual void SendSWhois(const BotInfo *bi, const Anope::string &, const Anope::string &) { }
virtual void SendBOB() { }
virtual void SendEOB() { }
virtual void SendServer(const Server *) = 0;
virtual bool IsNickValid(const Anope::string &) { return true; }
virtual bool IsChannelValid(const Anope::string &);
- virtual void SendNumeric(const Anope::string &source, int numeric, const Anope::string &dest, const char *fmt, ...);
+ virtual void SendNumeric(int numeric, const Anope::string &dest, const char *fmt, ...);
virtual void SendLogin(User *u) = 0;
virtual void SendLogout(User *u) = 0;
diff --git a/include/uplink.h b/include/uplink.h
index 7f200d426..70b20a28b 100644
--- a/include/uplink.h
+++ b/include/uplink.h
@@ -25,11 +25,15 @@ class UplinkSocket : public ConnectionSocket, public BufferedSocket
class CoreExport Message
{
- Anope::string source;
+ private:
+ const Server *server;
+ const User *user;
std::stringstream buffer;
+
public:
Message();
- Message(const Anope::string &);
+ explicit Message(const Server *);
+ explicit Message(const User *);
~Message();
template<typename T> Message &operator<<(const T &val)
{
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> &params)
{
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> &params)
{
- 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;