1
0
mirror of https://github.com/anope/anope.git synced 2026-07-07 22:43:12 +02:00

Fixed a lot of small problems

This commit is contained in:
Adam
2011-02-25 21:40:43 -05:00
parent eea7d2eb77
commit ee38756982
26 changed files with 481 additions and 657 deletions
+4 -4
View File
@@ -77,15 +77,15 @@ class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>
/** Join this bot to a channel
* @param c The channel
* @param update_ts Assume we're updating the TS for this channel
* @param status The status the bot should have on the channel
*/
void Join(Channel *c, bool update_ts = false);
void Join(Channel *c, ChannelStatus *status = NULL);
/** Join this bot to a channel
* @param chname The channel name
* @param update_ts Assume we're updating the TS for this channel
* @param status The status the bot should have on the channel
*/
void Join(const Anope::string &chname, bool update_ts = false);
void Join(const Anope::string &chname, ChannelStatus *status = NULL);
/** Part this bot from a channel
* @param c The channel
+1 -1
View File
@@ -549,7 +549,7 @@ class CoreExport ServerConfig
/* Default botmodes on channels, defaults to ao */
Anope::string BotModes;
/* THe actual modes */
std::vector<ChannelModeStatus *> BotModeList;
ChannelStatus BotModeList;
/* How many times to try and reconnect to the uplink before giving up */
unsigned MaxRetries;
/* How long to wait between connection attempts */
+1 -1
View File
@@ -339,7 +339,7 @@ E User *finduser(const Anope::string &nick);
E User *do_nick(const Anope::string &source, const Anope::string &nick, const Anope::string &username, const Anope::string &host, const Anope::string &server, const Anope::string &realname, time_t ts, const Anope::string &ip, const Anope::string &vhost, const Anope::string &uid, const Anope::string &modes);
E void do_umode(const Anope::string &, const Anope::string &user, const Anope::string &modes);
E void do_umode(const Anope::string &user, const Anope::string &modes);
E void do_kill(User *user, const Anope::string &reason);
E bool matches_list(Channel *c, User *user, ChannelModeName mode);
+2 -2
View File
@@ -423,10 +423,10 @@ class CoreExport Module : public Extensible
virtual void OnBotNoFantasyAccess(const Anope::string &command, User *u, ChannelInfo *ci, const Anope::string &params) { }
/** Called after a bot joins a channel
* @param ci The channael
* @param c The channel
* @param bi The bot
*/
virtual void OnBotJoin(ChannelInfo *ci, BotInfo *bi) { }
virtual void OnBotJoin(Channel *c, BotInfo *bi) { }
/** Called when a bot places a ban
* @param u User being banned
+2 -3
View File
@@ -991,8 +991,7 @@ class CoreExport IRCDProto
virtual void SendQuit(const User *u, const char *fmt, ...);
virtual void SendPing(const Anope::string &servname, const Anope::string &who);
virtual void SendPong(const Anope::string &servname, const Anope::string &who);
virtual void SendJoin(const BotInfo *, const Anope::string &, time_t) = 0;
virtual void SendJoin(BotInfo *, const ChannelContainer *);
virtual void SendJoin(BotInfo *, Channel *, const ChannelStatus *) = 0;
virtual void SendSQLineDel(const XLine *x) = 0;
virtual void SendInvite(const BotInfo *bi, const Anope::string &chan, const Anope::string &nick);
virtual void SendPart(const BotInfo *bi, const Channel *chan, const char *fmt, ...);
@@ -1041,7 +1040,7 @@ class CoreExport IRCDProto
/** Send a channel creation message to the uplink.
* On most TS6 IRCds this is a SJOIN with no nick
*/
virtual void SendChannel(Channel *c, const Anope::string &modes) { }
virtual void SendChannel(Channel *c) { }
};
class CoreExport IRCdMessage
+6 -6
View File
@@ -877,9 +877,10 @@ class DBPlain : public Module
}
db_buffer << "MD MLOCK_ON";
{
Anope::string oldmodes;
std::vector<Anope::string> oldmodes;
if ((!Me || !Me->IsSynced()) && ci->GetExtRegular("db_mlock_modes_on", oldmodes))
db_buffer << " " << oldmodes;
for (unsigned i = 0; i < oldmodes.size(); ++i)
db_buffer << " " << oldmodes[i];
else
{
for (std::multimap<ChannelModeName, ModeLock>::const_iterator it = ci->GetMLock().begin(), it_end = ci->GetMLock().end(); it != it_end; ++it)
@@ -898,11 +899,10 @@ class DBPlain : public Module
db_buffer << endl;
db_buffer << "MD MLOCK_OFF";
{
Anope::string oldmodes;
std::vector<Anope::string> oldmodes;
if ((!Me || !Me->IsSynced()) && ci->GetExtRegular("db_mlock_modes_off", oldmodes))
{
db_buffer << " " << oldmodes;
}
for (unsigned i = 0; i < oldmodes.size(); ++i)
db_buffer << " " << oldmodes[i];
else
{
for (std::multimap<ChannelModeName, ModeLock>::const_iterator it = ci->GetMLock().begin(), it_end = ci->GetMLock().end(); it != it_end; ++it)
+56 -70
View File
@@ -75,18 +75,14 @@ class BahamutIRCdProto : public IRCDProto
{
void SendModeInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf)
{
if (buf.empty())
return;
if (Capab.HasFlag(CAPAB_TSMODE))
send_cmd(source->nick, "MODE %s 0 %s", dest->name.c_str(), buf.c_str());
send_cmd(source->nick, "MODE %s %ld %s", dest->name.c_str(), static_cast<long>(dest->creation_time), buf.c_str());
else
send_cmd(source->nick, "MODE %s %s", dest->name.c_str(), buf.c_str());
}
void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf)
{
if (buf.empty())
return;
send_cmd(bi ? bi->nick : Config->ServerName, "SVSMODE %s %ld %s", u->nick.c_str(), static_cast<long>(u->timestamp), buf.c_str());
}
@@ -163,22 +159,13 @@ class BahamutIRCdProto : public IRCDProto
}
/* JOIN - SJOIN */
void SendJoin(const BotInfo *user, const Anope::string &channel, time_t chantime)
void SendJoin(BotInfo *user, Channel *c, const ChannelStatus *status)
{
send_cmd(user->nick, "SJOIN %ld %s", static_cast<long>(chantime), channel.c_str());
}
void SendJoin(BotInfo *user, const ChannelContainer *cc)
{
SendJoin(user, cc->chan->name, cc->chan->creation_time);
for (std::map<char, ChannelMode *>::iterator it = ModeManager::ChannelModesByChar.begin(), it_end = ModeManager::ChannelModesByChar.end(); it != it_end; ++it)
{
if (cc->Status->HasFlag(it->second->Name))
{
cc->chan->SetMode(user, it->second, user->nick);
}
}
cc->chan->SetModes(user, false, "%s", cc->chan->GetModes(true, true).c_str());
send_cmd(user->nick, "SJOIN %ld %s", static_cast<long>(c->creation_time), c->name.c_str());
if (status)
for (size_t i = CMODE_BEGIN + 1; i != CMODE_END; ++i)
if (status->HasFlag(static_cast<ChannelModeName>(i)))
c->SetMode(user, static_cast<ChannelModeName>(i), user->nick, false);
}
void SendAkill(const XLine *x)
@@ -210,8 +197,6 @@ class BahamutIRCdProto : public IRCDProto
void SendNoticeChanopsInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf)
{
if (buf.empty())
return;
send_cmd("", "NOTICE @%s :%s", dest->name.c_str(), buf.c_str());
}
@@ -259,9 +244,9 @@ class BahamutIRCdProto : public IRCDProto
ircdproto->SendMode(NickServ, u, "+d %d", u->timestamp);
}
void SendChannel(Channel *c, const Anope::string &modes)
void SendChannel(Channel *c)
{
send_cmd("", "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), modes.c_str());
send_cmd("", "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), get_mlock_modes(c->ci, true).c_str());
}
};
@@ -270,13 +255,10 @@ class BahamutIRCdMessage : public IRCdMessage
public:
bool OnMode(const Anope::string &source, const std::vector<Anope::string> &params)
{
if (params.size() < 3)
return true;
if (params[0][0] == '#' || params[0][0] == '&')
if (params.size() > 2 && (params[0][0] == '#' || params[0][0] == '&'))
do_cmode(source, params[0], params[2], params[1]);
else
do_umode(source, params[0], params[1]);
else if (params.size() > 1)
do_umode(params[0], params[1]);
return true;
}
@@ -303,7 +285,11 @@ class BahamutIRCdMessage : public IRCdMessage
{
if (params.size() != 2)
{
User *user = do_nick(source, params[0], params[4], params[5], params[6], params[9], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, params[8], "", "", params[3]);
/* Currently bahamut has no ipv6 support */
sockaddrs ip;
ip.ntop(AF_INET, params[8].c_str());
User *user = do_nick(source, params[0], params[4], params[5], params[6], params[9], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, ip.addr(), "", "", params[3]);
if (user)
{
NickAlias *na;
@@ -554,43 +540,6 @@ bool ChannelModeFlood::IsValid(const Anope::string &value) const
return false;
}
static void AddModes()
{
/* Add user modes */
ModeManager::AddUserMode(new UserMode(UMODE_SERV_ADMIN, "UMODE_SERV_ADMIN", 'A'));
ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, "UMODE_REGPRIV", 'R'));
ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, "UMODE_ADMIN", 'a'));
ModeManager::AddUserMode(new UserMode(UMODE_INVIS, "UMODE_INVIS", 'i'));
ModeManager::AddUserMode(new UserMode(UMODE_OPER, "UMODE_OPER", 'o'));
ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, "UMODE_REGISTERED", 'r'));
ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, "UMODE_SNOMASK", 's'));
ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, "UMODE_WALLOPS", 'w'));
ModeManager::AddUserMode(new UserMode(UMODE_DEAF, "UMODE_DEAF", 'd'));
/* b/e/I */
ModeManager::AddChannelMode(new ChannelModeBan('b'));
/* v/h/o/a/q */
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, "CMODE_VOICE", 'v', '+'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, "CMODE_OP", 'o', '@'));
/* Add channel modes */
ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, "CMODE_BLOCKCOLOR", 'c'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, "CMODE_INVITE", 'i'));
ModeManager::AddChannelMode(new ChannelModeFlood('f'));
ModeManager::AddChannelMode(new ChannelModeKey('k'));
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, "CMODE_LIMIT", 'l'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, "CMODE_MODERATED", 'm'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, "CMODE_NOEXTERNAL", 'n'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, "CMODE_PRIVATE", 'p'));
ModeManager::AddChannelMode(new ChannelModeRegistered('r'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, "CMODE_SECRET", 's'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, "CMODE_TOPIC", 't'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, "CMODE_REGMODERATED", 'M'));
ModeManager::AddChannelMode(new ChannelModeOper('O'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, "CMODE_REGISTEREDONLY", 'R'));
}
class ProtoBahamut : public Module
{
Message message_svsmode, message_cs, message_hs, message_ms, message_ns, message_os, message_burst;
@@ -598,6 +547,43 @@ class ProtoBahamut : public Module
BahamutIRCdProto ircd_proto;
BahamutIRCdMessage ircd_message;
void AddModes()
{
/* Add user modes */
ModeManager::AddUserMode(new UserMode(UMODE_SERV_ADMIN, "UMODE_SERV_ADMIN", 'A'));
ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, "UMODE_REGPRIV", 'R'));
ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, "UMODE_ADMIN", 'a'));
ModeManager::AddUserMode(new UserMode(UMODE_INVIS, "UMODE_INVIS", 'i'));
ModeManager::AddUserMode(new UserMode(UMODE_OPER, "UMODE_OPER", 'o'));
ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, "UMODE_REGISTERED", 'r'));
ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, "UMODE_SNOMASK", 's'));
ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, "UMODE_WALLOPS", 'w'));
ModeManager::AddUserMode(new UserMode(UMODE_DEAF, "UMODE_DEAF", 'd'));
/* b/e/I */
ModeManager::AddChannelMode(new ChannelModeBan('b'));
/* v/h/o/a/q */
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, "CMODE_VOICE", 'v', '+'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, "CMODE_OP", 'o', '@'));
/* Add channel modes */
ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, "CMODE_BLOCKCOLOR", 'c'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, "CMODE_INVITE", 'i'));
ModeManager::AddChannelMode(new ChannelModeFlood('f'));
ModeManager::AddChannelMode(new ChannelModeKey('k'));
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, "CMODE_LIMIT", 'l'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, "CMODE_MODERATED", 'm'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, "CMODE_NOEXTERNAL", 'n'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, "CMODE_PRIVATE", 'p'));
ModeManager::AddChannelMode(new ChannelModeRegistered('r'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, "CMODE_SECRET", 's'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, "CMODE_TOPIC", 't'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, "CMODE_REGMODERATED", 'M'));
ModeManager::AddChannelMode(new ChannelModeOper('O'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, "CMODE_REGISTEREDONLY", 'R'));
}
public:
ProtoBahamut(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator),
message_svsmode("SVSMODE", OnMode), message_cs("CS", event_cs), message_hs("HS", event_hs),
@@ -607,12 +593,12 @@ class ProtoBahamut : public Module
this->SetAuthor("Anope");
this->SetType(PROTOCOL);
AddModes();
pmodule_ircd_var(myIrcd);
pmodule_ircd_proto(&this->ircd_proto);
pmodule_ircd_message(&this->ircd_message);
this->AddModes();
ModuleManager::Attach(I_OnUserNickChange, this);
}
+15 -17
View File
@@ -77,8 +77,6 @@ class InspIRCdTS6Proto : public IRCDProto
void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf)
{
if (buf.empty())
return;
send_cmd(bi ? bi->GetUID() : Config->Numeric, "MODE %s %s", u->GetUID().c_str(), buf.c_str());
}
@@ -107,14 +105,17 @@ class InspIRCdTS6Proto : public IRCDProto
}
/* JOIN */
void SendJoin(const BotInfo *user, const Anope::string &channel, time_t chantime)
void SendJoin(BotInfo *user, Channel *c, const ChannelStatus *status)
{
send_cmd(Config->Numeric, "FJOIN %s %ld + :,%s", channel.c_str(), static_cast<long>(chantime), user->GetUID().c_str());
}
void SendJoin(BotInfo *user, const ChannelContainer *cc)
{
send_cmd(Config->Numeric, "FJOIN %s %ld +%s :%s,%s", cc->chan->name.c_str(), static_cast<long>(cc->chan->creation_time), cc->chan->GetModes(true, true).c_str(), cc->Status->BuildCharPrefixList().c_str(), user->GetUID().c_str());
send_cmd(Config->Numeric, "FJOIN %s %ld +%s :,%s", c->name.c_str(), static_cast<long>(c->creation_time), c->GetModes(true, true).c_str(), user->GetUID().c_str());
/* 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
*/
if (status)
for (size_t i = CMODE_BEGIN + 1; i != CMODE_END; ++i)
if (status->HasFlag(static_cast<ChannelModeName>(i)))
c->SetMode(user, static_cast<ChannelModeName>(i), user->nick, false);
}
/* UNSQLINE */
@@ -218,9 +219,9 @@ class InspIRCdTS6Proto : public IRCDProto
send_cmd(Config->Numeric, "METADATA %s accountname :", u->GetUID().c_str());
}
void SendChannel(Channel *c, const Anope::string &modes)
void SendChannel(Channel *c)
{
send_cmd(Config->Numeric, "FJOIN %s %ld %s :", c->name.c_str(), static_cast<long>(c->creation_time), modes.c_str());
send_cmd(Config->Numeric, "FJOIN %s %ld %s :", c->name.c_str(), static_cast<long>(c->creation_time), get_mlock_modes(c->ci, true).c_str());
}
bool IsNickValid(const Anope::string &nick)
@@ -247,18 +248,15 @@ class InspircdIRCdMessage : public IRCdMessage
as it slightly breaks RFC1459
*/
User *u = finduser(source);
User *u2 = finduser(params[0]);
// This can happen with server-origin modes.
if (!u)
u = u2;
u = finduser(params[0]);
// if it's still null, drop it like fire.
// most likely situation was that server introduced a nick which we subsequently akilled
if (!u || !u2)
if (!u)
return true;
do_umode(u->nick, u2->nick, params[1]);
do_umode(u->nick, params[1]);
}
return true;
+26 -45
View File
@@ -120,15 +120,11 @@ class InspIRCdProto : public IRCDProto
void SendModeInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf)
{
if (buf.empty())
return;
send_cmd(source ? source->nick : Config->s_OperServ, "FMODE %s %u %s", dest->name.c_str(), static_cast<unsigned>(dest->creation_time), buf.c_str());
}
void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf)
{
if (buf.empty())
return;
send_cmd(bi ? bi->nick : Config->ServerName, "MODE %s %s", u->nick.c_str(), buf.c_str());
}
@@ -148,8 +144,6 @@ class InspIRCdProto : public IRCDProto
void SendNoticeChanopsInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf)
{
if (buf.empty())
return;
send_cmd(Config->ServerName, "NOTICE @%s :%s", dest->name.c_str(), buf.c_str());
}
@@ -160,22 +154,13 @@ class InspIRCdProto : public IRCDProto
}
/* JOIN */
void SendJoin(const BotInfo *user, const Anope::string &channel, time_t chantime)
void SendJoin(BotInfo *user, Channel *c, const ChannelStatus *status)
{
send_cmd(user->nick, "JOIN %s %ld", channel.c_str(), static_cast<long>(chantime));
}
void SendJoin(BotInfo *user, const ChannelContainer *cc)
{
SendJoin(user, cc->chan->name, cc->chan->creation_time);
for (std::map<char, ChannelMode *>::iterator it = ModeManager::ChannelModesByChar.begin(), it_end = ModeManager::ChannelModesByChar.end(); it != it_end; ++it)
{
if (cc->Status->HasFlag(it->second->Name))
{
cc->chan->SetMode(user, it->second, user->nick);
}
}
cc->chan->SetModes(user, false, "%s", cc->chan->GetModes(true, true).c_str());
send_cmd(user->nick, "JOIN %s %ld", c->name.c_str(), static_cast<long>(c->creation_time));
if (status)
for (size_t i = CMODE_BEGIN + 1; i != CMODE_END; ++i)
if (status->HasFlag(static_cast<ChannelModeName>(i)))
c->SetMode(user, static_cast<ChannelModeName>(i), user->nick, false);
}
/* UNSQLINE */
@@ -193,8 +178,6 @@ class InspIRCdProto : public IRCDProto
/* SQUIT */
void SendSquit(const Anope::string &servname, const Anope::string &message)
{
if (servname.empty() || message.empty())
return;
send_cmd(Config->ServerName, "SQUIT %s :%s", servname.c_str(), message.c_str());
}
@@ -292,12 +275,7 @@ class InspircdIRCdMessage : public IRCdMessage
if (params[0][0] == '#' || params[0][0] == '&')
do_cmode(source, params[0], params[1], params[2]);
else
{
/* InspIRCd lets opers change another
users modes
*/
do_umode(source, params[0], params[1]);
}
do_umode(params[0], params[1]);
return true;
}
@@ -510,7 +488,7 @@ class InspircdIRCdMessage : public IRCdMessage
}
}
}
else if (capab.find("PREIX=(") != Anope::string::npos)
else if (capab.find("PREFIX=(") != Anope::string::npos)
{
Anope::string modes(capab.begin() + 8, capab.begin() + capab.find(')'));
Anope::string chars(capab.begin() + capab.find(')') + 1, capab.end());
@@ -625,6 +603,8 @@ class InspircdIRCdMessage : public IRCdMessage
if (keep_their_modes)
Status.push_back(cm);
}
/* Erase the , */
buf.erase(buf.begin());
User *u = finduser(buf);
if (!u)
@@ -876,25 +856,26 @@ bool ChannelModeFlood::IsValid(const Anope::string &value) const
return false;
}
static void AddModes()
{
ModeManager::AddUserMode(new UserMode(UMODE_CALLERID, "UMODE_CALLERID", 'g'));
ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, "UMODE_HELPOP", 'h'));
ModeManager::AddUserMode(new UserMode(UMODE_INVIS, "UMODE_INVIS", 'i'));
ModeManager::AddUserMode(new UserMode(UMODE_OPER, "UMODE_OPER", 'o'));
ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, "UMODE_REGISTERED", 'r'));
ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, "UMODE_WALLOPS", 'w'));
ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, "UMODE_CLOAK", 'x'));
}
class ProtoInspIRCd : public Module
{
Message message_endburst, message_rsquit, message_svsmode, message_chghost, message_chgident, message_chgname,
message_sethost, message_setident, message_setname, message_fmode, message_ftopic, message_opertype,
message_idle;
message_idle, message_fjoin;
InspIRCdProto ircd_proto;
InspircdIRCdMessage ircd_message;
void AddModes()
{
ModeManager::AddUserMode(new UserMode(UMODE_CALLERID, "UMODE_CALLERID", 'g'));
ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, "UMODE_HELPOP", 'h'));
ModeManager::AddUserMode(new UserMode(UMODE_INVIS, "UMODE_INVIS", 'i'));
ModeManager::AddUserMode(new UserMode(UMODE_OPER, "UMODE_OPER", 'o'));
ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, "UMODE_REGISTERED", 'r'));
ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, "UMODE_WALLOPS", 'w'));
ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, "UMODE_CLOAK", 'x'));
}
public:
ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator),
message_endburst("ENDBURST", event_endburst), message_rsquit("RSQUIT", event_rsquit),
@@ -903,19 +884,19 @@ class ProtoInspIRCd : public Module
message_sethost("SETHOST", event_sethost), message_setident("SETIDENT", event_setident),
message_setname("SETNAME", event_setname), message_fmode("FMODE", event_fmode),
message_ftopic("FTOPIC", event_ftopic), message_opertype("OPERTYPE", event_opertype),
message_idle("IDLE", event_idle)
message_idle("IDLE", event_idle), message_fjoin("FJOIN", OnSJoin)
{
this->SetAuthor("Anope");
this->SetType(PROTOCOL);
AddModes();
pmodule_ircd_var(myIrcd);
pmodule_ircd_proto(&this->ircd_proto);
pmodule_ircd_message(&this->ircd_message);
Capab.SetFlag(CAPAB_NOQUIT);
this->AddModes();
ModuleManager::Attach(I_OnUserNickChange, this);
}
+19 -35
View File
@@ -230,34 +230,6 @@ bool event_sethost(const Anope::string &source, const std::vector<Anope::string>
return true;
}
/*
* [Nov 03 22:09:58.176252 2009] debug: Received: :964 UID 964AAAAAC 1225746297 w00t2 localhost testnet.user w00t 127.0.0.1 1225746302 +iosw +ACGJKLNOQcdfgjklnoqtx :Robin Burchell <w00t@inspircd.org>
* 0: uid
* 1: ts
* 2: nick
* 3: host
* 4: dhost
* 5: ident
* 6: ip
* 7: signon
* 8+: modes and params -- IMPORTANT, some modes (e.g. +s) may have parameters. So don't assume a fixed position of realname!
* last: realname
*/
bool event_uid(const Anope::string &source, const std::vector<Anope::string> &params)
{
Server *s = Server::Find(source);
time_t ts = convertTo<time_t>(params[1]);
Anope::string modes = params[8];
for (unsigned i = 9; i < params.size() - 1; ++i)
modes += " " + params[i];
User *user = do_nick("", params[2], params[5], params[3], s->GetName(), params[params.size() - 1], ts, params[6], params[4], params[0], modes);
if (user && user->server->IsSynced())
validate_user(user);
return true;
}
bool event_chghost(const Anope::string &source, const std::vector<Anope::string> &params)
{
@@ -297,11 +269,11 @@ bool event_metadata(const Anope::string &source, const std::vector<Anope::string
}
}
/*
* possible incoming ssl_cert messages:
* Received: :409 METADATA 409AAAAAA ssl_cert :vTrSe c38070ce96e41cc144ed6590a68d45a6 <...> <...>
* Received: :409 METADATA 409AAAAAC ssl_cert :vTrSE Could not get peer certificate: error:00000000:lib(0):func(0):reason(0)
*/
/*
* possible incoming ssl_cert messages:
* Received: :409 METADATA 409AAAAAA ssl_cert :vTrSe c38070ce96e41cc144ed6590a68d45a6 <...> <...>
* Received: :409 METADATA 409AAAAAC ssl_cert :vTrSE Could not get peer certificate: error:00000000:lib(0):func(0):reason(0)
*/
else if (params[1].equals_cs("ssl_cert"))
{
User *u = finduser(params[0]);
@@ -342,15 +314,27 @@ bool event_endburst(const Anope::string &source, const std::vector<Anope::string
class Inspircd12IRCdMessage : public InspircdIRCdMessage
{
public:
/*
* [Nov 03 22:09:58.176252 2009] debug: Received: :964 UID 964AAAAAC 1225746297 w00t2 localhost testnet.user w00t 127.0.0.1 1225746302 +iosw +ACGJKLNOQcdfgjklnoqtx :Robin Burchell <w00t@inspircd.org>
* 0: uid
* 1: ts
* 2: nick
* 3: host
* 4: dhost
* 5: ident
* 6: ip
* 7: signon
* 8+: modes and params -- IMPORTANT, some modes (e.g. +s) may have parameters. So don't assume a fixed position of realname!
* last: realname
*/
bool OnUID(const Anope::string &source, const std::vector<Anope::string> &params)
{
Server *s = Server::Find(source);
time_t ts = convertTo<time_t>(params[1]);
Anope::string modes = params[8];
for (unsigned i = 9; i < params.size() - 1; ++i)
modes += " " + params[i];
User *user = do_nick("", params[2], params[5], params[3], s->GetName(), params[params.size() - 1], ts, params[6], params[4], params[0], modes);
User *user = do_nick("", params[2], params[5], params[3], source, params[params.size() - 1], ts, params[6], params[4], params[0], modes);
if (user && user->server->IsSynced())
validate_user(user);
+12 -17
View File
@@ -105,8 +105,7 @@ bool event_opertype(const Anope::string &source, const std::vector<Anope::string
{
/* opertype is equivalent to mode +o because servers
dont do this directly */
User *u;
u = finduser(source);
User *u = finduser(source);
if (u && !u->HasMode(UMODE_OPER))
{
std::vector<Anope::string> newparams;
@@ -174,9 +173,8 @@ bool event_rsquit(const Anope::string &source, const std::vector<Anope::string>
bool event_setname(const Anope::string &source, const std::vector<Anope::string> &params)
{
User *u;
User *u = finduser(source);
u = finduser(source);
if (!u)
{
Log(LOG_DEBUG) << "SETNAME for nonexistent user " << source;
@@ -189,9 +187,8 @@ bool event_setname(const Anope::string &source, const std::vector<Anope::string>
bool event_chgname(const Anope::string &source, const std::vector<Anope::string> &params)
{
User *u;
User *u = finduser(source);
u = finduser(source);
if (!u)
{
Log(LOG_DEBUG) << "FNAME for nonexistent user " << source;
@@ -204,9 +201,8 @@ bool event_chgname(const Anope::string &source, const std::vector<Anope::string>
bool event_setident(const Anope::string &source, const std::vector<Anope::string> &params)
{
User *u;
User *u = finduser(source);
u = finduser(source);
if (!u)
{
Log(LOG_DEBUG) << "SETIDENT for nonexistent user " << source;
@@ -233,9 +229,8 @@ bool event_chgident(const Anope::string &source, const std::vector<Anope::string
bool event_sethost(const Anope::string &source, const std::vector<Anope::string> &params)
{
User *u;
User *u = finduser(source);
u = finduser(source);
if (!u)
{
Log(LOG_DEBUG) << "SETHOST for nonexistent user " << source;
@@ -249,6 +244,7 @@ bool event_sethost(const Anope::string &source, const std::vector<Anope::string>
bool event_chghost(const Anope::string &source, const std::vector<Anope::string> &params)
{
User *u = finduser(source);
if (!u)
{
Log(LOG_DEBUG) << "FHOST for nonexistent user " << source;
@@ -283,11 +279,11 @@ bool event_metadata(const Anope::string &source, const std::vector<Anope::string
}
}
/*
* possible incoming ssl_cert messages:
* Received: :409 METADATA 409AAAAAA ssl_cert :vTrSe c38070ce96e41cc144ed6590a68d45a6 <...> <...>
* Received: :409 METADATA 409AAAAAC ssl_cert :vTrSE Could not get peer certificate: error:00000000:lib(0):func(0):reason(0)
*/
/*
* possible incoming ssl_cert messages:
* Received: :409 METADATA 409AAAAAA ssl_cert :vTrSe c38070ce96e41cc144ed6590a68d45a6 <...> <...>
* Received: :409 METADATA 409AAAAAC ssl_cert :vTrSE Could not get peer certificate: error:00000000:lib(0):func(0):reason(0)
*/
else if (params[1].equals_cs("ssl_cert"))
{
User *u = finduser(params[0]);
@@ -343,13 +339,12 @@ class Inspircd20IRCdMessage : public InspircdIRCdMessage
*/
bool OnUID(const Anope::string &source, const std::vector<Anope::string> &params)
{
Server *s = Server::Find(source);
time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : 0;
Anope::string modes = params[8];
for (unsigned i = 9; i < params.size() - 1; ++i)
modes += Anope::string(" ") + params[i];
User *user = do_nick("", params[2], params[5], params[3], s->GetName(), params[params.size() - 1], ts, params[6], params[4], params[0], modes);
User *user = do_nick("", params[2], params[5], params[3], source, params[params.size() - 1], ts, params[6], params[4], params[0], modes);
if (user && user->server->IsSynced())
validate_user(user);
+52 -89
View File
@@ -42,9 +42,6 @@ IRCDVar myIrcd[] = {
/* PASS */
class ngIRCdProto : public IRCDProto
{
/* ngIRCd does not use the following functions, but we need the
* empty functions in this class or the file will not compile
*/
void SendAkill(const XLine *x) { }
void SendAkillDel(const XLine*) { }
void SendSQLine(const XLine*) { }
@@ -54,20 +51,16 @@ class ngIRCdProto : public IRCDProto
void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf)
{
if (source)
send_cmd(source->nick, "WALLOPS :%s", buf.c_str());
else
send_cmd(Config->ServerName, "WALLOPS :%s", buf.c_str());
send_cmd(source ? source->nick : Config->ServerName, "WALLOPS :%s", buf.c_str());
}
void SendJoin(const BotInfo *user, const Anope::string &channel, time_t chantime)
void SendJoin(BotInfo *user, Channel *c, const ChannelStatus *status)
{
send_cmd(user->nick, "JOIN %s", channel.c_str());
}
void SendJoin(const BotInfo *user, const ChannelContainer *cc)
{
send_cmd(user->nick, "JOIN %s", cc->chan->name.c_str());
send_cmd(user->nick, "JOIN %s", c->name.c_str());
if (status)
for (size_t i = CMODE_BEGIN + 1; i != CMODE_END; ++i)
if (status->HasFlag(static_cast<ChannelModeName>(i)))
c->SetMode(user, static_cast<ChannelModeName>(i), user->nick, false);
}
void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf)
@@ -87,7 +80,7 @@ class ngIRCdProto : public IRCDProto
/* Make myself known to myself in the serverlist */
SendServer(Me);
/* finish the enhanced server handshake and register the connection */
send_cmd(Config->ServerName, "376 * :End of MOTD command");
this->SendNumeric(Config->ServerName, 376, "*", ":End of MOTD command");
}
// Received: :dev.anope.de NICK DukeP 1 ~DukePyro p57ABF9C9.dip.t-dialin.net 1 +i :DukePyrolator
@@ -105,12 +98,6 @@ class ngIRCdProto : public IRCDProto
send_cmd(bi->nick, "PART %s", chan->name.c_str());
}
void SendNumericInternal(const Anope::string &, int numeric, const Anope::string &dest, const Anope::string &buf)
{
// This might need to be set in the call to SendNumeric instead of here, will review later -- CyberBotX
send_cmd(Config->ServerName, "%03d %s %s", numeric, dest.c_str(), buf.c_str());
}
void SendModeInternal(const BotInfo *bi, const Channel *dest, const Anope::string &buf)
{
send_cmd(bi ? bi->nick : Config->ServerName, "MODE %s %s", dest->name.c_str(), buf.c_str());
@@ -118,8 +105,6 @@ class ngIRCdProto : public IRCDProto
void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf)
{
if (buf.empty())
return;
send_cmd(bi ? bi->nick : Config->ServerName, "MODE %s %s", u->nick.c_str(), buf.c_str());
}
@@ -142,33 +127,20 @@ class ngIRCdProto : public IRCDProto
send_cmd(source->nick, "INVITE %s %s", nick.c_str(), chan.c_str());
}
void SendChannel(Channel *c, const Anope::string &modes)
void SendChannel(Channel *c)
{
send_cmd(Config->ServerName, "CHANINFO %s %s", c->name.c_str(), modes.c_str());
send_cmd(Config->ServerName, "CHANINFO %s %s", c->name.c_str(), get_mlock_modes(c->ci, true).c_str());
}
bool IsNickValid(const Anope::string &nick)
{
/* TS6 Save extension -Certus */
if (isdigit(nick[0]))
return false;
return true;
}
void SendTopic(BotInfo *bi, Channel *c)
{
send_cmd(bi->nick, "TOPIC %s :%s", c->name.c_str(), c->topic.c_str());
}
};
class ngIRCdIRCdMessage : public IRCdMessage
{
public:
/* ngIRCd uses NJOIN instead of SJOIN, but we still need an
* empty function in this class or the file will not compile
*/
bool OnSJoin(const Anope::string&, const std::vector<Anope::string>&) { return true; }
bool OnSJoin(const Anope::string&, const std::vector<Anope::string>&) { return false; }
/*
* Received: :dev.anope.de MODE #anope +b *!*@*aol*
@@ -185,7 +157,7 @@ class ngIRCdIRCdMessage : public IRCdMessage
if (params[0][0] == '#' || params[0][0] == '&')
do_cmode(source, params[0], modes, "");
else
do_umode(source, params[0], params[1]);
do_umode(params[0], params[1]);
return true;
}
@@ -255,20 +227,16 @@ class ngIRCdIRCdMessage : public IRCdMessage
{
if (!params.empty())
{
Anope::string channel, mode;
size_t pos;
pos = params[0].find('\7');
size_t pos = params[0].find('\7');
if (pos != Anope::string::npos)
{
channel = params[0].substr(0, pos);
mode += '+' + params[0].substr(pos, params[0].length()) + " " + source;
Anope::string channel = params[0].substr(0, pos);
Anope::string mode = '+' + params[0].substr(pos, params[0].length()) + " " + source;
do_join(source, channel, "");
do_cmode(source, channel, mode, "");
}
else
{
do_join(source, params[0], "");
}
}
return true;
}
@@ -283,13 +251,11 @@ bool event_chaninfo(const Anope::string &source, const std::vector<Anope::string
{
Channel *c = findchan(params[0]);
Anope::string modes;
if (!c)
c = new Channel(params[0]);
modes = params[1];
Anope::string modes = params[1];
if (params.size() == 3)
{
c->ChangeTopicInternal(source, params[2], Anope::CurTime);
@@ -436,42 +402,6 @@ bool event_376(const Anope::string &source, const std::vector<Anope::string> &pa
}
static void AddModes()
{
/* Add user modes */
ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, "UMODE_ADMIN", 'a'));
ModeManager::AddUserMode(new UserMode(UMODE_INVIS, "UMODE_INVIS", 'i'));
ModeManager::AddUserMode(new UserMode(UMODE_OPER, "UMODE_OPER", 'o'));
ModeManager::AddUserMode(new UserMode(UMODE_RESTRICTED, "UMODE_RESTRICTED", 'r'));
ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, "UMODE_SNOMASK", 's'));
ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, "UMODE_WALLOPS", 'w'));
ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, "UMODE_CLOAK", 'x'));
// channel modes: biIklmnoPstvz
/* b/e/I */
ModeManager::AddChannelMode(new ChannelModeBan('b'));
ModeManager::AddChannelMode(new ChannelModeInvex('I'));
/* v/h/o/a/q */
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, "CMODE_VOICE", 'v', '+'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, "CMODE_OP", 'o', '@'));
/* Add channel modes */
ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, "CMODE_INVITE", 'i'));
ModeManager::AddChannelMode(new ChannelModeKey('k'));
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, "CMODE_LIMIT", 'l'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, "CMODE_MODERATED", 'm'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, "CMODE_NOEXTERNAL", 'n'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_PERM, "CMODE_PERM", 'P'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, "CMODE_SECRET", 's'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, "CMODE_TOPIC", 't'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, "CMODE_SSL", 'z'));
return;
}
class ProtongIRCd : public Module
{
Message message_kick, message_pass, message_njoin, message_chaninfo, message_005,
@@ -479,6 +409,39 @@ class ProtongIRCd : public Module
ngIRCdProto ircd_proto;
ngIRCdIRCdMessage ircd_message;
void AddModes()
{
/* Add user modes */
ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, "UMODE_ADMIN", 'a'));
ModeManager::AddUserMode(new UserMode(UMODE_INVIS, "UMODE_INVIS", 'i'));
ModeManager::AddUserMode(new UserMode(UMODE_OPER, "UMODE_OPER", 'o'));
ModeManager::AddUserMode(new UserMode(UMODE_RESTRICTED, "UMODE_RESTRICTED", 'r'));
ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, "UMODE_SNOMASK", 's'));
ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, "UMODE_WALLOPS", 'w'));
ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, "UMODE_CLOAK", 'x'));
/* b/e/I */
ModeManager::AddChannelMode(new ChannelModeBan('b'));
ModeManager::AddChannelMode(new ChannelModeInvex('I'));
/* v/h/o/a/q */
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, "CMODE_VOICE", 'v', '+'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, "CMODE_OP", 'o', '@'));
/* Add channel modes */
// channel modes: biIklmnoPstvz
ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, "CMODE_INVITE", 'i'));
ModeManager::AddChannelMode(new ChannelModeKey('k'));
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, "CMODE_LIMIT", 'l'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, "CMODE_MODERATED", 'm'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, "CMODE_NOEXTERNAL", 'n'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_PERM, "CMODE_PERM", 'P'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, "CMODE_SECRET", 's'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, "CMODE_TOPIC", 't'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, "CMODE_SSL", 'z'));
}
public:
ProtongIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator),
message_kick("KICK", event_kick), message_pass("PASS", event_pass),
@@ -490,11 +453,11 @@ class ProtongIRCd : public Module
Capab.SetFlag(CAPAB_QS);
AddModes();
pmodule_ircd_var(myIrcd);
pmodule_ircd_proto(&this->ircd_proto);
pmodule_ircd_message(&this->ircd_message);
this->AddModes();
}
};
+96 -118
View File
@@ -89,10 +89,7 @@ class PlexusProto : public IRCDProto
{
void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf)
{
if (source)
send_cmd(source->GetUID(), "OPERWALL :%s", buf.c_str());
else
send_cmd(Config->Numeric, "OPERWALL :%s", buf.c_str());
send_cmd(source ? source->GetUID() : Config->Numeric, "OPERWALL :%s", buf.c_str());
}
void SendSQLine(const XLine *x)
@@ -123,14 +120,13 @@ class PlexusProto : public IRCDProto
send_cmd(Config->Numeric, "UNRESV * %s", x->Mask.c_str());
}
void SendJoin(const BotInfo *user, const Anope::string &channel, time_t chantime)
void SendJoin(BotInfo *user, Channel *c, const ChannelStatus *status)
{
send_cmd(Config->Numeric, "SJOIN %ld %s + :%s", static_cast<long>(chantime), channel.c_str(), user->GetUID().c_str());
}
void SendJoin(const BotInfo *user, const ChannelContainer *cc)
{
send_cmd(Config->Numeric, "SJOIN %ld %s +%s :%s%s", static_cast<long>(cc->chan->creation_time), cc->chan->name.c_str(), cc->chan->GetModes(true, true).c_str(), cc->Status->BuildModePrefixList().c_str(), user->GetUID().c_str());
send_cmd(Config->Numeric, "SJOIN %ld %s +%s :%s", static_cast<long>(c->creation_time), c->name.c_str(), c->GetModes(true, true).c_str(), user->GetUID().c_str());
if (status)
for (size_t i = CMODE_BEGIN + 1; i != CMODE_END; ++i)
if (status->HasFlag(static_cast<ChannelModeName>(i)))
c->SetMode(user, static_cast<ChannelModeName>(i), user->nick, false);
}
void SendAkill(const XLine *x)
@@ -180,12 +176,6 @@ class PlexusProto : public IRCDProto
send_cmd(bi->GetUID(), "PART %s", chan->name.c_str());
}
void SendNumericInternal(const Anope::string &, int numeric, const Anope::string &dest, const Anope::string &buf)
{
// This might need to be set in the call to SendNumeric instead of here, will review later -- CyberBotX
send_cmd(Config->Numeric, "%03d %s %s", numeric, dest.c_str(), buf.c_str());
}
void SendModeInternal(const BotInfo *bi, const Channel *dest, const Anope::string &buf)
{
if (bi)
@@ -229,23 +219,14 @@ class PlexusProto : public IRCDProto
send_cmd(Config->Numeric, "ENCAP * SU %s", u->GetUID().c_str());
}
bool IsNickValid(const Anope::string &nick)
{
/* TS6 Save extension -Certus */
if (isdigit(nick[0]))
return false;
return true;
}
void SendTopic(BotInfo *bi, Channel *c)
{
send_cmd(bi->GetUID(), "ENCAP * TOPIC %s %s %lu :%s", c->name.c_str(), c->topic_setter.c_str(), static_cast<unsigned long>(c->topic_time + 1), c->topic.c_str());
}
void SendChannel(Channel *c, const Anope::string &modes)
void SendChannel(Channel *c)
{
send_cmd(Config->Numeric, "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), modes.c_str());
send_cmd(Config->Numeric, "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), get_mlock_modes(c->ci, true).c_str());
}
};
@@ -260,13 +241,7 @@ class PlexusIRCdMessage : public IRCdMessage
if (params[0][0] == '#' || params[0][0] == '&')
do_cmode(source, params[0], params[2], params[1]);
else
{
User *u = finduser(source);
User *u2 = finduser(params[0]);
if (!u || !u2)
return true;
do_umode(u->nick, u2->nick, params[1]);
}
do_umode(params[0], params[1]);
return true;
}
@@ -287,8 +262,11 @@ class PlexusIRCdMessage : public IRCdMessage
*/
bool OnUID(const Anope::string &source, const std::vector<Anope::string> &params)
{
/* Source is always the server */
User *user = do_nick("", params[0], params[4], params[9], source, params[10], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, params[6], params[5], params[7], params[3]);
/* An IP of 0 means the user is spoofed */
Anope::string ip = params[6];
if (ip == "0")
ip.clear();
User *user = do_nick("", params[0], params[4], params[9], source, params[10], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, ip, params[5], params[7], params[3]);
if (user && user->server->IsSynced())
validate_user(user);
@@ -442,20 +420,23 @@ class PlexusIRCdMessage : public IRCdMessage
bool event_tburst(const Anope::string &source, const std::vector<Anope::string> &params)
{
if (params.size() != 4)
// :rizon.server TBURST 1298674830 #lol 1298674833 Adam!Adam@i.has.a.spoof :lol
if (params.size() < 4)
return true;
Anope::string setter = myStrGetToken(params[2], '!', 0);
time_t topic_time = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime;
Channel *c = findchan(params[0]);
Channel *c = findchan(params[1]);
if (!c)
{
Log() << "TOPIC " << params[3] << " for nonexistent channel " << params[0];
return true;
}
else if (c->creation_time < convertTo<time_t>(params[0]))
return true;
c->ChangeTopicInternal(setter, params.size() > 3 ? params[3] : "", topic_time);
Anope::string setter = myStrGetToken(params[3], '!', 0);
time_t topic_time = Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime;
c->ChangeTopicInternal(setter, params.size() > 4 ? params[4] : "", topic_time);
return true;
}
@@ -477,13 +458,7 @@ bool event_mode(const Anope::string &source, const std::vector<Anope::string> &p
if (params[0][0] == '#' || params[0][0] == '&')
do_cmode(source, params[0], params[2], params[1]);
else
{
User *u = finduser(source);
User *u2 = finduser(params[0]);
if (!u || !u2)
return true;
do_umode(u->nick, u2->nick, params[1]);
}
do_umode(params[0], params[1]);
return true;
}
@@ -536,13 +511,13 @@ bool event_encap(const Anope::string &source, const std::vector<Anope::string> &
{
if (params.size() < 4)
return true;
/*
* Received: :dev.anope.de ENCAP * SU DukePyrolator DukePyrolator
* params[0] = *
* params[1] = SU
* params[2] = nickname
* params[3] = account
*/
/*
* Received: :dev.anope.de ENCAP * SU DukePyrolator DukePyrolator
* params[0] = *
* params[1] = SU
* params[2] = nickname
* params[3] = account
*/
else if (params[1].equals_cs("SU"))
{
User *u = finduser(params[2]);
@@ -555,13 +530,14 @@ bool event_encap(const Anope::string &source, const std::vector<Anope::string> &
u->SetMode(NickServ, UMODE_REGISTERED);
}
}
/*
* Received: :dev.anope.de ENCAP * CERTFP DukePyrolator :3F122A9CC7811DBAD3566BF2CEC3009007C0868F
* params[0] = *
* params[1] = CERTFP
* params[2] = nickname
* params[3] = fingerprint
*/
/*
* Received: :dev.anope.de ENCAP * CERTFP DukePyrolator :3F122A9CC7811DBAD3566BF2CEC3009007C0868F
* params[0] = *
* params[1] = CERTFP
* params[2] = nickname
* params[3] = fingerprint
*/
else if (params[1].equals_cs("CERTFP"))
{
User *u = finduser(params[2]);
@@ -591,58 +567,6 @@ bool event_eob(const Anope::string &source, const std::vector<Anope::string> &pa
return true;
}
static void AddModes()
{
/* Add user modes */
ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, "UMODE_ADMIN", 'a'));
ModeManager::AddUserMode(new UserMode(UMODE_INVIS, "UMODE_INVIS", 'i'));
ModeManager::AddUserMode(new UserMode(UMODE_OPER, "UMODE_OPER", 'o'));
ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, "UMODE_SNOMASK", 's'));
ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, "UMODE_WALLOPS", 'w'));
ModeManager::AddUserMode(new UserMode(UMODE_DEAF, "UMODE_DEAF", 'D'));
ModeManager::AddUserMode(new UserMode(UMODE_SOFTCALLERID, "UMODE_SOFTCALLERID", 'G'));
ModeManager::AddUserMode(new UserMode(UMODE_NETADMIN, "UMODE_NETADMIN", 'M'));
ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, "UMODE_REGPRIV", 'R'));
ModeManager::AddUserMode(new UserMode(UMODE_SSL, "UMODE_SSL", 'S'));
ModeManager::AddUserMode(new UserMode(UMODE_WEBIRC, "UMODE_WEBIRC", 'W'));
ModeManager::AddUserMode(new UserMode(UMODE_CALLERID, "UMODE_CALLERID", 'g'));
ModeManager::AddUserMode(new UserMode(UMODE_PRIV, "UMODE_PRIV", 'p'));
ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, "UMODE_REGISTERED", 'r'));
ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, "UMODE_CLOAK", 'x'));
/* b/e/I */
ModeManager::AddChannelMode(new ChannelModeBan('b'));
ModeManager::AddChannelMode(new ChannelModeExcept('e'));
ModeManager::AddChannelMode(new ChannelModeInvex('I'));
/* l/k */
ModeManager::AddChannelMode(new ChannelModeKey('k'));
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, "CMODE_LIMIT", 'l'));
/* v/h/o/a/q */
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, "CMODE_VOICE", 'v', '+'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, "CMODE_HALFOP", 'h', '%'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, "CMODE_OP", 'o', '@'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, "CMODE_PROTECT", 'a', '&'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, "CMODE_OWNER", 'q', '~'));
/* Add channel modes */
ModeManager::AddChannelMode(new ChannelMode(CMODE_BANDWIDTH, "CMODE_BANDWIDTH", 'B'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, "CMODE_REGMODERATED", 'M'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_NONOTICE, "CMODE_NONOTICE", 'N'));
ModeManager::AddChannelMode(new ChannelModeOper('O'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, "CMODE_REGISTEREDONLY", 'R'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, "CMODE_SSL", 'S'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, "CMODE_BLOCKCOLOR", 'c'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, "CMODE_INVITE", 'i'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, "CMODE_MODERATED", 'm'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, "CMODE_NOEXTERNAL", 'n'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, "CMODE_PRIVATE", 'p'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, "CMODE_SECRET", 's'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, "CMODE_TOPIC", 't'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_PERM, "CMODE_PERM", 'z'));
}
class ProtoPlexus : public Module
{
Message message_tmode, message_bmask, message_pass,
@@ -651,21 +575,75 @@ class ProtoPlexus : public Module
PlexusProto ircd_proto;
PlexusIRCdMessage ircd_message;
void AddModes()
{
/* Add user modes */
ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, "UMODE_ADMIN", 'a'));
ModeManager::AddUserMode(new UserMode(UMODE_INVIS, "UMODE_INVIS", 'i'));
ModeManager::AddUserMode(new UserMode(UMODE_OPER, "UMODE_OPER", 'o'));
ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, "UMODE_SNOMASK", 's'));
ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, "UMODE_WALLOPS", 'w'));
ModeManager::AddUserMode(new UserMode(UMODE_DEAF, "UMODE_DEAF", 'D'));
ModeManager::AddUserMode(new UserMode(UMODE_SOFTCALLERID, "UMODE_SOFTCALLERID", 'G'));
ModeManager::AddUserMode(new UserMode(UMODE_NETADMIN, "UMODE_NETADMIN", 'M'));
ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, "UMODE_REGPRIV", 'R'));
ModeManager::AddUserMode(new UserMode(UMODE_SSL, "UMODE_SSL", 'S'));
ModeManager::AddUserMode(new UserMode(UMODE_WEBIRC, "UMODE_WEBIRC", 'W'));
ModeManager::AddUserMode(new UserMode(UMODE_CALLERID, "UMODE_CALLERID", 'g'));
ModeManager::AddUserMode(new UserMode(UMODE_PRIV, "UMODE_PRIV", 'p'));
ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, "UMODE_REGISTERED", 'r'));
ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, "UMODE_CLOAK", 'x'));
/* b/e/I */
ModeManager::AddChannelMode(new ChannelModeBan('b'));
ModeManager::AddChannelMode(new ChannelModeExcept('e'));
ModeManager::AddChannelMode(new ChannelModeInvex('I'));
/* l/k */
ModeManager::AddChannelMode(new ChannelModeKey('k'));
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, "CMODE_LIMIT", 'l'));
/* v/h/o/a/q */
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, "CMODE_VOICE", 'v', '+'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, "CMODE_HALFOP", 'h', '%'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, "CMODE_OP", 'o', '@'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, "CMODE_PROTECT", 'a', '&'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, "CMODE_OWNER", 'q', '~'));
/* Add channel modes */
ModeManager::AddChannelMode(new ChannelMode(CMODE_BANDWIDTH, "CMODE_BANDWIDTH", 'B'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, "CMODE_REGMODERATED", 'M'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_NONOTICE, "CMODE_NONOTICE", 'N'));
ModeManager::AddChannelMode(new ChannelModeOper('O'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, "CMODE_REGISTEREDONLY", 'R'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, "CMODE_SSL", 'S'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, "CMODE_BLOCKCOLOR", 'c'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, "CMODE_INVITE", 'i'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, "CMODE_MODERATED", 'm'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, "CMODE_NOEXTERNAL", 'n'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, "CMODE_PRIVATE", 'p'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, "CMODE_SECRET", 's'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, "CMODE_TOPIC", 't'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_PERM, "CMODE_PERM", 'z'));
}
public:
ProtoPlexus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator),
message_tmode("TMODE", event_tmode), message_bmask("BMASK", event_bmask),
message_pass("PASS", event_pass), message_tb("TB", event_tburst),
message_pass("PASS", event_pass), message_tb("TBURST", event_tburst),
message_sid("SID", event_sid), message_encap("ENCAP", event_encap),
message_eob("EOB", event_eob)
{
this->SetAuthor("Anope");
this->SetType(PROTOCOL);
AddModes();
pmodule_ircd_var(myIrcd);
pmodule_ircd_proto(&this->ircd_proto);
pmodule_ircd_message(&this->ircd_message);
this->AddModes();
}
};
+95 -100
View File
@@ -16,7 +16,7 @@ static Anope::string TS6UPLINK;
IRCDVar myIrcd[] = {
{"Ratbox 2.0+", /* ircd name */
"+oi", /* Modes used by pseudoclients */
"+oiS", /* Modes used by pseudoclients */
0, /* SVSNICK */
0, /* Vhost */
1, /* Supports SNlines */
@@ -79,7 +79,7 @@ void ratbox_cmd_svsinfo()
*/
void ratbox_cmd_capab()
{
send_cmd("", "CAPAB :QS EX CHW IE KLN GLN KNOCK TB UNKLN CLUSTER ENCAP");
send_cmd("", "CAPAB :QS EX CHW IE KLN GLN KNOCK TB UNKLN CLUSTER ENCAP TS6");
}
/* PASS */
@@ -92,10 +92,7 @@ class RatboxProto : public IRCDProto
{
void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf)
{
if (source)
send_cmd(source->GetUID(), "OPERWALL :%s", buf.c_str());
else
send_cmd(Config->Numeric, "OPERWALL :%s", buf.c_str());
send_cmd(source ? source->GetUID() : Config->Numeric, "OPERWALL :%s", buf.c_str());
}
void SendSQLine(const XLine *x)
@@ -126,14 +123,20 @@ class RatboxProto : public IRCDProto
send_cmd(Config->Numeric, "UNRESV * %s", x->Mask.c_str());
}
void SendJoin(const BotInfo *user, const Anope::string &channel, time_t chantime)
void SendJoin(BotInfo *user, Channel *c, const ChannelStatus *status)
{
send_cmd("", "SJOIN %ld %s + :%s", static_cast<long>(chantime), channel.c_str(), user->GetUID().c_str());
}
void SendJoin(const BotInfo *user, const ChannelContainer *cc)
{
send_cmd("", "SJOIN %ld %s +%s :%s%s", static_cast<long>(cc->chan->creation_time), cc->chan->name.c_str(), cc->chan->GetModes(true, true).c_str(), cc->Status->BuildModePrefixList().c_str(), user->GetUID().c_str());
/* Note that we must send our modes with the SJOIN and
* can not add them to the mode stacker because ratbox
* does not allow *any* client to op itself
*/
send_cmd("", "SJOIN %ld %s +%s :%s%s", static_cast<long>(c->creation_time), c->name.c_str(), c->GetModes(true, true).c_str(), status != NULL ? status->BuildModePrefixList().c_str() : "", user->GetUID().c_str());
/* And update our internal status for this user since this is not going through our mode handling system */
if (status != NULL)
{
UserContainer *uc = c->FindUser(user);
if (uc != NULL)
*uc->Status = *status;
}
}
void SendAkill(const XLine *x)
@@ -176,24 +179,13 @@ class RatboxProto : public IRCDProto
send_cmd(bi->GetUID(), "PART %s", chan->name.c_str());
}
void SendNumericInternal(const Anope::string &, int numeric, const Anope::string &dest, const Anope::string &buf)
{
// This might need to be set in the call to SendNumeric instead of here, will review later -- CyberBotX
send_cmd(Config->Numeric, "%03d %s %s", numeric, dest.c_str(), buf.c_str());
}
void SendModeInternal(const BotInfo *bi, const Channel *dest, const Anope::string &buf)
{
if (bi)
send_cmd(bi->GetUID(), "MODE %s %s", dest->name.c_str(), buf.c_str());
else
send_cmd(Config->Numeric, "MODE %s %s", dest->name.c_str(), buf.c_str());
send_cmd(bi ? bi->GetUID() : Config->Numeric, "MODE %s %s", dest->name.c_str(), buf.c_str());
}
void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf)
{
if (buf.empty())
return;
send_cmd(bi ? bi->GetUID() : Config->Numeric, "SVSMODE %s %s", u->nick.c_str(), buf.c_str());
}
@@ -227,9 +219,9 @@ class RatboxProto : public IRCDProto
send_cmd(Config->Numeric, "ENCAP * SU %s", u->GetUID().c_str());
}
void SendChannel(Channel *c, const Anope::string &modes)
void SendChannel(Channel *c)
{
send_cmd("", "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), modes.c_str());
send_cmd("", "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), get_mlock_modes(c->ci, true).c_str());
}
bool IsNickValid(const Anope::string &nick)
@@ -248,27 +240,11 @@ class RatboxProto : public IRCDProto
{
ChannelStatus status;
status.SetFlag(CMODE_OP);
ChannelContainer cc(c);
cc.Status = &status;
ircdproto->SendJoin(bi, &cc);
bi->Join(c, &status);
}
send_cmd(bi->GetUID(), "TOPIC %s :%s", c->name.c_str(), c->topic.c_str());
if (needjoin)
{
ircdproto->SendPart(bi, c, NULL);
}
}
void SetAutoIdentificationToken(User *u)
{
if (!u->Account())
return;
Anope::string svidbuf = stringify(u->timestamp);
u->Account()->Shrink("authenticationtoken");
u->Account()->Extend("authenticationtoken", new ExtensibleItemRegular<Anope::string>(svidbuf));
bi->Part(c);
}
};
@@ -283,33 +259,17 @@ class RatboxIRCdMessage : public IRCdMessage
if (params[0][0] == '#' || params[0][0] == '&')
do_cmode(source, params[0], params[2], params[1]);
else
{
User *u = finduser(source);
User *u2 = finduser(params[0]);
if (!u || !u2)
return true;
do_umode(u->nick, u2->nick, params[1]);
}
do_umode(params[0], params[1]);
return true;
}
bool OnUID(const Anope::string &source, const std::vector<Anope::string> &params)
{
Server *s = Server::Find(source);
/* Source is always the server */
User *user = do_nick("", params[0], params[4], params[5], s->GetName(), params[8], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, params[6], "*", params[7], params[3]);
if (user)
{
NickAlias *na = findnick(user->nick);
Anope::string svidbuf;
if (na && na->nc->GetExtRegular("authenticationtoken", svidbuf) && svidbuf == params[2])
{
user->Login(na->nc);
}
else
validate_user(user);
}
User *user = do_nick("", params[0], params[4], params[5], source, params[8], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, params[6], "*", params[7], params[3]);
if (user && user->server->IsSynced())
validate_user(user);
return true;
}
@@ -338,6 +298,7 @@ class RatboxIRCdMessage : public IRCdMessage
do_server(source, params[0], Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0, params[2], TS6UPLINK);
else
do_server(source, params[0], Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0, params[2], "");
ircdproto->SendPing(Config->ServerName, params[0]);
return true;
}
@@ -490,9 +451,40 @@ bool event_kick(const Anope::string &source, const std::vector<Anope::string> &p
bool event_sid(const Anope::string &source, const std::vector<Anope::string> &params)
{
/* :42X SID trystan.nomadirc.net 2 43X :ircd-ratbox test server */
Server *s = Server::Find(source);
do_server(source, params[0], Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0, params[3], params[2]);
ircdproto->SendPing(Config->ServerName, params[0]);
return true;
}
do_server(s->GetName(), params[0], Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0, params[3], params[2]);
// Debug: Received: :00BAAAAAB ENCAP * LOGIN Adam
bool event_encap(const Anope::string &source, const std::vector<Anope::string> &params)
{
if (params.size() > 2 && params[1] == "LOGIN")
{
User *u = finduser(source);
NickCore *nc = findcore(params[2]);
if (!u || !nc)
return true;
u->Login(nc);
}
return true;
}
bool event_pong(const Anope::string &source, const std::vector<Anope::string> &params)
{
Server *s = Server::Find(source);
if (s && !s->IsSynced())
{
s->Sync(false);
for (patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick); it.next();)
{
User *u = *it;
if (u->server == s && !u->IsIdentified())
validate_user(u);
}
}
return true;
}
@@ -536,55 +528,58 @@ bool event_bmask(const Anope::string &source, const std::vector<Anope::string> &
return true;
}
static void AddModes()
{
/* Add user modes */
ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, "UMODE_ADMIN", 'a'));
ModeManager::AddUserMode(new UserMode(UMODE_INVIS, "UMODE_INVIS", 'i'));
ModeManager::AddUserMode(new UserMode(UMODE_OPER, "UMODE_OPER", 'o'));
ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, "UMODE_SNOMASK", 's'));
ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, "UMODE_WALLOPS", 'w'));
/* b/e/I */
ModeManager::AddChannelMode(new ChannelModeBan('b'));
ModeManager::AddChannelMode(new ChannelModeExcept('e'));
ModeManager::AddChannelMode(new ChannelModeInvex('I'));
/* v/h/o/a/q */
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, "CMODE_VOICE", 'v', '+'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, "CMODE_OP", 'o', '@'));
/* Add channel modes */
ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, "CMODE_INVITE", 'i'));
ModeManager::AddChannelMode(new ChannelModeKey('k'));
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, "CMODE_LIMIT", 'l'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, "CMODE_MODERATED", 'm'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, "CMODE_NOEXTERNAL", 'n'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, "CMODE_PRIVATE", 'p'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, "CMODE_SECRET", 's'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, "CMODE_TOPIC", 't'));
}
class ProtoRatbox : public Module
{
Message message_kick, message_tmode, message_bmask, message_pass, message_tb, message_sid;
Message message_kick, message_tmode, message_bmask, message_pass, message_tb, message_sid, message_encap,
message_pong;
RatboxProto ircd_proto;
RatboxIRCdMessage ircd_message;
void AddModes()
{
/* Add user modes */
ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, "UMODE_ADMIN", 'a'));
ModeManager::AddUserMode(new UserMode(UMODE_INVIS, "UMODE_INVIS", 'i'));
ModeManager::AddUserMode(new UserMode(UMODE_OPER, "UMODE_OPER", 'o'));
ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, "UMODE_SNOMASK", 's'));
ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, "UMODE_WALLOPS", 'w'));
/* b/e/I */
ModeManager::AddChannelMode(new ChannelModeBan('b'));
ModeManager::AddChannelMode(new ChannelModeExcept('e'));
ModeManager::AddChannelMode(new ChannelModeInvex('I'));
/* v/h/o/a/q */
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, "CMODE_VOICE", 'v', '+'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, "CMODE_OP", 'o', '@'));
/* Add channel modes */
ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, "CMODE_INVITE", 'i'));
ModeManager::AddChannelMode(new ChannelModeKey('k'));
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, "CMODE_LIMIT", 'l'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, "CMODE_MODERATED", 'm'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, "CMODE_NOEXTERNAL", 'n'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, "CMODE_PRIVATE", 'p'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, "CMODE_SECRET", 's'));
ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, "CMODE_TOPIC", 't'));
}
public:
ProtoRatbox(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator),
message_kick("KICK", event_kick), message_tmode("TMODE", event_tmode),
message_bmask("BMASK", event_bmask), message_pass("PASS", event_pass),
message_tb("TB", event_tburst), message_sid("SID", event_sid)
message_tb("TB", event_tburst), message_sid("SID", event_sid), message_encap("ENCAP", event_encap),
message_pong("PONG", event_pong)
{
this->SetAuthor("Anope");
this->SetType(PROTOCOL);
AddModes();
pmodule_ircd_var(myIrcd);
pmodule_ircd_proto(&this->ircd_proto);
pmodule_ircd_message(&this->ircd_message);
this->AddModes();
}
};
+51 -60
View File
@@ -129,15 +129,11 @@ class UnrealIRCdProto : public IRCDProto
void SendModeInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf)
{
if (buf.empty())
return;
send_cmd(source->nick, "G %s %s", dest->name.c_str(), buf.c_str());
}
void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf)
{
if (buf.empty())
return;
send_cmd(bi ? bi->nick : Config->ServerName, "v %s %s", u->nick.c_str(), buf.c_str());
}
@@ -173,15 +169,13 @@ class UnrealIRCdProto : public IRCDProto
}
/* JOIN */
void SendJoin(const BotInfo *user, const Anope::string &channel, time_t chantime)
void SendJoin(BotInfo *user, Channel *c, const ChannelStatus *status)
{
send_cmd(Config->ServerName, "~ %ld %s :%s", static_cast<long>(chantime), channel.c_str(), user->nick.c_str());
}
void SendJoin(BotInfo *user, const ChannelContainer *cc)
{
send_cmd(Config->ServerName, "~ %ld %s :%s%s", static_cast<long>(cc->chan->creation_time), cc->chan->name.c_str(), cc->Status->BuildModePrefixList().c_str(), user->nick.c_str());
cc->chan->SetModes(user, false, "%s", cc->chan->GetModes(true, true).c_str());
send_cmd(Config->ServerName, "~ %ld %s :%s", static_cast<long>(c->creation_time), c->name.c_str(), user->nick.c_str());
if (status)
for (size_t i = CMODE_BEGIN + 1; i != CMODE_END; ++i)
if (status->HasFlag(static_cast<ChannelModeName>(i)))
c->SetMode(user, static_cast<ChannelModeName>(i), user->nick, false);
}
/* unsqline
@@ -209,16 +203,12 @@ class UnrealIRCdProto : public IRCDProto
*/
void SendSVSO(const Anope::string &source, const Anope::string &nick, const Anope::string &flag)
{
if (source.empty() || nick.empty() || flag.empty())
return;
send_cmd(source, "BB %s %s", nick.c_str(), flag.c_str());
}
/* NICK <newnick> */
void SendChangeBotNick(const BotInfo *oldnick, const Anope::string &newnick)
{
if (!oldnick || newnick.empty())
return;
send_cmd(oldnick->nick, "& %s %ld", newnick.c_str(), static_cast<long>(Anope::CurTime));
}
@@ -339,7 +329,7 @@ class UnrealIRCdProto : public IRCDProto
ircdproto->SendMode(NickServ, u, "+d 1");
}
void SendChannel(Channel *c, const Anope::string &modes)
void SendChannel(Channel *c)
{
/* Unreal does not support updating a channels TS without actually joining a user,
* so we will join and part us now
@@ -347,13 +337,13 @@ class UnrealIRCdProto : public IRCDProto
BotInfo *bi = whosends(c->ci);
if (c->FindUser(bi) == NULL)
{
bi->Join(c, true);
bi->Join(c);
bi->Part(c);
}
else
{
bi->Part(c);
bi->Join(c, true);
bi->Join(c);
}
}
};
@@ -374,7 +364,7 @@ class Unreal32IRCdMessage : public IRCdMessage
if (params[0][0] == '#' || params[0][0] == '&')
do_cmode(source, params[0], modes, server_source ? params[params.size() - 1] : "");
else
do_umode(source, params[0], modes);
do_umode(params[0], modes);
return true;
}
@@ -828,7 +818,7 @@ bool event_umode2(const Anope::string &source, const std::vector<Anope::string>
if (params.size() < 1)
return true;
do_umode(source, source, params[0]);
do_umode(source, params[0]);
return true;
}
@@ -981,43 +971,6 @@ bool ChannelModeFlood::IsValid(const Anope::string &value) const
return true;
}
static void AddModes()
{
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, "CMODE_VOICE", 'v', '+'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, "CMODE_HALFOP", 'h', '%'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, "CMODE_OP", 'o', '@'));
/* Unreal sends +q as * and +a as ~ */
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, "CMODE_PROTECT", 'a', '~'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, "CMODE_OWNER", 'q', '*'));
/* Add user modes */
ModeManager::AddUserMode(new UserMode(UMODE_SERV_ADMIN, "UMODE_SERV_ADMIN", 'A'));
ModeManager::AddUserMode(new UserMode(UMODE_BOT, "UMODE_BOT", 'B'));
ModeManager::AddUserMode(new UserMode(UMODE_CO_ADMIN, "UMODE_CO_ADMIN", 'C'));
ModeManager::AddUserMode(new UserMode(UMODE_FILTER, "UMODE_FILTER", 'G'));
ModeManager::AddUserMode(new UserMode(UMODE_HIDEOPER, "UMODE_HIDEOPER", 'H'));
ModeManager::AddUserMode(new UserMode(UMODE_NETADMIN, "UMODE_NETADMIN", 'N'));
ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, "UMODE_REGPRIV", 'R'));
ModeManager::AddUserMode(new UserMode(UMODE_PROTECTED, "UMODE_PROTECTED", 'S'));
ModeManager::AddUserMode(new UserMode(UMODE_NO_CTCP, "UMODE_NO_CTCP", 'T'));
ModeManager::AddUserMode(new UserMode(UMODE_WEBTV, "UMODE_WEBTV", 'V'));
ModeManager::AddUserMode(new UserMode(UMODE_WHOIS, "UMODE_WHOIS", 'W'));
ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, "UMODE_ADMIN", 'a'));
ModeManager::AddUserMode(new UserMode(UMODE_DEAF, "UMODE_DEAF", 'd'));
ModeManager::AddUserMode(new UserMode(UMODE_GLOBOPS, "UMODE_GLOBOPS", 'g'));
ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, "UMODE_HELPOP", 'h'));
ModeManager::AddUserMode(new UserMode(UMODE_INVIS, "UMODE_INVIS", 'i'));
ModeManager::AddUserMode(new UserMode(UMODE_OPER, "UMODE_OPER", 'o'));
ModeManager::AddUserMode(new UserMode(UMODE_PRIV, "UMODE_PRIV", 'p'));
ModeManager::AddUserMode(new UserMode(UMODE_GOD, "UMODE_GOD", 'q'));
ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, "UMODE_REGISTERED", 'r'));
ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, "UMODE_SNOMASK", 's'));
ModeManager::AddUserMode(new UserMode(UMODE_VHOST, "UMODE_VHOST", 't'));
ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, "UMODE_WALLOPS", 'w'));
ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, "UMODE_CLOAK", 'x'));
ModeManager::AddUserMode(new UserMode(UMODE_SSL, "UMODE_SSL", 'z'));
}
class ProtoUnreal : public Module
{
Message message_away, message_join, message_kick,
@@ -1035,6 +988,44 @@ class ProtoUnreal : public Module
UnrealIRCdProto ircd_proto;
Unreal32IRCdMessage ircd_message;
void AddModes()
{
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, "CMODE_VOICE", 'v', '+'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, "CMODE_HALFOP", 'h', '%'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, "CMODE_OP", 'o', '@'));
/* Unreal sends +q as * and +a as ~ */
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, "CMODE_PROTECT", 'a', '~'));
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, "CMODE_OWNER", 'q', '*'));
/* Add user modes */
ModeManager::AddUserMode(new UserMode(UMODE_SERV_ADMIN, "UMODE_SERV_ADMIN", 'A'));
ModeManager::AddUserMode(new UserMode(UMODE_BOT, "UMODE_BOT", 'B'));
ModeManager::AddUserMode(new UserMode(UMODE_CO_ADMIN, "UMODE_CO_ADMIN", 'C'));
ModeManager::AddUserMode(new UserMode(UMODE_FILTER, "UMODE_FILTER", 'G'));
ModeManager::AddUserMode(new UserMode(UMODE_HIDEOPER, "UMODE_HIDEOPER", 'H'));
ModeManager::AddUserMode(new UserMode(UMODE_NETADMIN, "UMODE_NETADMIN", 'N'));
ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, "UMODE_REGPRIV", 'R'));
ModeManager::AddUserMode(new UserMode(UMODE_PROTECTED, "UMODE_PROTECTED", 'S'));
ModeManager::AddUserMode(new UserMode(UMODE_NO_CTCP, "UMODE_NO_CTCP", 'T'));
ModeManager::AddUserMode(new UserMode(UMODE_WEBTV, "UMODE_WEBTV", 'V'));
ModeManager::AddUserMode(new UserMode(UMODE_WHOIS, "UMODE_WHOIS", 'W'));
ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, "UMODE_ADMIN", 'a'));
ModeManager::AddUserMode(new UserMode(UMODE_DEAF, "UMODE_DEAF", 'd'));
ModeManager::AddUserMode(new UserMode(UMODE_GLOBOPS, "UMODE_GLOBOPS", 'g'));
ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, "UMODE_HELPOP", 'h'));
ModeManager::AddUserMode(new UserMode(UMODE_INVIS, "UMODE_INVIS", 'i'));
ModeManager::AddUserMode(new UserMode(UMODE_OPER, "UMODE_OPER", 'o'));
ModeManager::AddUserMode(new UserMode(UMODE_PRIV, "UMODE_PRIV", 'p'));
ModeManager::AddUserMode(new UserMode(UMODE_GOD, "UMODE_GOD", 'q'));
ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, "UMODE_REGISTERED", 'r'));
ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, "UMODE_SNOMASK", 's'));
ModeManager::AddUserMode(new UserMode(UMODE_VHOST, "UMODE_VHOST", 't'));
ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, "UMODE_WALLOPS", 'w'));
ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, "UMODE_CLOAK", 'x'));
ModeManager::AddUserMode(new UserMode(UMODE_SSL, "UMODE_SSL", 'z'));
}
public:
ProtoUnreal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator),
message_away("6", OnAway),
@@ -1065,11 +1056,11 @@ class ProtoUnreal : public Module
this->SetAuthor("Anope");
this->SetType(PROTOCOL);
AddModes();
pmodule_ircd_var(myIrcd);
pmodule_ircd_proto(&this->ircd_proto);
pmodule_ircd_message(&this->ircd_message);
this->AddModes();
ModuleManager::Attach(I_OnUserNickChange, this);
}
+6 -26
View File
@@ -175,7 +175,7 @@ void BotInfo::UnAssign(User *u, ChannelInfo *ci)
ci->bi = NULL;
}
void BotInfo::Join(Channel *c, bool update_ts)
void BotInfo::Join(Channel *c, ChannelStatus *status)
{
if (Config->BSSmartJoin)
{
@@ -202,35 +202,15 @@ void BotInfo::Join(Channel *c, bool update_ts)
}
c->JoinUser(this);
ChannelContainer *cc = this->FindChannel(c);
for (unsigned i = 0; i < Config->BotModeList.size(); ++i)
{
if (!update_ts)
{
c->SetMode(this, Config->BotModeList[i], this->nick, false);
}
else
{
cc->Status->SetFlag(Config->BotModeList[i]->Name);
c->SetModeInternal(Config->BotModeList[i], this->nick, false);
}
}
if (!update_ts)
ircdproto->SendJoin(this, c->name, c->creation_time);
/* This is sent later, when we burst to the uplink */
else if (Me && Me->IsSynced())
{
ircdproto->SendJoin(this, cc);
c->Reset();
}
FOREACH_MOD(I_OnBotJoin, OnBotJoin(c->ci, this));
ircdproto->SendJoin(this, c, status);
FOREACH_MOD(I_OnBotJoin, OnBotJoin(c, this));
}
void BotInfo::Join(const Anope::string &chname, bool update_ts)
void BotInfo::Join(const Anope::string &chname, ChannelStatus *status)
{
Channel *c = findchan(chname);
return this->Join(c ? c : new Channel(chname), update_ts);
return this->Join(c ? c : new Channel(chname), status);
}
void BotInfo::Part(Channel *c, const Anope::string &reason)
+14 -10
View File
@@ -126,7 +126,7 @@ void Channel::JoinUser(User *user)
{
Log(LOG_DEBUG) << "Changing TS of " << this->name << " from " << this->creation_time << " to " << this->ci->time_registered;
this->creation_time = this->ci->time_registered;
ircdproto->SendChannel(this, "");
ircdproto->SendChannel(this);
this->Reset();
}
@@ -147,7 +147,7 @@ void Channel::JoinUser(User *user)
* legit users - Rob
**/
if (this->users.size() >= Config->BSMinUsers && !this->FindUser(this->ci->bi))
this->ci->bi->Join(this, false);
this->ci->bi->Join(this, &Config->BotModeList);
/* Only display the greet if the main uplink we're connected
* to has synced, or we'll get greet-floods when the net
* recovers from a netsplit. -GD
@@ -444,16 +444,17 @@ void Channel::RemoveModeInternal(ChannelMode *cm, const Anope::string &param, bo
if (cc)
cc->Status->UnsetFlag(cm->Name);
/* Reset modes on bots if we're supposed to */
if (bi)
{
if (std::find(Config->BotModeList.begin(), Config->BotModeList.end(), cm) != Config->BotModeList.end())
this->SetMode(bi, cm, bi->nick);
}
/* Enforce secureops, etc */
if (EnforceMLock)
{
/* Reset modes on bots if we're supposed to */
if (bi)
{
if (Config->BotModeList.HasFlag(cm->Name))
this->SetMode(bi, cm, bi->nick);
}
chan_set_correct_modes(u, this, 0);
}
return;
}
@@ -726,7 +727,10 @@ void Channel::SetModesInternal(User *setter, const Anope::string &mode, bool Enf
continue;
cm = ModeManager::FindChannelModeByChar(m[i]);
if (!cm)
{
Log(LOG_DEBUG) << "Channel::SetModeInternal: Unknown mode char " << m[i];
continue;
}
modestring += cm->ModeChar;
}
+3
View File
@@ -109,6 +109,9 @@ int levelinfo_maxwidth = 0;
Anope::string get_mlock_modes(ChannelInfo *ci, int complete)
{
if (!ci)
return "";
Anope::string pos = "+", neg = "-", params;
for (std::multimap<ChannelModeName, ModeLock>::const_iterator it = ci->GetMLock().begin(), it_end = ci->GetMLock().end(); it != it_end; ++it)
+6 -4
View File
@@ -141,6 +141,7 @@ void mod_run_cmd(BotInfo *bi, User *u, Command *c, const Anope::string &command,
if (params.size() < c->MinParams)
{
c->OnSyntaxError(source, !params.empty() ? params[params.size() - 1] : "");
source.DoReply();
PopLanguage();
return;
}
@@ -149,6 +150,7 @@ void mod_run_cmd(BotInfo *bi, User *u, Command *c, const Anope::string &command,
FOREACH_RESULT(I_OnPreCommand, OnPreCommand(source, c, params));
if (MOD_RESULT == EVENT_STOP)
{
source.DoReply();
PopLanguage();
return;
}
@@ -158,16 +160,16 @@ void mod_run_cmd(BotInfo *bi, User *u, Command *c, const Anope::string &command,
{
u->SendMessage(bi, LanguageString::ACCESS_DENIED);
Log(LOG_COMMAND, "denied", bi) << "Access denied for user " << u->GetMask() << " with command " << command;
source.DoReply();
PopLanguage();
return;
}
CommandReturn ret = c->Execute(source, params);
if (ret == MOD_STOP)
return;
if (ret == MOD_CONT)
{
FOREACH_MOD(I_OnPostCommand, OnPostCommand(source, c, params));
}
FOREACH_MOD(I_OnPostCommand, OnPostCommand(source, c, params));
source.DoReply();
}
+2 -3
View File
@@ -317,6 +317,8 @@ ServerConfig::ServerConfig() : errstr(""), config_data(), NSDefFlags(NickCoreFla
}
SetDefaultMLock(this);
if (ircd)
InitLogChannels(this);
if (IsFile(this->NameServer))
{
@@ -950,9 +952,6 @@ bool DoLogs(ServerConfig *config, const Anope::string &, const Anope::string *,
bool DoneLogs(ServerConfig *config, const Anope::string &)
{
if (ircd)
InitLogChannels(config);
Log() << "Loaded " << config->LogInfos.size() << " log blocks";
return true;
+2 -2
View File
@@ -37,7 +37,7 @@ void introduce_user(const Anope::string &user)
ircdproto->SendSQLine(&x);
for (UChannelList::const_iterator cit = bi->chans.begin(), cit_end = bi->chans.end(); cit != cit_end; ++cit)
ircdproto->SendJoin(bi, *cit);
ircdproto->SendJoin(bi, (*cit)->chan, &Config->BotModeList);
}
}
@@ -70,7 +70,7 @@ void introduce_user(const Anope::string &user)
ircdproto->SendSQLine(&x);
for (UChannelList::const_iterator cit = bi->chans.begin(), cit_end = bi->chans.end(); cit != cit_end; ++cit)
ircdproto->SendJoin(bi, *cit);
ircdproto->SendJoin(bi, (*cit)->chan, &Config->BotModeList);
}
}
+1 -7
View File
@@ -27,12 +27,8 @@ void InitLogChannels(ServerConfig *config)
if (target[0] == '#')
{
Channel *c = findchan(target);
bool created = false;
if (!c)
{
c = new Channel(target);
created = true;
}
c->SetFlag(CH_LOGCHAN);
c->SetFlag(CH_PERSIST);
@@ -41,9 +37,7 @@ void InitLogChannels(ServerConfig *config)
BotInfo *bi = *it;
if (bi->HasFlag(BI_CORE) && !c->FindUser(bi))
{
bi->Join(c, created);
}
bi->Join(c, &config->BotModeList);
}
}
}
+3 -26
View File
@@ -68,36 +68,13 @@ void SetDefaultMLock(ServerConfig *config)
}
/* Set Bot Modes */
config->BotModeList.clear();
config->BotModeList.ClearFlags();
for (unsigned i = 0; i < config->BotModes.length(); ++i)
{
ChannelMode *cm = ModeManager::FindChannelModeByChar(config->BotModes[i]);
if (cm && cm->Type == MODE_STATUS && std::find(config->BotModeList.begin(), config->BotModeList.end(), cm) == config->BotModeList.end())
config->BotModeList.push_back(debug_cast<ChannelModeStatus *>(cm));
}
/* Apply the new modes to channels */
for (patricia_tree<BotInfo *, ci::ci_char_traits>::iterator it(BotListByNick); it.next();)
{
BotInfo *bi = *it;
for (UChannelList::const_iterator cit = bi->chans.begin(); cit != bi->chans.end(); ++cit)
{
ChannelContainer *cc = *cit;
if (!cc || !cc->chan)
continue;
for (unsigned i = 0; i < config->BotModeList.size(); ++i)
{
if (cc->Status->HasFlag(config->BotModeList[i]->Name))
continue;
cc->Status->SetFlag(config->BotModeList[i]->Name);
cc->chan->SetModeInternal(config->BotModeList[i], bi->nick, false);
}
}
if (cm && cm->Type == MODE_STATUS)
config->BotModeList.SetFlag(cm->Name);
}
}
-5
View File
@@ -212,11 +212,6 @@ void IRCDProto::SendPong(const Anope::string &servname, const Anope::string &who
send_cmd(ircd->ts6 ? Config->Numeric : Config->ServerName, "PONG %s %s", servname.c_str(), who.c_str());
}
void IRCDProto::SendJoin(BotInfo *bi, const ChannelContainer *cc)
{
SendJoin(bi, cc->chan->name, cc->chan->creation_time);
}
void IRCDProto::SendInvite(const BotInfo *bi, const Anope::string &chan, const Anope::string &nick)
{
send_cmd(ircd->ts6 ? bi->GetUID() : bi->nick, "INVITE %s %s", nick.c_str(), chan.c_str());
+5 -5
View File
@@ -568,8 +568,8 @@ void ChannelInfo::LoadMLock()
if (ModeManager::FindChannelModeByName(CMODE_PERM) != NULL)
{
/* At this point, CMODE_PERM *must* be locked on the channel, so this is fine */
ircdproto->SendChannel(this->c, get_mlock_modes(this, true));
this->c->SetModesInternal(NULL, get_mlock_modes(this, true));
ircdproto->SendChannel(this->c);
this->c->Reset();
}
else
{
@@ -577,10 +577,10 @@ void ChannelInfo::LoadMLock()
whosends(this)->Assign(NULL, this);
if (this->c->FindUser(this->bi) == NULL)
this->bi->Join(this->c);
}
check_modes(this->c);
this->RestoreTopic();
check_modes(this->c);
this->RestoreTopic();
}
}
}
+1 -1
View File
@@ -823,7 +823,7 @@ User *do_nick(const Anope::string &source, const Anope::string &nick, const Anop
/*************************************************************************/
void do_umode(const Anope::string &, const Anope::string &user, const Anope::string &modes)
void do_umode(const Anope::string &user, const Anope::string &modes)
{
User *u = finduser(user);
if (!u)