summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/core/bs_set.cpp20
-rw-r--r--modules/core/os_config.cpp2
-rw-r--r--modules/extra/m_alias.cpp41
3 files changed, 48 insertions, 15 deletions
diff --git a/modules/core/bs_set.cpp b/modules/core/bs_set.cpp
index 8439ef9e7..b31a56316 100644
--- a/modules/core/bs_set.cpp
+++ b/modules/core/bs_set.cpp
@@ -46,12 +46,12 @@ class CommandBSSet : public Command
if (value.equals_ci("ON"))
{
bi->SetFlag(BI_PRIVATE);
- source.Reply(_("Private mode of bot %s is now \002\002."), bi->nick.c_str());
+ source.Reply(_("Private mode of bot %s is now \002on\002."), bi->nick.c_str());
}
else if (value.equals_ci("OFF"))
{
bi->UnsetFlag(BI_PRIVATE);
- source.Reply(_("Private mode of bot %s is now \002\002."), bi->nick.c_str());
+ source.Reply(_("Private mode of bot %s is now \002off\002."), bi->nick.c_str());
}
else
SyntaxError(source, "SET PRIVATE", _("SET \037botname\037 PRIVATE {\037ON|\037}"));
@@ -101,12 +101,12 @@ class CommandBSSet : public Command
if (value.equals_ci("ON"))
{
ci->botflags.SetFlag(BS_FANTASY);
- source.Reply(_("Fantasy mode is now \002\002 on channel %s."), ci->name.c_str());
+ source.Reply(_("Fantasy mode is now \002on\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
ci->botflags.UnsetFlag(BS_FANTASY);
- source.Reply(_("Fantasy mode is now \002\002 on channel %s."), ci->name.c_str());
+ source.Reply(_("Fantasy mode is now \002off\002 on channel %s."), ci->name.c_str());
}
else
SyntaxError(source, "SET FANTASY", _("SET \037channel\037 FANTASY {\037ON|\037}"));
@@ -116,12 +116,12 @@ class CommandBSSet : public Command
if (value.equals_ci("ON"))
{
ci->botflags.SetFlag(BS_GREET);
- source.Reply(_("Greet mode is now \002\002 on channel %s."), ci->name.c_str());
+ source.Reply(_("Greet mode is now \002on\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
ci->botflags.UnsetFlag(BS_GREET);
- source.Reply(_("Greet mode is now \002\002 on channel %s."), ci->name.c_str());
+ source.Reply(_("Greet mode is now \002off\002 on channel %s."), ci->name.c_str());
}
else
SyntaxError(source, "SET GREET", _("SET \037channel\037 GREET {\037ON|\037}"));
@@ -133,12 +133,12 @@ class CommandBSSet : public Command
ci->botflags.SetFlag(BS_NOBOT);
if (ci->bi)
ci->bi->UnAssign(u, ci);
- source.Reply(_("No Bot mode is now \002\002 on channel %s."), ci->name.c_str());
+ source.Reply(_("No Bot mode is now \002on\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
ci->botflags.UnsetFlag(BS_NOBOT);
- source.Reply(_("No Bot mode is now \002\002 on channel %s."), ci->name.c_str());
+ source.Reply(_("No Bot mode is now \002off\002 on channel %s."), ci->name.c_str());
}
else
SyntaxError(source, "SET NOBOT", _("SET \037botname\037 NOBOT {\037ON|\037}"));
@@ -148,12 +148,12 @@ class CommandBSSet : public Command
if (value.equals_ci("ON"))
{
ci->botflags.SetFlag(BS_SYMBIOSIS);
- source.Reply(_("Symbiosis mode is now \002\002 on channel %s."), ci->name.c_str());
+ source.Reply(_("Symbiosis mode is now \002on\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
ci->botflags.UnsetFlag(BS_SYMBIOSIS);
- source.Reply(_("Symbiosis mode is now \002\002 on channel %s."), ci->name.c_str());
+ source.Reply(_("Symbiosis mode is now \002off\002 on channel %s."), ci->name.c_str());
}
else
SyntaxError(source, "SET SYMBIOSIS", _("SET \037channel\037 SYMBIOSIS {\037ON|\037}"));
diff --git a/modules/core/os_config.cpp b/modules/core/os_config.cpp
index b7335527c..ce0bc0a56 100644
--- a/modules/core/os_config.cpp
+++ b/modules/core/os_config.cpp
@@ -160,7 +160,7 @@ class CommandOSConfig : public Command
/* Blocks we should show */
const Anope::string show_blocks[] = { "botserv", "chanserv", "defcon", "global", "memoserv", "nickserv", "networkinfo", "operserv", "options", "" };
- Log(LOG_ADMIN, source.u, this);
+ Log(LOG_ADMIN, source.u, this) << "VIEW";
for (ConfigDataHash::const_iterator it = Config->config_data.begin(), it_end = Config->config_data.end(); it != it_end; ++it)
{
diff --git a/modules/extra/m_alias.cpp b/modules/extra/m_alias.cpp
index a145e3c50..c5f52bef2 100644
--- a/modules/extra/m_alias.cpp
+++ b/modules/extra/m_alias.cpp
@@ -23,8 +23,8 @@ class ModuleAlias : public Module
public:
ModuleAlias(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator)
{
- Implementation i[] = { I_OnReload, I_OnPreCommandRun };
- ModuleManager::Attach(i, this, 2);
+ Implementation i[] = { I_OnReload, I_OnPreCommandRun, I_OnBotFantasy };
+ ModuleManager::Attach(i, this, 3);
OnReload(false);
}
@@ -69,11 +69,13 @@ class ModuleAlias : public Module
{
const CommandAlias &alias = it->second;
- if (!fantasy && !bi->nick.equals_ci(alias.source_client))
+ if (!u->HasMode(UMODE_OPER) && alias.operonly)
continue;
else if (fantasy != alias.fantasy)
continue;
- else if (!u->HasMode(UMODE_OPER) && alias.operonly)
+ else if (fantasy && alias.fantasy) // OnBotFantasy gets this!
+ return EVENT_STOP;
+ else if (!bi->nick.equals_ci(alias.source_client))
continue;
BotInfo *target = findbot(alias.target_client);
@@ -85,6 +87,37 @@ class ModuleAlias : public Module
return EVENT_CONTINUE;
}
+
+ void OnBotFantasy(const Anope::string &command, User *u, ChannelInfo *ci, const Anope::string &params)
+ {
+ std::multimap<Anope::string, CommandAlias, std::less<ci::string> >::const_iterator it = aliases.find(command), it_end = it;
+ if (it_end != aliases.end())
+ it_end = aliases.upper_bound(command);
+ for (; it != it_end; ++it)
+ {
+ const CommandAlias &alias = it->second;
+
+ if (!u->HasMode(UMODE_OPER) && alias.operonly)
+ continue;
+
+ BotInfo *target = findbot(alias.target_client);
+ if (!target)
+ target = ChanServ;
+
+ Anope::string full_message = alias.target_command;
+ if (target == ChanServ || target == BotServ)
+ {
+ Command *target_c = FindCommand(target, alias.target_command);
+ if (target_c && !target_c->HasFlag(CFLAG_STRIP_CHANNEL))
+ full_message += " " + ci->name;
+ }
+ if (!params.empty())
+ full_message += + " " + params;
+
+ mod_run_cmd(target, u, ci, full_message);
+ break;
+ }
+ }
};
MODULE_INIT(ModuleAlias)