diff options
author | Adam <Adam@anope.org> | 2010-11-23 16:48:54 -0600 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-12-12 19:36:19 -0500 |
commit | 37e02a3594fdddc3d5a3df0501c528f42db6c4da (patch) | |
tree | 2b26a003def3b3ecdd7f46aa67d172a3b04a7369 | |
parent | 7d1cfe9514062a451b480783fe8df6e63f2954ab (diff) |
Added cs_entrymsg
-rw-r--r-- | data/example.conf | 13 | ||||
-rw-r--r-- | data/mysql/tables.sql | 1 | ||||
-rw-r--r-- | docs/Changes.conf | 1 | ||||
-rw-r--r-- | include/language.h | 17 | ||||
-rw-r--r-- | include/regchannel.h | 2 | ||||
-rw-r--r-- | modules/core/cs_info.cpp | 3 | ||||
-rw-r--r-- | modules/core/cs_set_entrymsg.cpp | 113 | ||||
-rw-r--r-- | modules/core/db_plain.cpp | 4 | ||||
-rw-r--r-- | modules/extra/cs_entrymsg.cpp | 215 | ||||
-rw-r--r-- | modules/extra/db_mysql.cpp | 11 | ||||
-rw-r--r-- | modules/protocol/plexus.cpp | 2 | ||||
-rw-r--r-- | src/channels.cpp | 4 | ||||
-rw-r--r-- | src/chanserv.cpp | 2 | ||||
-rw-r--r-- | src/language.cpp | 42 |
14 files changed, 272 insertions, 158 deletions
diff --git a/data/example.conf b/data/example.conf index a7bb64751..df6bcee3d 100644 --- a/data/example.conf +++ b/data/example.conf @@ -1904,3 +1904,16 @@ alias command = "BAN" } +/* + * cs_entrymsg + * + * Allows you to set entry messages on your channel, which are shown to anyone + * who joins. + */ +module { name = "cs_entrymsg" } +cs_entrymsg +{ + /* The maximum number of entrymsgs allowed per channel. If not set, defaults to 5. */ + maxentries = 5 +} + diff --git a/data/mysql/tables.sql b/data/mysql/tables.sql index e165e94ad..d0f16b0d5 100644 --- a/data/mysql/tables.sql +++ b/data/mysql/tables.sql @@ -112,7 +112,6 @@ CREATE TABLE IF NOT EXISTS `anope_cs_info` ( `mlock_off` text NOT NULL, `mlock_params` text NOT NULL, `mlock_params_off` text NOT NULL, - `entry_message` text NOT NULL, `memomax` smallint(5) unsigned NOT NULL DEFAULT '0', `botnick` varchar(255) NOT NULL DEFAULT '', `botflags` text NOT NULL, diff --git a/docs/Changes.conf b/docs/Changes.conf index 45980c7ac..fab3b6b26 100644 --- a/docs/Changes.conf +++ b/docs/Changes.conf @@ -4,6 +4,7 @@ memoserv:modules added ms_ignore chanserv:modules added cs_clone and cs_mode nickserv:suspendexpire and nickserv:forbidexpire added chanserv:suspendexpire and chanserv:forbidexpire added +added cs_entrymsg Anope Version 1.9.3 ------------------ diff --git a/include/language.h b/include/language.h index ec3595060..0b183598b 100644 --- a/include/language.h +++ b/include/language.h @@ -343,8 +343,6 @@ enum LanguageString CHAN_SUCCESSOR_UNSET, CHAN_SUCCESSOR_IS_FOUNDER, CHAN_DESC_CHANGED, - CHAN_ENTRY_MSG_CHANGED, - CHAN_ENTRY_MSG_UNSET, CHAN_SET_BANTYPE_INVALID, CHAN_SET_BANTYPE_CHANGED, CHAN_SET_MLOCK_DEPRECATED, @@ -524,7 +522,6 @@ enum LanguageString CHAN_INFO_NO_FOUNDER, CHAN_INFO_NO_SUCCESSOR, CHAN_INFO_DESCRIPTION, - CHAN_INFO_ENTRYMSG, CHAN_INFO_TIME_REGGED, CHAN_INFO_LAST_USED, CHAN_INFO_LAST_TOPIC, @@ -597,6 +594,16 @@ enum LanguageString CHAN_MODE_NOT_LOCKED, CHAN_MODE_UNLOCKED, CHAN_MODE_LIST_FMT, + CHAN_ENTRYMSG_LIST_HEADER, + CHAN_ENTRYMSG_LIST_ENTRY, + CHAN_ENTRYMSG_LIST_END, + CHAN_ENTRYMSG_LIST_EMPTY, + CHAN_ENTRYMSG_LIST_FULL, + CHAN_ENTRYMSG_ADDED, + CHAN_ENTRYMSG_DELETED, + CHAN_ENTRYMSG_NOT_FOUND, + CHAN_ENTRYMSG_CLEARED, + CHAN_ENTRYMSG_SYNTAX, MEMO_HAVE_NEW_MEMO, MEMO_HAVE_NEW_MEMOS, MEMO_TYPE_READ_LAST, @@ -1285,6 +1292,7 @@ enum LanguageString CHAN_HELP_CMD_DEOP, CHAN_HELP_CMD_CLONE, CHAN_HELP_CMD_MODE, + CHAN_HELP_CMD_ENTRYMSG, CHAN_HELP, CHAN_HELP_EXPIRES, CHAN_HELP_REGISTER, @@ -1294,7 +1302,6 @@ enum LanguageString CHAN_HELP_CMD_SET_FOUNDER, CHAN_HELP_CMD_SET_SUCCESSOR, CHAN_HELP_CMD_SET_DESC, - CHAN_HELP_CMD_SET_ENTRYMSG, CHAN_HELP_CMD_SET_BANTYPE, CHAN_HELP_CMD_SET_KEEPTOPIC, CHAN_HELP_CMD_SET_OPNOTICE, @@ -1314,7 +1321,6 @@ enum LanguageString CHAN_HELP_SET_FOUNDER, CHAN_HELP_SET_SUCCESSOR, CHAN_HELP_SET_DESC, - CHAN_HELP_SET_ENTRYMSG, CHAN_HELP_SET_BANTYPE, CHAN_HELP_SET_KEEPTOPIC, CHAN_HELP_SET_TOPICLOCK, @@ -1360,6 +1366,7 @@ enum LanguageString CHAN_HELP_GETKEY, CHAN_HELP_CLONE, CHAN_HELP_MODE, + CHAN_HELP_ENTRYMSG, CHAN_SERVADMIN_HELP, CHAN_SERVADMIN_HELP_DROP, CHAN_SERVADMIN_HELP_SET_NOEXPIRE, diff --git a/include/regchannel.h b/include/regchannel.h index dd47a88fc..760a91f5f 100644 --- a/include/regchannel.h +++ b/include/regchannel.h @@ -116,8 +116,6 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag, int16 bantype; int16 *levels; /* Access levels for commands */ - Anope::string entry_message; /* Notice sent on entering channel */ - MemoInfo memos; Channel *c; /* Pointer to channel record (if channel is currently in use) */ diff --git a/modules/core/cs_info.cpp b/modules/core/cs_info.cpp index 0df02ff43..bae7e118c 100644 --- a/modules/core/cs_info.cpp +++ b/modules/core/cs_info.cpp @@ -73,9 +73,6 @@ class CommandCSInfo : public Command u->SendMessage(ChanServ, CHAN_INFO_TOPIC_SET_BY, ci->last_topic_setter.c_str()); } - if (!ci->entry_message.empty() && show_all) - u->SendMessage(ChanServ, CHAN_INFO_ENTRYMSG, ci->entry_message.c_str()); - if (show_all) { u->SendMessage(ChanServ, CHAN_INFO_BANTYPE, ci->bantype); diff --git a/modules/core/cs_set_entrymsg.cpp b/modules/core/cs_set_entrymsg.cpp deleted file mode 100644 index 263e37d91..000000000 --- a/modules/core/cs_set_entrymsg.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* ChanServ core functions - * - * (C) 2003-2010 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - */ - -/*************************************************************************/ - -#include "module.h" - -class CommandCSSetEntryMsg : public Command -{ - public: - CommandCSSetEntryMsg(const Anope::string &cpermission = "") : Command("ENTRYMSG", 1, 2, cpermission) - { - } - - CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) - { - ChannelInfo *ci = cs_findchan(params[0]); - if (!ci) - throw CoreException("NULL ci in CommandCSSetEntryMsg"); - - if (params.size() > 1) - { - ci->entry_message = params[1]; - u->SendMessage(ChanServ, CHAN_ENTRY_MSG_CHANGED, ci->name.c_str(), ci->entry_message.c_str()); - } - else - { - ci->entry_message.clear(); - u->SendMessage(ChanServ, CHAN_ENTRY_MSG_UNSET, ci->name.c_str()); - } - - return MOD_CONT; - } - - bool OnHelp(User *u, const Anope::string &) - { - u->SendMessage(ChanServ, CHAN_HELP_SET_ENTRYMSG, "SET"); - return true; - } - - void OnSyntaxError(User *u, const Anope::string &) - { - // XXX - SyntaxError(ChanServ, u, "SET", CHAN_SET_SYNTAX); - } - - void OnServHelp(User *u) - { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_ENTRYMSG); - } -}; - -class CommandCSSASetEntryMsg : public CommandCSSetEntryMsg -{ - public: - CommandCSSASetEntryMsg() : CommandCSSetEntryMsg("chanserv/saset/entrymsg") - { - } - - bool OnHelp(User *u, const Anope::string &) - { - u->SendMessage(ChanServ, CHAN_HELP_SET_ENTRYMSG, "SASET"); - return true; - } - - void OnSyntaxError(User *u, const Anope::string &) - { - // XXX - SyntaxError(ChanServ, u, "SASET", CHAN_SASET_SYNTAX); - } -}; - -class CSSetEntryMsg : public Module -{ - CommandCSSetEntryMsg commandcssetentrymsg; - CommandCSSASetEntryMsg commandcssasetentrymsg; - - public: - CSSetEntryMsg(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) - { - this->SetAuthor("Anope"); - this->SetType(CORE); - - Command *c = FindCommand(ChanServ, "SET"); - if (c) - c->AddSubcommand(&commandcssetentrymsg); - - c = FindCommand(ChanServ, "SASET"); - if (c) - c->AddSubcommand(&commandcssasetentrymsg); - } - - ~CSSetEntryMsg() - { - Command *c = FindCommand(ChanServ, "SET"); - if (c) - c->DelSubcommand(&commandcssetentrymsg); - - c = FindCommand(ChanServ, "SASET"); - if (c) - c->DelSubcommand(&commandcssasetentrymsg); - } -}; - -MODULE_INIT(CSSetEntryMsg) diff --git a/modules/core/db_plain.cpp b/modules/core/db_plain.cpp index 3fa235710..953f35b4a 100644 --- a/modules/core/db_plain.cpp +++ b/modules/core/db_plain.cpp @@ -776,8 +776,6 @@ class DBPlain : public Module } else if (key.equals_ci("MIG")) ci->memos.ignores.push_back(params[0].ci_str()); - else if (key.equals_ci("ENTRYMSG")) - ci->entry_message = params[0]; else if (key.equals_ci("BI")) { if (params[0].equals_ci("NAME")) @@ -1061,8 +1059,6 @@ class DBPlain : public Module } for (unsigned k = 0, end = memos->ignores.size(); k < end; ++k) db << "MD MIG " << Anope::string(memos->ignores[k]) << endl; - if (!ci->entry_message.empty()) - db << "MD ENTRYMSG :" << ci->entry_message << endl; if (ci->bi) db << "MD BI NAME " << ci->bi->nick << endl; if (ci->botflags.FlagCount()) diff --git a/modules/extra/cs_entrymsg.cpp b/modules/extra/cs_entrymsg.cpp new file mode 100644 index 000000000..e2143f7d1 --- /dev/null +++ b/modules/extra/cs_entrymsg.cpp @@ -0,0 +1,215 @@ +/* ChanServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + */ + +/*************************************************************************/ + +#include "module.h" + +struct EntryMsg +{ + static unsigned MaxEntries; + + EntryMsg(const Anope::string &cname, const Anope::string &cmessage, time_t ct = Anope::CurTime) + { + this->creator = cname; + this->message = cmessage; + this->when = ct; + } + + Anope::string creator; + Anope::string message; + time_t when; +}; +unsigned EntryMsg::MaxEntries = 0; + +class CommandEntryMessage : public Command +{ + private: + void DoList(User *u, ChannelInfo *ci) + { + std::vector<EntryMsg> messages; + if (ci->GetExtRegular("cs_entrymsg", messages)) + { + u->SendMessage(ChanServ, CHAN_ENTRYMSG_LIST_HEADER, ci->name.c_str()); + for (unsigned i = 0; i < messages.size(); ++i) + u->SendMessage(ChanServ, CHAN_ENTRYMSG_LIST_ENTRY, i + 1, messages[i].message.c_str(), messages[i].creator.c_str(), do_strftime(messages[i].when).c_str()); + u->SendMessage(ChanServ, CHAN_ENTRYMSG_LIST_END); + } + else + u->SendMessage(ChanServ, CHAN_ENTRYMSG_LIST_EMPTY, ci->name.c_str()); + } + + void DoAdd(User *u, ChannelInfo *ci, const Anope::string &message) + { + std::vector<EntryMsg> messages; + ci->GetExtRegular("cs_entrymsg", messages); + + if (EntryMsg::MaxEntries && messages.size() >= EntryMsg::MaxEntries) + u->SendMessage(ChanServ, CHAN_ENTRYMSG_LIST_FULL, ci->name.c_str()); + else + { + messages.push_back(EntryMsg(u->nick, message)); + ci->Extend("cs_entrymsg", new ExtensibleItemRegular<std::vector<EntryMsg> >(messages)); + u->SendMessage(ChanServ, CHAN_ENTRYMSG_ADDED, ci->name.c_str()); + } + } + + void DoDel(User *u, ChannelInfo *ci, const Anope::string &message) + { + std::vector<EntryMsg> messages; + if (!message.is_pos_number_only()) + u->SendMessage(ChanServ, CHAN_ENTRYMSG_NOT_FOUND, message.c_str(), ci->name.c_str()); + else if (ci->GetExtRegular("cs_entrymsg", messages)) + { + unsigned i = convertTo<unsigned>(message); + if (i > 0 && i <= messages.size()) + { + messages.erase(messages.begin() + i - 1); + ci->Extend("cs_entrymsg", new ExtensibleItemRegular<std::vector<EntryMsg> >(messages)); + u->SendMessage(ChanServ, CHAN_ENTRYMSG_DELETED, i, ci->name.c_str()); + } + else + u->SendMessage(ChanServ, CHAN_ENTRYMSG_NOT_FOUND, message.c_str(), ci->name.c_str()); + } + else + u->SendMessage(ChanServ, CHAN_ENTRYMSG_LIST_EMPTY, ci->name.c_str()); + } + + void DoClear(User *u, ChannelInfo *ci) + { + ci->Shrink("cs_entrymsg"); + u->SendMessage(ChanServ, CHAN_ENTRYMSG_CLEARED, ci->name.c_str()); + } + + public: + CommandEntryMessage(const Anope::string &cname) : Command(cname, 2, 3) + { + } + + CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) + { + ChannelInfo *ci = cs_findchan(params[0]); + if (ci && (IsFounder(u, ci) || u->Account()->HasCommand("chanserv/entrymsg"))) + { + bool success = true; + if (params[1].equals_ci("LIST")) + this->DoList(u, ci); + else if (params[1].equals_ci("CLEAR")) + this->DoClear(u, ci); + else if (params.size() < 3) + { + success = false; + this->OnSyntaxError(u, ""); + } + else if (params[1].equals_ci("ADD")) + this->DoAdd(u, ci, params[2]); + else if (params[1].equals_ci("DEL")) + this->DoDel(u, ci, params[2]); + else + { + success = false; + this->OnSyntaxError(u, ""); + } + if (success) + Log(IsFounder(u, ci) ? LOG_COMMAND : LOG_OVERRIDE, u, this, ci) << params[1]; + } + else + { + u->SendMessage(ChanServ, ACCESS_DENIED); + } + + return MOD_CONT; + } + + void OnSyntaxError(User *u, const Anope::string &) + { + SyntaxError(ChanServ, u, "ENTRYMSG", CHAN_ENTRYMSG_SYNTAX); + } + + bool OnHelp(User *u, const Anope::string &subcommand) + { + u->SendMessage(ChanServ, CHAN_HELP_ENTRYMSG); + return true; + } + + void OnServHelp(User *u) + { + u->SendMessage(ChanServ, CHAN_HELP_CMD_ENTRYMSG); + } +}; + +class CSEntryMessage : public Module +{ + CommandEntryMessage commandentrymsg; + + public: + CSEntryMessage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), commandentrymsg("ENTRYMSG") + { + this->SetAuthor("Anope"); + this->SetType(CORE); + + Implementation i[] = { I_OnJoinChannel, I_OnReload, I_OnDatabaseReadMetadata, I_OnDatabaseWriteMetadata }; + ModuleManager::Attach(i, this, 4); + + this->AddCommand(ChanServ, &commandentrymsg); + + this->OnReload(false); + } + + void OnJoinChannel(User *u, Channel *c) + { + if (u && c && c->ci && u->server->IsSynced()) + { + std::vector<EntryMsg> messages; + + if (c->ci->GetExtRegular("cs_entrymsg", messages)) + for (unsigned i = 0; i < messages.size(); ++i) + this->SendMessage(whosends(c->ci), u, "[%s] %s", c->ci->name.c_str(), messages[i].message.c_str()); + } + } + + void OnReload(bool) + { + ConfigReader config; + EntryMsg::MaxEntries = config.ReadInteger("cs_entrymsg", "maxentries", "5", 0, true); + } + + EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const Anope::string &key, const std::vector<Anope::string> ¶ms) + { + if (key.find("CS_ENTRYMSG_") == 0 && params.size() > 2) + { + Anope::string creator = params[0]; + time_t t = params[1].is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime; + Anope::string message = params[2]; + for (unsigned j = 3; j < params.size(); ++j) + message += " " + params[j]; + + std::vector<EntryMsg> messages; + ci->GetExtRegular("cs_entrymsg", messages); + messages.push_back(EntryMsg(creator, message, t)); + ci->Extend("cs_entrymsg", new ExtensibleItemRegular<std::vector<EntryMsg> >(messages)); + + return EVENT_STOP; + } + + return EVENT_CONTINUE; + } + + void OnDatabaseWriteMetadata(void (*WriteMetadata)(const Anope::string &, const Anope::string &), ChannelInfo *ci) + { + std::vector<EntryMsg> messages; + if (ci->GetExtRegular("cs_entrymsg", messages)) + for (unsigned i = 0; i < messages.size(); ++i) + WriteMetadata("CS_ENTRYMSG_" + stringify(i), messages[i].creator + " " + stringify(messages[i].when) + " " + messages[i].message); + } +}; + +MODULE_INIT(CSEntryMessage) diff --git a/modules/extra/db_mysql.cpp b/modules/extra/db_mysql.cpp index 8b90fa59e..bd1810f94 100644 --- a/modules/extra/db_mysql.cpp +++ b/modules/extra/db_mysql.cpp @@ -615,7 +615,6 @@ class DBMySQL : public Module ci->forbidby = r.Get(i, "forbidby"); ci->forbidreason = r.Get(i, "forbidreason"); ci->bantype = r.Get(i, "bantype").is_number_only() ? convertTo<int>(r.Get(i, "bantype")) : 2; - ci->entry_message = r.Get(i, "entry_message"); ci->memos.memomax = r.Get(i, "memomax").is_number_only() ? convertTo<int>(r.Get(i, "memomax")) : 20; ci->capsmin = r.Get(i, "capsmin").is_number_only() ? convertTo<int>(r.Get(i, "capsmin")) : 0; ci->capspercent = r.Get(i, "capspercent").is_number_only() ? convertTo<int>(r.Get(i, "capspercent")) : 0; @@ -1033,10 +1032,6 @@ class DBMySQL : public Module { this->RunQuery("UPDATE `anope_cs_info` SET `descr` = '" + this->Escape(ci->desc) + "' WHERE `name` = '" + this->Escape(ci->name) + "'"); } - else if (params[1].equals_ci("ENTRYMSG")) - { - this->RunQuery("UPDATE `anope_cs_info` SET `entry_message` = '" + this->Escape(ci->entry_message) + "' WHERE `name` = '" + this->Escape(ci->name) + "'"); - } else if (params[1].equals_ci("MLOCK")) { this->RunQuery("UPDATE `anope_cs_info` SET `mlock_on` = '" + GetMLockOn(ci) + "' WHERE `name` = '" + this->Escape(ci->name) + "'"); @@ -1261,16 +1256,16 @@ class DBMySQL : public Module void OnChanRegistered(ChannelInfo *ci) { Anope::string flags = BuildFlagsList(ci), mlockon = GetMLockOn(ci), mlockoff = GetMLockOff(ci), mlockparams = GetMLockParams(ci, true), mlockparams_off = GetMLockParams(ci, false); - this->RunQuery("INSERT INTO `anope_cs_info` (name, founder, successor, descr, time_registered, last_used, last_topic, last_topic_setter, last_topic_time, flags, forbidby, forbidreason, bantype, mlock_on, mlock_off, mlock_params, mlock_params_off, entry_message, memomax, botnick, botflags, capsmin, capspercent, floodlines, floodsecs, repeattimes) VALUES('" + + this->RunQuery("INSERT INTO `anope_cs_info` (name, founder, successor, descr, time_registered, last_used, last_topic, last_topic_setter, last_topic_time, flags, forbidby, forbidreason, bantype, mlock_on, mlock_off, mlock_params, mlock_params_off, memomax, botnick, botflags, capsmin, capspercent, floodlines, floodsecs, repeattimes) VALUES('" + this->Escape(ci->name) + "', '" + this->Escape(ci->founder ? ci->founder->display : "") + "', '" + this->Escape(ci->successor ? ci->successor->display : "") + "', '" + this->Escape(ci->desc) + "', " + stringify(ci->time_registered) + ", " + stringify(ci->last_used) + ", '" + this->Escape(ci->last_topic) + "', '" + this->Escape(ci->last_topic_setter) + "', " + stringify(ci->last_topic_time) + ", '" + flags + "', '" + this->Escape(ci->forbidby) + "', '" + this->Escape(ci->forbidreason) + "', " + stringify(ci->bantype) + ", '" + - mlockon + "', '" + mlockoff + "', '" + mlockparams + "', '" + mlockparams_off + "', '" + this->Escape(ci->entry_message) + "', " + + mlockon + "', '" + mlockoff + "', '" + mlockparams + "', '" + mlockparams_off + "', " + stringify(ci->memos.memomax) + ", '" + this->Escape(ci->bi ? ci->bi->nick : "") + "', '" + GetBotFlags(ci->botflags) + "', " + stringify(ci->capsmin) + ", " + stringify(ci->capspercent) + ", " + stringify(ci->floodlines) + ", " + stringify(ci->floodsecs) + ", " + stringify(ci->repeattimes) + ") " + - "ON DUPLICATE KEY UPDATE founder=VALUES(founder), successor=VALUES(successor), descr=VALUES(descr), time_registered=VALUES(time_registered), last_used=VALUES(last_used), last_topic=VALUES(last_topic), last_topic_setter=VALUES(last_topic_setter), last_topic_time=VALUES(last_topic_time), flags=VALUES(flags), forbidby=VALUES(forbidby), forbidreason=VALUES(forbidreason), bantype=VALUES(bantype), mlock_on=VALUES(mlock_on), mlock_off=VALUES(mlock_off), mlock_params=VALUES(mlock_params), entry_message=VALUES(entry_message), memomax=VALUES(memomax), botnick=VALUES(botnick), botflags=VALUES(botflags), capsmin=VALUES(capsmin), capspercent=VALUES(capspercent), floodlines=VALUES(floodlines), floodsecs=VALUES(floodsecs), repeattimes=VALUES(repeattimes)"); + "ON DUPLICATE KEY UPDATE founder=VALUES(founder), successor=VALUES(successor), descr=VALUES(descr), time_registered=VALUES(time_registered), last_used=VALUES(last_used), last_topic=VALUES(last_topic), last_topic_setter=VALUES(last_topic_setter), last_topic_time=VALUES(last_topic_time), flags=VALUES(flags), forbidby=VALUES(forbidby), forbidreason=VALUES(forbidreason), bantype=VALUES(bantype), mlock_on=VALUES(mlock_on), mlock_off=VALUES(mlock_off), mlock_params=VALUES(mlock_params), memomax=VALUES(memomax), botnick=VALUES(botnick), botflags=VALUES(botflags), capsmin=VALUES(capsmin), capspercent=VALUES(capspercent), floodlines=VALUES(floodlines), floodsecs=VALUES(floodsecs), repeattimes=VALUES(repeattimes)"); } void OnChanSuspend(ChannelInfo *ci) diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index 0f37963c5..551c025ae 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -157,7 +157,7 @@ class RatboxProto : public IRCDProto void SendForceNickChange(const User *u, const Anope::string &newnick, time_t when) { - send_cmd(Config->Numeric, "ENCAP %s SVSNICK %s %ld %s %ld", u->server->GetName().c_str(), u->nick, static_cast<long>(u->timestamp), newnick, static_cast<long>(when)); + send_cmd(Config->Numeric, "ENCAP %s SVSNICK %s %ld %s %ld", u->server->GetName().c_str(), u->nick.c_str(), static_cast<long>(u->timestamp), newnick.c_str(), static_cast<long>(when)); } void SendConnect() diff --git a/src/channels.cpp b/src/channels.cpp index e303840e5..85752a774 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -134,10 +134,6 @@ void Channel::JoinUser(User *user) else user->SendMessage(MemoServ, MEMO_X_MANY_NOTICE, this->ci->memos.memos.size(), this->ci->name.c_str()); } - /* Added channelname to entrymsg - 30.03.2004, Certus */ - /* Also, don't send the entrymsg when bursting -GD */ - if (this->ci && !this->ci->entry_message.empty() && user->server->IsSynced()) - user->SendMessage(whosends(this->ci)->nick, "[%s] %s", this->name.c_str(), this->ci->entry_message.c_str()); } if (!Config->s_BotServ.empty() && this->ci && this->ci->bi) diff --git a/src/chanserv.cpp b/src/chanserv.cpp index c19bf8a30..a2307a082 100644 --- a/src/chanserv.cpp +++ b/src/chanserv.cpp @@ -169,8 +169,6 @@ void get_chanserv_stats(long *nrec, long *memuse) if (!ci->last_topic.empty()) mem += ci->last_topic.length() + 1; - if (!ci->entry_message.empty()) - mem += ci->entry_message.length() + 1; if (!ci->forbidby.empty()) mem += ci->forbidby.length() + 1; if (!ci->forbidreason.empty()) diff --git a/src/language.cpp b/src/language.cpp index 7554421f0..4ab89c567 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -858,10 +858,6 @@ const char *const language_strings[LANG_STRING_COUNT] = { _("%s cannot be the successor on channel %s because he is its founder."), /* CHAN_DESC_CHANGED */ _("Description of %s changed to %s."), - /* CHAN_ENTRY_MSG_CHANGED */ - _("Entry message for %s changed."), - /* CHAN_ENTRY_MSG_UNSET */ - _("Entry message for %s unset."), /* CHAN_SET_BANTYPE_INVALID */ _("%s is not a valid ban type."), /* CHAN_SET_BANTYPE_CHANGED */ @@ -1235,8 +1231,6 @@ const char *const language_strings[LANG_STRING_COUNT] = { _(" Successor: %s"), /* CHAN_INFO_DESCRIPTION */ _(" Description: %s"), - /* CHAN_INFO_ENTRYMSG */ - _(" Entry message: %s"), /* CHAN_INFO_TIME_REGGED */ _(" Registered: %s"), /* CHAN_INFO_LAST_USED */ @@ -1381,6 +1375,27 @@ const char *const language_strings[LANG_STRING_COUNT] = { _("%c%c%s has been unlocked from %s."), /* CHAN_MODE_LIST_FMT */ _("%c%c%s, by %s on %s"), + /* CHAN_ENTRYMSG_LIST_HEADER */ + _("Entry message list for \2%s\2:"), + /* CHAN_ENTRYMSG_LIST_ENTRY */ + _("%3d %s\n" + " Added by %s on %s"), + /* CHAN_ENTRYMSG_LIST_END */ + _("End of entry message list."), + /* CHAN_ENTRYMSG_LIST_EMPTY */ + _("Entry message list for \2%s\2 is empty."), + /* CHAN_ENTRYMSG_LIST_FULL */ + _("The entry message list for \2%s\2 is full."), + /* CHAN_ENTRYMSG_ADDED */ + _("Entry message added to \2%s\2"), + /* CHAN_ENTRYMSG_DELETED */ + _("Entry message \2%i\2 for \2%s\2 deleted."), + /* CHAN_ENTRYMSG_NOT_FOUND */ + _("Entry message \2%s\2 not found on channel \2%s\2."), + /* CHAN_ENTRYMSG_CLEARED */ + _("Entry messages for \2%s\2 have been cleared."), + /* CHAN_ENTRYMSG_SYNTAX */ + _("ENTRYMSG \037channel\037 {ADD|DEL|LIST|CLEAR} [\037message\037|\037num\037]"), /* MEMO_HAVE_NEW_MEMO */ _("You have 1 new memo."), /* MEMO_HAVE_NEW_MEMOS */ @@ -3355,6 +3370,8 @@ const char *const language_strings[LANG_STRING_COUNT] = { _(" CLONE Copy all settings from one channel to another"), /* CHAN_HELP_CMD_MODE */ _(" MODE Control modes and mode locks on a channel"), + /* CHAN_HELP_CMD_ENTRYMSG */ + _(" ENTRYMSG Manage the channel's entrymsgs"), /* CHAN_HELP */ _("%S allows you to register and control various\n" "aspects of channels. %S can often prevent\n" @@ -3413,9 +3430,6 @@ const char *const language_strings[LANG_STRING_COUNT] = { _(" SUCCESSOR Set the successor for a channel"), /* CHAN_HELP_CMD_SET_DESC */ _(" DESC Set the channel description"), - /* CHAN_HELP_CMD_SET_ENTRYMSG */ - _(" ENTRYMSG Set a message to be sent to users when they\n" - " enter the channel"), /* CHAN_HELP_CMD_SET_BANTYPE */ _(" BANTYPE Set how Services make bans on the channel"), /* CHAN_HELP_CMD_SET_KEEPTOPIC */ @@ -3470,12 +3484,6 @@ const char *const language_strings[LANG_STRING_COUNT] = { " \n" "Sets the description for the channel, which shows up with\n" "the LIST and INFO commands."), - /* CHAN_HELP_SET_ENTRYMSG */ - _("Syntax: %s channel ENTRYMSG [message]\n" - " \n" - "Sets the message which will be sent via /notice to users\n" - "when they enter the channel. If no parameter is given,\n" - "causes no message to be sent upon entering the channel."), /* CHAN_HELP_SET_BANTYPE */ _("Syntax: %s channel BANTYPE bantype\n" " \n" @@ -4099,6 +4107,10 @@ const char *const language_strings[LANG_STRING_COUNT] = { " \n" " \002MODE #channel SET -b ~c:*\n" " Clears all extended bans that start with ~c:"), + /* CHAN_HELP_ENTRYMSG */ + _("Syntax: \002ENTRYMSG \037channel\037 {ADD|DEL|LIST|CLEAR} [\037message\037|\037num\037]\002\n" + " \n" + "Controls what messages will be sent to users when they join the channel."), /* CHAN_SERVADMIN_HELP */ _(" \n" "Services Operators can also drop any channel without needing\n" |