summaryrefslogtreecommitdiff
path: root/modules/protocol/unreal.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-02-19 20:54:55 -0500
committerAdam <Adam@anope.org>2012-02-19 20:54:55 -0500
commitb84e0804636d3868684c6ec2670207e7ae1cadeb (patch)
tree059be9a9da7b530970bc44f2c8eee5f61497a82e /modules/protocol/unreal.cpp
parent0ba58d7d0eea4e2a0e0d18a66880f84af6fea60e (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/unreal.cpp')
-rw-r--r--modules/protocol/unreal.cpp41
1 files changed, 19 insertions, 22 deletions
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 &param) anope_override
+ void SendSVSJoin(const BotInfo *source, const Anope::string &nick, const Anope::string &chan, const Anope::string &param) 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);