summaryrefslogtreecommitdiff
path: root/modules/protocol/ngircd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/protocol/ngircd.cpp')
-rw-r--r--modules/protocol/ngircd.cpp51
1 files changed, 16 insertions, 35 deletions
diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp
index e54a4f8f7..3d1a727e7 100644
--- a/modules/protocol/ngircd.cpp
+++ b/modules/protocol/ngircd.cpp
@@ -53,7 +53,7 @@ class ngIRCdProto : public IRCDProto
void SendConnect() anope_override
{
- UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink]->password << " 0210-IRC+ Anope|" << Anope::VersionShort() << ":CLHMSo P";
+ UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " 0210-IRC+ Anope|" << Anope::VersionShort() << ":CLHMSo P";
/* Make myself known to myself in the serverlist */
SendServer(Me);
/* finish the enhanced server handshake and register the connection */
@@ -83,7 +83,7 @@ class ngIRCdProto : public IRCDProto
UplinkSocket::Message(Me) << "WALLOPS :" << buf;
}
- void SendJoin(const User *user, Channel *c, const ChannelStatus *status) anope_override
+ void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override
{
UplinkSocket::Message(user) << "JOIN " << c->name;
if (status)
@@ -95,12 +95,11 @@ class ngIRCdProto : public IRCDProto
*/
ChanUserContainer *uc = c->FindUser(user);
if (uc != NULL)
- uc->status.modes.clear();
+ uc->status.Clear();
BotInfo *setter = BotInfo::Find(user->nick);
- for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
- if (cs.modes.count(ModeManager::ChannelModes[i]->name))
- c->SetMode(setter, ModeManager::ChannelModes[i], user->GetUID(), false);
+ for (size_t i = 0; i < cs.Modes().length(); ++i)
+ c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false);
}
}
@@ -124,14 +123,6 @@ class ngIRCdProto : public IRCDProto
UplinkSocket::Message(Me) << "MODE " << dest->name << " " << buf;
}
- void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) anope_override
- {
- if (bi)
- UplinkSocket::Message(bi) << "MODE " << u->nick << " " << buf;
- else
- UplinkSocket::Message(Me) << "MODE " << u->nick << " " << buf;
- }
-
void SendPartInternal(const BotInfo *bi, const Channel *chan, const Anope::string &buf) anope_override
{
if (!buf.empty())
@@ -193,11 +184,10 @@ struct IRCDMessage005 : IRCDMessage
}
else if (parameter == "NICKLEN")
{
- unsigned newlen = convertTo<unsigned>(data);
- if (Config->NickLen != newlen)
+ unsigned newlen = convertTo<unsigned>(data), len = Config->GetBlock("networkinfo")->Get<unsigned>("nicklen");
+ if (len != newlen)
{
- Log() << "NickLen changed from " << Config->NickLen << " to " << newlen;
- Config->NickLen = newlen;
+ Log() << "Warning: NICKLEN is " << newlen << " but networkinfo:nicklen is " << len;
}
}
}
@@ -245,10 +235,8 @@ struct IRCDMessageChaninfo : IRCDMessage
*/
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
{
-
- Channel *c = Channel::Find(params[0]);
- if (!c)
- c = new Channel(params[0]);
+ bool created;
+ Channel *c = Channel::FindOrCreate(params[0], created);
Anope::string modes = params[1];
@@ -470,15 +458,8 @@ struct IRCDMessageNJoin : IRCDMessage
/* Get prefixes from the nick */
for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));)
{
- ChannelMode *cm = ModeManager::FindChannelModeByChar(ch);
buf.erase(buf.begin());
- if (!cm)
- {
- Log(LOG_DEBUG) << "Received unknown mode prefix " << ch << " in NJOIN string.";
- continue;
- }
-
- sju.first.modes.insert(cm->name);
+ sju.first.AddMode(ch);
}
sju.second = User::Find(buf);
@@ -558,7 +539,7 @@ struct IRCDMessageServer : IRCDMessage
* when receiving a new server and then finish sync once we
* get a pong back from that server.
*/
- IRCD->SendPing(Config->ServerName, params[0]);
+ IRCD->SendPing(Me->GetName(), params[0]);
}
};
@@ -588,6 +569,7 @@ class ProtongIRCd : public Module
/* Core message handlers */
Message::Capab message_capab;
Message::Error message_error;
+ Message::Invite message_invite;
Message::Kick message_kick;
Message::Kill message_kill;
Message::MOTD message_motd;
@@ -659,17 +641,16 @@ class ProtongIRCd : public Module
}
public:
- ProtongIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL),
+ ProtongIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR),
ircd_proto(this),
- message_capab(this), message_error(this), message_kick(this), message_kill(this), message_motd(this),
- message_part(this), message_ping(this), message_privmsg(this), message_squery(this, "SQUERY"),
+ message_capab(this), message_error(this), message_invite(this), message_kick(this), message_kill(this),
+ message_motd(this), message_part(this), message_ping(this), message_privmsg(this), message_squery(this, "SQUERY"),
message_quit(this), message_squit(this), message_stats(this), message_time(this), message_version(this),
message_005(this), message_376(this), message_chaninfo(this), message_join(this), message_metadata(this),
message_mode(this), message_nick(this), message_njoin(this), message_pong(this), message_server(this),
message_topic(this)
{
- this->SetAuthor("Anope");
Servers::Capab.insert("QS");