diff options
Diffstat (limited to 'modules/protocol/charybdis.cpp')
-rw-r--r-- | modules/protocol/charybdis.cpp | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/modules/protocol/charybdis.cpp b/modules/protocol/charybdis.cpp index 6f41abcc5..1fb017fef 100644 --- a/modules/protocol/charybdis.cpp +++ b/modules/protocol/charybdis.cpp @@ -11,6 +11,7 @@ #include "module.h" +static bool sasl = true; static Anope::string UplinkSID; static ServiceReference<IRCDProto> ratbox("IRCDProto", "ratbox"); @@ -52,7 +53,7 @@ class CharybdisProto : public IRCDProto void SendAkill(User *u, XLine *x) anope_override { ratbox->SendAkill(u, x); } void SendAkillDel(const XLine *x) anope_override { ratbox->SendAkillDel(x); } void SendSQLineDel(const XLine *x) anope_override { ratbox->SendSQLineDel(x); } - void SendJoin(const User *user, Channel *c, const ChannelStatus *status) anope_override { ratbox->SendJoin(user, c, status); } + void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override { ratbox->SendJoin(user, c, status); } void SendServer(const Server *server) anope_override { ratbox->SendServer(server); } void SendChannel(Channel *c) anope_override { ratbox->SendChannel(c); } void SendTopic(BotInfo *bi, Channel *c) anope_override { ratbox->SendTopic(bi, c); } @@ -64,7 +65,7 @@ class CharybdisProto : public IRCDProto void SendConnect() anope_override { - UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink]->password << " TS 6 :" << Me->GetSID(); + UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " TS 6 :" << Me->GetSID(); /* * Received: CAPAB :BAN CHW CLUSTER ENCAP EOPMOD EUID EX IE KLN * KNOCK MLOCK QS RSFNC SAVE SERVICES TB UNKLN @@ -109,14 +110,6 @@ class CharybdisProto : public IRCDProto UplinkSocket::Message(Me) << "EUID " << 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 - { - if (bi) - UplinkSocket::Message(bi) << "MODE " << u->GetUID() << " " << buf; - else - UplinkSocket::Message(Me) << "MODE " << u->GetUID() << " " << buf; - } - void SendLogin(User *u) anope_override { if (!u->Account()) @@ -136,12 +129,12 @@ class CharybdisProto : public IRCDProto << " " << newnick << " " << when << " " << u->timestamp; } - void SendSVSHold(const Anope::string &nick) + void SendSVSHold(const Anope::string &nick, time_t delay) anope_override { - UplinkSocket::Message(Me) << "ENCAP * NICKDELAY " << Config->NSReleaseTimeout << " " << nick; + UplinkSocket::Message(Me) << "ENCAP * NICKDELAY " << delay << " " << nick; } - void SendSVSHoldDel(const Anope::string &nick) + void SendSVSHoldDel(const Anope::string &nick) anope_override { UplinkSocket::Message(Me) << "ENCAP * NICKDELAY 0 " << nick; } @@ -191,7 +184,7 @@ struct IRCDMessageEncap : IRCDMessage * * Charybdis only accepts messages from SASL agents; these must have umode +S */ - if (params[1] == "SASL" && Config->NSSASL && params.size() == 6) + if (params[1] == "SASL" && sasl && params.size() == 6) { class CharybdisSASLIdentifyRequest : public IdentifyRequest { @@ -306,7 +299,7 @@ struct IRCDMessageServer : IRCDMessage if (params[1] != "1") return; new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], 1, params[2], UplinkSID); - IRCD->SendPing(Config->ServerName, params[0]); + IRCD->SendPing(Me->GetName(), params[0]); } }; @@ -332,6 +325,7 @@ class ProtoCharybdis : public Module Message::Away message_away; Message::Capab message_capab; Message::Error message_error; + Message::Invite message_invite; Message::Kick message_kick; Message::Kill message_kill; Message::Mode message_mode; @@ -357,6 +351,8 @@ class ProtoCharybdis : public Module IRCDMessagePass message_pass; IRCDMessageServer message_server; + bool use_server_side_mlock; + void AddModes() { /* Add user modes */ @@ -390,12 +386,12 @@ class ProtoCharybdis : public Module } public: - ProtoCharybdis(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL), + ProtoCharybdis(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR), ircd_proto(this), - message_away(this), message_capab(this), message_error(this), message_kick(this), message_kill(this), - message_mode(this), message_motd(this), message_part(this), message_ping(this), message_privmsg(this), - message_quit(this), message_squit(this), message_stats(this), message_time(this), message_topic(this), - message_version(this), message_whois(this), + message_away(this), message_capab(this), message_error(this), message_invite(this), message_kick(this), + message_kill(this), message_mode(this), message_motd(this), message_part(this), message_ping(this), + message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_time(this), + message_topic(this), message_version(this), message_whois(this), message_bmask("IRCDMessage", "charybdis/bmask", "ratbox/bmask"), message_join("IRCDMessage", "charybdis/join", "ratbox/join"), @@ -409,9 +405,8 @@ class ProtoCharybdis : public Module message_encap(this), message_euid(this), message_pass(this), message_server(this) { - this->SetAuthor("Anope"); - Implementation i[] = { I_OnChannelCreate, I_OnMLock, I_OnUnMLock }; + Implementation i[] = { I_OnReload, I_OnChannelCreate, I_OnMLock, I_OnUnMLock }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); if (ModuleManager::LoadModule("ratbox", User::Find(creator)) != MOD_ERR_OK) @@ -430,9 +425,15 @@ class ProtoCharybdis : public Module ModuleManager::UnloadModule(m_ratbox, NULL); } + void OnReload(Configuration::Conf *conf) anope_override + { + use_server_side_mlock = conf->GetModule(this)->Get<bool>("use_server_side_mlock"); + sasl = conf->GetModule(this)->Get<bool>("sasl"); + } + void OnChannelCreate(Channel *c) anope_override { - if (c->ci && Config->UseServerSideMLock && Servers::Capab.count("MLOCK") > 0) + if (use_server_side_mlock && c->ci && Servers::Capab.count("MLOCK") > 0) { Anope::string modes = c->ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(c->creation_time) << " " << c->ci->name << " " << modes; @@ -442,7 +443,7 @@ class ProtoCharybdis : public Module EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) anope_override { ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0 && Config->UseServerSideMLock) + if (use_server_side_mlock && cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) { Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar; UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; @@ -454,7 +455,7 @@ class ProtoCharybdis : public Module EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) anope_override { ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0 && Config->UseServerSideMLock) + if (use_server_side_mlock && cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) { Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, ""); UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; |