summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/commands.example.conf156
-rw-r--r--data/example.conf20
-rw-r--r--include/bots.h15
-rw-r--r--include/commands.h17
-rw-r--r--include/config.h4
-rw-r--r--include/services.h1
-rw-r--r--modules/core/bs_bot.cpp6
-rw-r--r--modules/core/cs_list.cpp6
-rw-r--r--modules/core/cs_saset.cpp10
-rw-r--r--modules/core/cs_saset_noexpire.cpp4
-rw-r--r--modules/core/cs_set.cpp8
-rw-r--r--modules/core/cs_set_bantype.cpp6
-rw-r--r--modules/core/cs_set_description.cpp6
-rw-r--r--modules/core/cs_set_founder.cpp10
-rw-r--r--modules/core/cs_set_keeptopic.cpp6
-rw-r--r--modules/core/cs_set_opnotice.cpp6
-rw-r--r--modules/core/cs_set_peace.cpp6
-rw-r--r--modules/core/cs_set_persist.cpp6
-rw-r--r--modules/core/cs_set_private.cpp6
-rw-r--r--modules/core/cs_set_restricted.cpp6
-rw-r--r--modules/core/cs_set_secure.cpp6
-rw-r--r--modules/core/cs_set_securefounder.cpp6
-rw-r--r--modules/core/cs_set_secureops.cpp6
-rw-r--r--modules/core/cs_set_signkick.cpp6
-rw-r--r--modules/core/cs_set_successor.cpp10
-rw-r--r--modules/core/cs_set_topiclock.cpp6
-rw-r--r--modules/core/cs_suspend.cpp4
-rw-r--r--modules/core/db_mysql.cpp2
-rw-r--r--modules/core/gl_global.cpp2
-rw-r--r--modules/core/help.cpp40
-rw-r--r--modules/core/hs_del.cpp4
-rw-r--r--modules/core/hs_list.cpp2
-rw-r--r--modules/core/hs_set.cpp4
-rw-r--r--modules/core/ms_sendall.cpp2
-rw-r--r--modules/core/ms_staff.cpp2
-rw-r--r--modules/core/ns_getemail.cpp2
-rw-r--r--modules/core/ns_getpass.cpp2
-rw-r--r--modules/core/ns_list.cpp6
-rw-r--r--modules/core/ns_saset.cpp15
-rw-r--r--modules/core/ns_saset_noexpire.cpp2
-rw-r--r--modules/core/ns_set.cpp11
-rw-r--r--modules/core/ns_set_autoop.cpp4
-rw-r--r--modules/core/ns_set_email.cpp4
-rw-r--r--modules/core/ns_set_greet.cpp4
-rw-r--r--modules/core/ns_set_hide.cpp4
-rw-r--r--modules/core/ns_set_kill.cpp4
-rw-r--r--modules/core/ns_set_language.cpp4
-rw-r--r--modules/core/ns_set_message.cpp4
-rw-r--r--modules/core/ns_set_private.cpp4
-rw-r--r--modules/core/ns_set_secure.cpp4
-rw-r--r--modules/core/ns_suspend.cpp4
-rw-r--r--modules/core/os_akill.cpp2
-rw-r--r--modules/core/os_chankill.cpp2
-rw-r--r--modules/core/os_config.cpp2
-rw-r--r--modules/core/os_forbid.cpp2
-rw-r--r--modules/core/os_ignore.cpp2
-rw-r--r--modules/core/os_jupe.cpp2
-rw-r--r--modules/core/os_kick.cpp2
-rw-r--r--modules/core/os_kill.cpp2
-rw-r--r--modules/core/os_mode.cpp4
-rw-r--r--modules/core/os_modinfo.cpp10
-rw-r--r--modules/core/os_module.cpp6
-rw-r--r--modules/core/os_news.cpp2
-rw-r--r--modules/core/os_noop.cpp2
-rw-r--r--modules/core/os_oline.cpp2
-rw-r--r--modules/core/os_oper.cpp2
-rw-r--r--modules/core/os_reload.cpp2
-rw-r--r--modules/core/os_session.cpp2
-rw-r--r--modules/core/os_set.cpp2
-rw-r--r--modules/core/os_shutdown.cpp6
-rw-r--r--modules/core/os_stats.cpp2
-rw-r--r--modules/core/os_svsnick.cpp2
-rw-r--r--modules/core/os_sxline.cpp8
-rw-r--r--modules/core/os_update.cpp2
-rw-r--r--modules/extra/cs_set_misc.cpp4
-rw-r--r--modules/extra/hs_request.cpp6
-rw-r--r--modules/extra/m_async_commands.cpp2
-rw-r--r--modules/extra/ns_set_misc.cpp4
-rw-r--r--modules/extra/os_defcon.cpp2
-rw-r--r--src/bots.cpp35
-rw-r--r--src/command.cpp7
-rw-r--r--src/config.cpp11
82 files changed, 329 insertions, 297 deletions
diff --git a/data/commands.example.conf b/data/commands.example.conf
index 03a5b01f6..6290dae6e 100644
--- a/data/commands.example.conf
+++ b/data/commands.example.conf
@@ -5,6 +5,8 @@
* In Anope modules can provide (multiple) commands, each of which has a unique command name. Once these modules
* are loaded you can then configure the commands to be added to any client you like with any name you like.
*
+ * Additionally, you may provide a permission name that must be in the opertype of users executing the command.
+ *
* Sane defaults are below.
*/
@@ -62,7 +64,7 @@ module { name = "cs_kick" }
command { service = "ChanServ"; name = "KICK"; command = "chanserv/kick"; }
command { service = "ChanServ"; name = "K"; command = "chanserv/kick"; }
module { name = "cs_list" }
-command { service = "ChanServ"; name = "LIST"; command = "chanserv/list"; }
+command { service = "ChanServ"; name = "LIST"; command = "chanserv/list"; permission = "chanserv/list"; }
module { name = "cs_mode" }
command { service = "ChanServ"; name = "MODE"; command = "chanserv/mode"; }
module { name = "cs_modes" }
@@ -81,59 +83,59 @@ command { service = "ChanServ"; name = "REGISTER"; command = "chanserv/register"
module { name = "cs_set" }
command { service = "ChanServ"; name = "SET"; command = "chanserv/set"; }
module { name = "cs_saset" }
-command { service = "ChanServ"; name = "SASET"; command = "chanserv/saset"; }
+command { service = "ChanServ"; name = "SASET"; command = "chanserv/saset"; permission = "chanserv/saset"; }
module { name = "cs_set_bantype" }
command { service = "ChanServ"; name = "SET BANTYPE"; command = "chanserv/set/bantype"; }
-command { service = "ChanServ"; name = "SASET BANTYPE"; command = "chanserv/saset/bantype"; }
+command { service = "ChanServ"; name = "SASET BANTYPE"; command = "chanserv/saset/bantype"; permission = "chanserv/saset/bantype"; }
module { name = "cs_set_description" }
command { service = "ChanServ"; name = "SET DESCRIPTION"; command = "chanserv/set/description"; }
command { service = "ChanServ"; name = "SET DESC"; command = "chanserv/set/description"; }
-command { service = "ChanServ"; name = "SASET DESCRIPTION"; command = "chanserv/saset/description"; }
-command { service = "ChanServ"; name = "SASET DESC"; command = "chanserv/saset/description"; }
+command { service = "ChanServ"; name = "SASET DESCRIPTION"; command = "chanserv/saset/description"; permission = "chanserv/saset/description"; }
+command { service = "ChanServ"; name = "SASET DESC"; command = "chanserv/saset/description"; permission = "chanserv/saset/desc"; }
module { name = "cs_set_founder" }
command { service = "ChanServ"; name = "SET FOUNDER"; command = "chanserv/set/founder"; }
-command { service = "ChanServ"; name = "SASET FOUNDER"; command = "chanserv/saset/founder"; }
+command { service = "ChanServ"; name = "SASET FOUNDER"; command = "chanserv/saset/founder"; permission = "chanserv/saset/founder"; }
module { name = "cs_set_keeptopic" }
command { service = "ChanServ"; name = "SET KEEPTOPIC"; command = "chanserv/set/keeptopic"; }
-command { service = "ChanServ"; name = "SASET KEEPTOPIC"; command = "chanserv/saset/keeptopic"; }
+command { service = "ChanServ"; name = "SASET KEEPTOPIC"; command = "chanserv/saset/keeptopic"; permission = "chanserv/saset/keeptopic"; }
module { name = "cs_set_opnotice" }
command { service = "ChanServ"; name = "SET OPNOTICE"; command = "chanserv/set/opnotice"; }
-command { service = "ChanServ"; name = "SASET OPNOTICE"; command = "chanserv/saset/opnotice"; }
+command { service = "ChanServ"; name = "SASET OPNOTICE"; command = "chanserv/saset/opnotice"; permission = "chanserv/saset/optnotice"; }
module { name = "cs_set_peace" }
command { service = "ChanServ"; name = "SET PEACE"; command = "chanserv/set/peace"; }
-command { service = "ChanServ"; name = "SASET PEACE"; command = "chanserv/saset/peace"; }
+command { service = "ChanServ"; name = "SASET PEACE"; command = "chanserv/saset/peace"; permission = "chanserv/saset/peace"; }
module { name = "cs_set_persist" }
command { service = "ChanServ"; name = "SET PERSIST"; command = "chanserv/set/persist"; }
-command { service = "ChanServ"; name = "SASET PERSIST"; command = "chanserv/saset/persist"; }
+command { service = "ChanServ"; name = "SASET PERSIST"; command = "chanserv/saset/persist"; permission = "chanserv/saset/persist"; }
module { name = "cs_set_private" }
command { service = "ChanServ"; name = "SET PRIVATE"; command = "chanserv/set/private"; }
-command { service = "ChanServ"; name = "SASET PRIVATE"; command = "chanserv/saset/private"; }
+command { service = "ChanServ"; name = "SASET PRIVATE"; command = "chanserv/saset/private"; permission = "chanserv/saset/private"; }
module { name = "cs_set_restricted" }
command { service = "ChanServ"; name = "SET RESTRICTED"; command = "chanserv/set/restricted"; }
-command { service = "ChanServ"; name = "SASET RESTRICTED"; command = "chanserv/saset/restricted"; }
+command { service = "ChanServ"; name = "SASET RESTRICTED"; command = "chanserv/saset/restricted"; permission = "chanserv/saset/restricted"; }
module { name = "cs_set_secure" }
command { service = "ChanServ"; name = "SET SECURE"; command = "chanserv/set/secure"; }
-command { service = "ChanServ"; name = "SASET SECURE"; command = "chanserv/saset/secure"; }
+command { service = "ChanServ"; name = "SASET SECURE"; command = "chanserv/saset/secure"; permission = "chanserv/saset/secure"; }
module { name = "cs_set_securefounder" }
command { service = "ChanServ"; name = "SET SECUREFOUNDER"; command = "chanserv/set/securefounder"; }
-command { service = "ChanServ"; name = "SASET SECUREFOUNDER"; command = "chanserv/saset/securefounder"; }
+command { service = "ChanServ"; name = "SASET SECUREFOUNDER"; command = "chanserv/saset/securefounder"; permission = "chanserv/saset/securefounder"; }
module { name = "cs_set_secureops" }
command { service = "ChanServ"; name = "SET SECUREOPS"; command = "chanserv/set/secureops"; }
-command { service = "ChanServ"; name = "SASET SECUREOPS"; command = "chanserv/saset/secureops"; }
+command { service = "ChanServ"; name = "SASET SECUREOPS"; command = "chanserv/saset/secureops"; permission = "chanserv/saset/secureops"; }
module { name = "cs_set_signkick" }
command { service = "ChanServ"; name = "SET SIGNKICK"; command = "chanserv/set/signkick"; }
-command { service = "ChanServ"; name = "SASET SIGNKICK"; command = "chanserv/saset/signkick"; }
+command { service = "ChanServ"; name = "SASET SIGNKICK"; command = "chanserv/saset/signkick"; permission = "chanserv/saset/signkick"; }
module { name = "cs_set_successor" }
command { service = "ChanServ"; name = "SET SUCCESSOR"; command = "chanserv/set/successor"; }
-command { service = "ChanServ"; name = "SASET SUCCESSOR"; command = "chanserv/saset/successor"; }
+command { service = "ChanServ"; name = "SASET SUCCESSOR"; command = "chanserv/saset/successor"; permission = "chanserv/saset/successor"; }
module { name = "cs_set_topiclock" }
command { service = "ChanServ"; name = "SET TOPICLOCK"; command = "chanserv/set/topiclock"; }
-command { service = "ChanServ"; name = "SASET TOPICLOCK"; command = "chanserv/saset/topiclock"; }
+command { service = "ChanServ"; name = "SASET TOPICLOCK"; command = "chanserv/saset/topiclock"; permission = "chanserv/saset/topiclock"; }
module { name = "cs_saset_noexpire" }
-command { service = "ChanServ"; name = "SASET NOEXPIRE"; command = "chanserv/saset/noexpire"; }
+command { service = "ChanServ"; name = "SASET NOEXPIRE"; command = "chanserv/saset/noexpire"; permission = "chanserv/saset/noexpire"; }
module { name = "cs_suspend" }
-command { service = "ChanServ"; name = "SUSPEND"; command = "chanserv/suspend"; }
-command { service = "ChanServ"; name = "UNSUSPEND"; command = "chanserv/unsuspend"; }
+command { service = "ChanServ"; name = "SUSPEND"; command = "chanserv/suspend"; permission = "chanserv/suspend"; }
+command { service = "ChanServ"; name = "UNSUSPEND"; command = "chanserv/unsuspend"; permission = "chanserv/suspend"; }
module { name = "cs_topic" }
command { service = "ChanServ"; name = "TOPIC"; command = "chanserv/topic"; }
module { name = "cs_unban" }
@@ -146,22 +148,22 @@ command { service = "ChanServ"; name = "HOP"; command = "chanserv/hop"; }
command { service = "ChanServ"; name = "VOP"; command = "chanserv/vop"; }
module { name = "gl_global" }
-command { service = "Global"; name = "GLOBAL"; command = "global/global"; }
+command { service = "Global"; name = "GLOBAL"; command = "global/global"; permission = "global/global"; }
module { name = "hs_del" }
-command { service = "HostServ"; name = "DEL"; command = "hostserv/del"; }
-command { service = "HostServ"; name = "DELALL"; command = "hostserv/delall"; }
+command { service = "HostServ"; name = "DEL"; command = "hostserv/del"; permission = "hostserv/del"; }
+command { service = "HostServ"; name = "DELALL"; command = "hostserv/delall"; permission = "hostserv/del"; }
module { name = "hs_group" }
command { service = "HostServ"; name = "GROUP"; command = "hostserv/group"; }
module { name = "hs_list" }
-command { service = "HostServ"; name = "LIST"; command = "hostserv/list"; }
+command { service = "HostServ"; name = "LIST"; command = "hostserv/list"; permission = "hostserv/list"; }
module { name = "hs_off" }
command { service = "HostServ"; name = "OFF"; command = "hostserv/off"; }
module { name = "hs_on" }
command { service = "HostServ"; name = "ON"; command = "hostserv/on"; }
module { name = "hs_set" }
-command { service = "HostServ"; name = "SET"; command = "hostserv/set"; }
-command { service = "HostServ"; name = "SETALL"; command = "hostserv/setall"; }
+command { service = "HostServ"; name = "SET"; command = "hostserv/set"; permission = "hostserv/set"; }
+command { service = "HostServ"; name = "SETALL"; command = "hostserv/setall"; permission = "hostserv/set"; }
module { name = "ms_cancel" }
command { service = "MemoServ"; name = "CANCEL"; command = "memoserv/cancel"; }
@@ -182,11 +184,11 @@ command { service = "MemoServ"; name = "RSEND"; command = "memoserv/rsend"; }
module { name = "ms_send" }
command { service = "MemoServ"; name = "SEND"; command = "memoserv/send"; }
module { name = "ms_sendall" }
-command { service = "MemoServ"; name = "SENDALL"; command = "memoserv/sendall"; }
+command { service = "MemoServ"; name = "SENDALL"; command = "memoserv/sendall"; permission = "memoserv/sendall"; }
module { name = "ms_set" }
command { service = "MemoServ"; name = "SET"; command = "memoserv/set"; }
module { name = "ms_staff" }
-command { service = "MemoServ"; name = "STAFF"; command = "memoserv/staff"; }
+command { service = "MemoServ"; name = "STAFF"; command = "memoserv/staff"; permission = "memoserv/staff"; }
module { name = "ns_access" }
command { service = "NickServ"; name = "ACCESS"; command = "nickserv/access"; }
@@ -199,9 +201,9 @@ command { service = "NickServ"; name = "CERT"; command = "nickserv/cert"; }
module { name = "ns_drop" }
command { service = "NickServ"; name = "DROP"; command = "nickserv/drop"; }
module { name = "ns_getemail" }
-command { service = "NickServ"; name = "GETEMAIL"; command = "nickserv/getemail"; }
+command { service = "NickServ"; name = "GETEMAIL"; command = "nickserv/getemail"; permission = "nickserv/getemail"; }
module { name = "ns_getpass" }
-command { service = "NickServ"; name = "GETPASS"; command = "nickserv/getpass"; }
+command { service = "NickServ"; name = "GETPASS"; command = "nickserv/getpass"; permission = "nickserv/getpass"; }
module { name = "ns_ghost" }
command { service = "NickServ"; name = "GHOST"; command = "nickserv/ghost"; }
module { name = "ns_group" }
@@ -237,103 +239,103 @@ command { service = "NickServ"; name = "SET DISPLAY"; command = "nickserv/set/di
command { service = "NickServ"; name = "SET PASSWORD"; command = "nickserv/set/password"; }
module { name = "ns_set_autoop" }
command { service = "NickServ"; name = "SET AUTOOP"; command = "nickserv/set/autoop"; }
-command { service = "NickServ"; name = "SASET AUTOOP"; command = "nickserv/saset/autoop"; }
+command { service = "NickServ"; name = "SASET AUTOOP"; command = "nickserv/saset/autoop"; permission = "nickserv/saset/autoop"; }
module { name = "ns_set_email" }
command { service = "NickServ"; name = "SET EMAIL"; command = "nickserv/set/email"; }
-command { service = "NickServ"; name = "SASET EMAIL"; command = "nickserv/saset/email"; }
+command { service = "NickServ"; name = "SASET EMAIL"; command = "nickserv/saset/email"; permission = "nickserv/saset/email"; }
module { name = "ns_set_greet" }
command { service = "NickServ"; name = "SET GREET"; command = "nickserv/set/greet"; }
-command { service = "NickServ"; name = "SASET GREET"; command = "nickserv/saset/greet"; }
+command { service = "NickServ"; name = "SASET GREET"; command = "nickserv/saset/greet"; permission = "nickserv/saset/greet"; }
module { name = "ns_set_hide" }
command { service = "NickServ"; name = "SET HIDE"; command = "nickserv/set/hide"; }
-command { service = "NickServ"; name = "SASET HIDE"; command = "nickserv/saset/hide"; }
+command { service = "NickServ"; name = "SASET HIDE"; command = "nickserv/saset/hide"; permission = "nickserv/saset/hide"; }
module { name = "ns_set_kill" }
command { service = "NickServ"; name = "SET KILL"; command = "nickserv/set/kill"; }
-command { service = "NickServ"; name = "SASET KILL"; command = "nickserv/saset/kill"; }
+command { service = "NickServ"; name = "SASET KILL"; command = "nickserv/saset/kill"; permission = "nickserv/saset/kill"; }
module { name = "ns_set_language" }
command { service = "NickServ"; name = "SET LANGUAGE"; command = "nickserv/set/language"; }
-command { service = "NickServ"; name = "SASET LANGUAGE"; command = "nickserv/saset/language"; }
+command { service = "NickServ"; name = "SASET LANGUAGE"; command = "nickserv/saset/language"; permission = "nickserv/saset/language"; }
module { name = "ns_set_message" }
command { service = "NickServ"; name = "SET MESSAGE"; command = "nickserv/set/message"; }
-command { service = "NickServ"; name = "SASET MESSAGE"; command = "nickserv/saset/message"; }
+command { service = "NickServ"; name = "SASET MESSAGE"; command = "nickserv/saset/message"; permission = "nickserv/saset/message"; }
module { name = "ns_set_private" }
command { service = "NickServ"; name = "SET PRIVATE"; command = "nickserv/set/private"; }
-command { service = "NickServ"; name = "SASET PRIVATE"; command = "nickserv/saset/private"; }
+command { service = "NickServ"; name = "SASET PRIVATE"; command = "nickserv/saset/private"; permission = "nickserv/saset/private"; }
module { name = "ns_set_secure" }
command { service = "NickServ"; name = "SET SECURE"; command = "nickserv/set/secure"; }
-command { service = "NickServ"; name = "SASET SECURE"; command = "nickserv/saset/secure"; }
+command { service = "NickServ"; name = "SASET SECURE"; command = "nickserv/saset/secure"; permission = "nickserv/saset/secure"; }
module { name = "ns_saset_noexpire" }
-command { service = "NickServ"; name = "SASET NOEXPIRE"; command = "nickserv/saset/noexpire"; }
+command { service = "NickServ"; name = "SASET NOEXPIRE"; command = "nickserv/saset/noexpire"; permission = "nickserv/saset/noexpire" }
module { name = "ns_sendpass" }
-command { service = "NickServ"; name = "SENDPASS"; command = "nickserv/sendpass"; }
+command { service = "NickServ"; name = "SENDPASS"; command = "nickserv/sendpass"; permission = "nickserv/sendpass"; }
module { name = "ns_status" }
command { service = "NickServ"; name = "STATUS"; command = "nickserv/status"; }
module { name = "ns_suspend" }
-command { service = "NickServ"; name = "SUSPEND"; command = "nickserv/suspend"; }
-command { service = "NickServ"; name = "UNSUSPEND"; command = "nickserv/unsuspend"; }
+command { service = "NickServ"; name = "SUSPEND"; command = "nickserv/suspend"; permission = "nickserv/suspend"; }
+command { service = "NickServ"; name = "UNSUSPEND"; command = "nickserv/unsuspend"; permission = "nickserv/suspend"; }
module { name = "ns_update" }
command { service = "NickServ"; name = "UPDATE"; command = "nickserv/update"; }
module { name = "os_akill" }
-command { service = "OperServ"; name = "AKILL"; command = "operserv/akill"; }
+command { service = "OperServ"; name = "AKILL"; command = "operserv/akill"; permission = "operserv/akill"; }
module { name = "os_chankill" }
-command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"; }
+command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"; permission = "operserv/chankill"; }
module { name = "os_list" }
command { service = "OperServ"; name = "CHANLIST"; command = "operserv/chanlist"; }
command { service = "OperServ"; name = "USERLIST"; command = "operserv/userlist"; }
module { name = "os_config" }
-command { service = "OperServ"; name = "CONFIG"; command = "operserv/config"; }
+command { service = "OperServ"; name = "CONFIG"; command = "operserv/config"; permission = "operserv/config"; }
module { name = "os_forbid" }
-command { service = "OperServ"; name = "FORBID"; command = "operserv/forbid"; }
+command { service = "OperServ"; name = "FORBID"; command = "operserv/forbid"; permission = "operserv/forbid"; }
module { name = "os_ignore" }
-command { service = "OperServ"; name = "IGNORE"; command = "operserv/ignore"; }
+command { service = "OperServ"; name = "IGNORE"; command = "operserv/ignore"; permission = "operserv/ignore"; }
module { name = "os_jupe" }
-command { service = "OperServ"; name = "JUPE"; command = "operserv/jupe"; }
+command { service = "OperServ"; name = "JUPE"; command = "operserv/jupe"; permission = "operserv/jupe"; }
module { name = "os_kick" }
-command { service = "OperServ"; name = "KICK"; command = "operserv/kick"; }
+command { service = "OperServ"; name = "KICK"; command = "operserv/kick"; permission = "operserv/kick"; }
module { name = "os_kill" }
-command { service = "OperServ"; name = "KILL"; command = "operserv/kill"; }
+command { service = "OperServ"; name = "KILL"; command = "operserv/kill"; permission = "operserv/kill"; }
module { name = "os_login" }
command { service = "OperServ"; name = "LOGIN"; command = "operserv/login"; }
module { name = "os_mode" }
-command { service = "OperServ"; name = "MODE"; command = "operserv/mode"; }
-command { service = "OperServ"; name = "UMODE"; command = "operserv/umode"; }
+command { service = "OperServ"; name = "MODE"; command = "operserv/mode"; permission = "operserv/mode"; }
+command { service = "OperServ"; name = "UMODE"; command = "operserv/umode"; permission = "operserv/umode"; }
module { name = "os_modinfo" }
command { service = "OperServ"; name = "MODINFO"; command = "operserv/modinfo"; }
-command { service = "OperServ"; name = "MODLIST"; command = "operserv/modlist"; }
+command { service = "OperServ"; name = "MODLIST"; command = "operserv/modlist"; permission = "operserv/modlist"; }
module { name = "os_module" }
-command { service = "OperServ"; name = "MODLOAD"; command = "operserv/modload"; }
-command { service = "OperServ"; name = "MODRELOAD"; command = "operserv/modreload"; }
-command { service = "OperServ"; name = "MODUNLOAD"; command = "operserv/modunload"; }
+command { service = "OperServ"; name = "MODLOAD"; command = "operserv/modload"; permission = "operserv/modload"; }
+command { service = "OperServ"; name = "MODRELOAD"; command = "operserv/modreload"; permission = "operserv/modload"; }
+command { service = "OperServ"; name = "MODUNLOAD"; command = "operserv/modunload"; permission = "operserv/modload"; }
module { name = "os_news" }
-command { service = "OperServ"; name = "LOGONNEWS"; command = "operserv/logonnews"; }
-command { service = "OperServ"; name = "OPERNEWS"; command = "operserv/opernews"; }
-command { service = "OperServ"; name = "RANDOMNEWS"; command = "operserv/randomnews"; }
+command { service = "OperServ"; name = "LOGONNEWS"; command = "operserv/logonnews"; permission = "operserv/news"; }
+command { service = "OperServ"; name = "OPERNEWS"; command = "operserv/opernews"; permission = "operserv/news"; }
+command { service = "OperServ"; name = "RANDOMNEWS"; command = "operserv/randomnews"; permission = "operserv/news"; }
module { name = "os_noop" }
-command { service = "OperServ"; name = "NOOP"; command = "operserv/noop"; }
+command { service = "OperServ"; name = "NOOP"; command = "operserv/noop"; permission = "operserv/noop"; }
module { name = "os_oline" }
-command { service = "OperServ"; name = "OLINE"; command = "operserv/oline"; }
+command { service = "OperServ"; name = "OLINE"; command = "operserv/oline"; permission = "operserv/oline"; }
module { name = "os_oper" }
-command { service = "OperServ"; name = "OPER"; command = "operserv/oper"; }
+command { service = "OperServ"; name = "OPER"; command = "operserv/oper"; permission = "operserv/oper"; }
module { name = "os_reload" }
-command { service = "OperServ"; name = "RELOAD"; command = "operserv/reload"; }
+command { service = "OperServ"; name = "RELOAD"; command = "operserv/reload"; permission = "operserv/reload"; }
module { name = "os_session" }
-command { service = "OperServ"; name = "EXCEPTION"; command = "operserv/exception"; }
-command { service = "OperServ"; name = "SESSION"; command = "operserv/session"; }
+command { service = "OperServ"; name = "EXCEPTION"; command = "operserv/exception"; permission = "operserv/exception"; }
+command { service = "OperServ"; name = "SESSION"; command = "operserv/session"; permission = "operserv/session"; }
module { name = "os_set" }
-command { service = "OperServ"; name = "SET"; command = "operserv/set"; }
+command { service = "OperServ"; name = "SET"; command = "operserv/set"; permission = "operserv/set"; }
module { name = "os_shutdown" }
-command { service = "OperServ"; name = "QUIT"; command = "operserv/quit"; }
-command { service = "OperServ"; name = "RESTART"; command = "operserv/restart"; }
-command { service = "OperServ"; name = "SHUTDOWN"; command = "operserv/shutdown"; }
+command { service = "OperServ"; name = "QUIT"; command = "operserv/quit"; permission = "operserv/quit"; }
+command { service = "OperServ"; name = "RESTART"; command = "operserv/restart"; permission = "operserv/restart"; }
+command { service = "OperServ"; name = "SHUTDOWN"; command = "operserv/shutdown"; permission = "operserv/shutdown"; }
module { name = "os_stats" }
-command { service = "OperServ"; name = "STATS"; command = "operserv/stats"; }
+command { service = "OperServ"; name = "STATS"; command = "operserv/stats"; permission = "operserv/stats"; }
module { name = "os_svsnick" }
-command { service = "OperServ"; name = "SVSNICK"; command = "operserv/svsnick"; }
+command { service = "OperServ"; name = "SVSNICK"; command = "operserv/svsnick"; permission = "operserv/svsnick"; }
module { name = "os_sxline" }
-command { service = "OperServ"; name = "SNLINE"; command = "operserv/snline"; }
-command { service = "OperServ"; name = "SQLINE"; command = "operserv/sqline"; }
-command { service = "OperServ"; name = "SZLINE"; command = "operserv/szline"; }
+command { service = "OperServ"; name = "SNLINE"; command = "operserv/snline"; permission = "operserv/snline"; }
+command { service = "OperServ"; name = "SQLINE"; command = "operserv/sqline"; permission = "operserv/sqline"; }
+command { service = "OperServ"; name = "SZLINE"; command = "operserv/szline"; permission = "operserv/szline"; }
module { name = "os_update" }
-command { service = "OperServ"; name = "UPDATE"; command = "operserv/update"; }
+command { service = "OperServ"; name = "UPDATE"; command = "operserv/update"; permission = "operserv/update"; }
diff --git a/data/example.conf b/data/example.conf
index 5f2956681..14065ddf4 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -720,13 +720,6 @@ chanserv
inhabit = 15s
/*
- * Limits the use of the ChanServ LIST command to IRC operators.
- *
- * This directive is optional.
- */
- #listopersonly = yes
-
- /*
* The maximum number of channels to be returned for a ChanServ LIST command.
*/
listmax = 50
@@ -1059,13 +1052,6 @@ nickserv
#nogroupchange = yes
/*
- * Limits the use of the NickServ LIST command to IRC operators.
- *
- * This directive is optional.
- */
- #listopersonly = yes
-
- /*
* The maximum number of nicks to be returned for a NickServ LIST command.
*/
listmax = 50
@@ -1375,7 +1361,9 @@ log
* This block is recommended, as without it you will be unable to access most oper commands.
* It replaces the old ServicesRoot directive amongst others.
*
- * Note that third party modules may add additional commands and privileges to this list.
+ * The command names below are defaults and are configured in commands.conf. If you configure
+ * additional commands with permissions, such as commands from third party modules, the permissions
+ * must be included in the opertype block before the command can be used.
*
* Available privileges:
* botserv/administration - Can perform certain BotServ administrative tasks
@@ -1418,7 +1406,7 @@ log
*
* global/global
*
- * operserv/news operserv/stats operserv/kick
+ * operserv/news operserv/stats operserv/kick operserv/exception
* operserv/mode operserv/session operserv/modlist operserv/ignore
* operserv/chankill operserv/akill operserv/sqline operserv/snline
* operserv/szline operserv/oper operserv/config operserv/umode
diff --git a/include/bots.h b/include/bots.h
index 7508e4091..446287abf 100644
--- a/include/bots.h
+++ b/include/bots.h
@@ -13,7 +13,6 @@ class BotInfo;
extern CoreExport Anope::insensitive_map<BotInfo *> BotListByNick;
extern CoreExport Anope::map<BotInfo *> BotListByUID;
typedef Anope::insensitive_map<BotInfo *> botinfo_map;
-typedef Anope::insensitive_map<Anope::string> command_map;
/** Flags settable on a bot
*/
@@ -39,6 +38,7 @@ class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>
uint32 chancount;
time_t created; /* Birth date ;) */
time_t lastmsg; /* Last time we said something */
+ typedef Anope::insensitive_map<CommandInfo> command_map;
command_map commands; /* Commands, actual name to service name */
/** Create a new bot.
@@ -100,6 +100,19 @@ class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>
* @param message The users' message
*/
virtual void OnMessage(User *u, const Anope::string &message);
+
+ /** Link a command name to a command in services
+ * @param cname The command name
+ * @param sname The service name
+ * @param permission Permission required to execute the command, if any
+ */
+ void SetCommand(const Anope::string &cname, const Anope::string &sname, const Anope::string &permission = "");
+
+ /** Get command info for a command
+ * @param cname The command name
+ * @return A struct containing service name and permission
+ */
+ CommandInfo *GetCommand(const Anope::string &cname);
};
#endif // BOTS_H
diff --git a/include/commands.h b/include/commands.h
index 0ee9af226..227483f63 100644
--- a/include/commands.h
+++ b/include/commands.h
@@ -30,6 +30,12 @@ const Anope::string CommandFlagStrings[] = {
""
};
+struct CommandInfo
+{
+ Anope::string name;
+ Anope::string permission;
+};
+
/* The source for a command */
struct CoreExport CommandSource
{
@@ -43,6 +49,8 @@ struct CoreExport CommandSource
BotInfo *service;
/* The actual name of the command being executed */
Anope::string command;
+ /* The permission of the command being executed */
+ Anope::string permission;
std::list<Anope::string> reply;
@@ -64,8 +72,6 @@ class CoreExport Command : public Service, public Flags<CommandFlag>
size_t MaxParams;
/* Minimum parameters required to use this command */
size_t MinParams;
- /* Permission needed to use this comand */
- Anope::string permission;
/* Module which owns us */
Module *module;
@@ -77,7 +83,7 @@ class CoreExport Command : public Service, public Flags<CommandFlag>
* @param max_params The maximum number of parameters the parser will create, after max_params, all will be combined into the last argument.
* NOTE: If max_params is not set (default), there is no limit to the max number of params.
*/
- Command(Module *owner, const Anope::string &sname, size_t min_params, size_t max_params = 0, const Anope::string &spermission = "");
+ Command(Module *owner, const Anope::string &sname, size_t min_params, size_t max_params = 0);
virtual ~Command();
@@ -117,11 +123,6 @@ class CoreExport Command : public Service, public Flags<CommandFlag>
* @param subcommand The subcommand the user tried to use
*/
virtual void OnSyntaxError(CommandSource &source, const Anope::string &subcommand);
-
- /** Set which command permission (e.g. chanserv/forbid) is required for this command.
- * @param reststr The permission required to successfully execute this command
- */
- void SetPermission(const Anope::string &reststr);
};
#endif // COMMANDS_H
diff --git a/include/config.h b/include/config.h
index 84ed2f8d3..6e686b13f 100644
--- a/include/config.h
+++ b/include/config.h
@@ -482,8 +482,6 @@ class CoreExport ServerConfig
Anope::string NSEnforcerHost;
/* How long before recovered nicks are released */
time_t NSReleaseTimeout;
- /* /nickserv list is oper only */
- bool NSListOpersOnly;
/* Max number of entries that can be returned from the list command */
unsigned NSListMax;
/* Only allow usermode +a etc on real services admins */
@@ -523,8 +521,6 @@ class CoreExport ServerConfig
Anope::string CSAutokickReason;
/* Time ChanServ should stay in the channel to hold it to keep users from getting in */
time_t CSInhabit;
- /* ChanServ's LIST command is oper only */
- bool CSListOpersOnly;
/* Max number of entries allowed to be returned from the LIST command */
unsigned CSListMax;
/* true to make ChanServ oper only */
diff --git a/include/services.h b/include/services.h
index 0eeafc0e9..addaf6ae8 100644
--- a/include/services.h
+++ b/include/services.h
@@ -674,6 +674,7 @@ enum
#include "users.h"
#include "account.h"
+#include "commands.h"
#include "bots.h"
struct LevelInfo
diff --git a/modules/core/bs_bot.cpp b/modules/core/bs_bot.cpp
index ec0bea734..7500d1926 100644
--- a/modules/core/bs_bot.cpp
+++ b/modules/core/bs_bot.cpp
@@ -314,7 +314,7 @@ class CommandBSBot : public Command
if (cmd.equals_ci("ADD"))
{
// ADD nick user host real - 5
- if (!u->HasCommand("botserv/botserv/bot/add"))
+ if (!u->HasCommand("botserv/bot/add"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -337,7 +337,7 @@ class CommandBSBot : public Command
{
// CHANGE oldn newn user host real - 6
// but only oldn and newn are required
- if (!u->HasCommand("botserv/botserv/bot/change"))
+ if (!u->HasCommand("botserv/bot/change"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -354,7 +354,7 @@ class CommandBSBot : public Command
else if (cmd.equals_ci("DEL"))
{
// DEL nick
- if (!u->HasCommand("botserv/botserv/bot/del"))
+ if (!u->HasCommand("botserv/bot/del"))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/core/cs_list.cpp b/modules/core/cs_list.cpp
index 639c23267..a79c047c4 100644
--- a/modules/core/cs_list.cpp
+++ b/modules/core/cs_list.cpp
@@ -33,12 +33,6 @@ class CommandCSList : public Command
int count = 0, from = 0, to = 0;
bool suspended = false, channoexpire = false;
- if (Config->CSListOpersOnly && !u->HasMode(UMODE_OPER))
- {
- source.Reply(ACCESS_DENIED);
- return;
- }
-
if (pattern[0] == '#')
{
Anope::string n1 = myStrGetToken(pattern.substr(1), '-', 0), /* Read FROM out */
diff --git a/modules/core/cs_saset.cpp b/modules/core/cs_saset.cpp
index cb749a3c3..699c5bc2c 100644
--- a/modules/core/cs_saset.cpp
+++ b/modules/core/cs_saset.cpp
@@ -16,7 +16,7 @@
class CommandCSSASet : public Command
{
public:
- CommandCSSASet(Module *creator) : Command(creator, "chanserv/saset", 2, 3, "chanserv/saset")
+ CommandCSSASet(Module *creator) : Command(creator, "chanserv/saset", 2, 3)
{
this->SetDesc(_("Forcefully set channel options and information"));
this->SetSyntax(_("\037option\037 \037channel\037 \037parameters\037"));
@@ -37,11 +37,13 @@ class CommandCSSASet : public Command
" \n"
"Available options:"));
Anope::string this_name = source.command;
- for (command_map::iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it)
+ for (BotInfo::command_map::iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it)
{
- if (it->first.find_ci(this_name + " ") == 0)
+ const Anope::string &c_name = it->first;
+ CommandInfo &info = it->second;
+ if (c_name.find_ci(this_name + " ") == 0)
{
- service_reference<Command> command(it->second);
+ service_reference<Command> command(info.name);
if (command)
{
source.command = it->first;
diff --git a/modules/core/cs_saset_noexpire.cpp b/modules/core/cs_saset_noexpire.cpp
index 4a1caa449..1e085496f 100644
--- a/modules/core/cs_saset_noexpire.cpp
+++ b/modules/core/cs_saset_noexpire.cpp
@@ -16,7 +16,7 @@
class CommandCSSASetNoexpire : public Command
{
public:
- CommandCSSASetNoexpire(Module *creator) : Command(creator, "chanserv/saset/noexpire", 2, 2, "chanserv/saset/noexpire")
+ CommandCSSASetNoexpire(Module *creator) : Command(creator, "chanserv/saset/noexpire", 2, 2)
{
this->SetDesc(_("Prevent the channel from expiring"));
this->SetDesc(_("\037channel\037 {ON | OFF}"));
@@ -32,7 +32,7 @@ class CommandCSSASetNoexpire : public Command
return;
}
- if (!this->permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/core/cs_set.cpp b/modules/core/cs_set.cpp
index 8b5ca1f61..65719ce91 100644
--- a/modules/core/cs_set.cpp
+++ b/modules/core/cs_set.cpp
@@ -37,11 +37,13 @@ class CommandCSSet : public Command
" \n"
"Available options:"));
Anope::string this_name = source.command;
- for (command_map::iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it)
+ for (BotInfo::command_map::iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it)
{
- if (it->first.find_ci(this_name + " ") == 0)
+ const Anope::string &c_name = it->first;
+ CommandInfo &info = it->second;
+ if (c_name.find_ci(this_name + " ") == 0)
{
- service_reference<Command> command(it->second);
+ service_reference<Command> command(info.name);
if (command)
{
source.command = it->first;
diff --git a/modules/core/cs_set_bantype.cpp b/modules/core/cs_set_bantype.cpp
index 14b13a77b..94d2aa151 100644
--- a/modules/core/cs_set_bantype.cpp
+++ b/modules/core/cs_set_bantype.cpp
@@ -16,7 +16,7 @@
class CommandCSSetBanType : public Command
{
public:
- CommandCSSetBanType(Module *creator, const Anope::string &cname = "chanserv/set/bantype", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission)
+ CommandCSSetBanType(Module *creator, const Anope::string &cname = "chanserv/set/bantype") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Set how Services make bans on the channel"));
this->SetSyntax(_("\037channel\037 \037bantype\037"));
@@ -32,7 +32,7 @@ class CommandCSSetBanType : public Command
return;
}
- if (!this->permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
@@ -74,7 +74,7 @@ class CommandCSSetBanType : public Command
class CommandCSSASetBanType : public CommandCSSetBanType
{
public:
- CommandCSSASetBanType(Module *creator) : CommandCSSetBanType(creator, "chanserv/saset/bantype", "chanserv/saset/bantype")
+ CommandCSSASetBanType(Module *creator) : CommandCSSetBanType(creator, "chanserv/saset/bantype")
{
}
};
diff --git a/modules/core/cs_set_description.cpp b/modules/core/cs_set_description.cpp
index 3282f8144..5c2cd447d 100644
--- a/modules/core/cs_set_description.cpp
+++ b/modules/core/cs_set_description.cpp
@@ -16,7 +16,7 @@
class CommandCSSetDescription : public Command
{
public:
- CommandCSSetDescription(Module *creator, const Anope::string &cname = "chanserv/set/description", const Anope::string &cpermission = "") : Command(creator, cname, 1, 2, cpermission)
+ CommandCSSetDescription(Module *creator, const Anope::string &cname = "chanserv/set/description") : Command(creator, cname, 1, 2)
{
this->SetDesc(_("Set the channel description"));
this->SetSyntax(_("\037channel\037 [\037description\037]"));
@@ -32,7 +32,7 @@ class CommandCSSetDescription : public Command
return;
}
- if (!this->permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
@@ -65,7 +65,7 @@ class CommandCSSetDescription : public Command
class CommandCSSASetDescription : public CommandCSSetDescription
{
public:
- CommandCSSASetDescription(Module *creator) : CommandCSSetDescription(creator, "chanserv/saset/description", "chanserv/saset/description")
+ CommandCSSASetDescription(Module *creator) : CommandCSSetDescription(creator, "chanserv/saset/description")
{
}
};
diff --git a/modules/core/cs_set_founder.cpp b/modules/core/cs_set_founder.cpp
index e71fd4d3e..2169af972 100644
--- a/modules/core/cs_set_founder.cpp
+++ b/modules/core/cs_set_founder.cpp
@@ -16,7 +16,7 @@
class CommandCSSetFounder : public Command
{
public:
- CommandCSSetFounder(Module *creator, const Anope::string &cname = "chanserv/set/founder", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission)
+ CommandCSSetFounder(Module *creator, const Anope::string &cname = "chanserv/set/founder") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Set the founder of a channel"));
this->SetSyntax(_("\037channel\037 \037nick\037"));
@@ -32,13 +32,13 @@ class CommandCSSetFounder : public Command
return;
}
- if (!this->permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
}
- if (this->permission.empty() && (ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->HasPriv(u, CA_FOUNDER)))
+ if (source.permission.empty() && (ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->HasPriv(u, CA_FOUNDER)))
{
source.Reply(ACCESS_DENIED);
return;
@@ -59,7 +59,7 @@ class CommandCSSetFounder : public Command
return;
}
- Log(!this->permission.empty() ? LOG_ADMIN : LOG_COMMAND, u, this, ci) << "to change the founder to " << nc->display;
+ Log(!source.permission.empty() ? LOG_ADMIN : LOG_COMMAND, u, this, ci) << "to change the founder to " << nc->display;
ci->SetFounder(nc);
@@ -81,7 +81,7 @@ class CommandCSSetFounder : public Command
class CommandCSSASetFounder : public CommandCSSetFounder
{
public:
- CommandCSSASetFounder(Module *creator) : CommandCSSetFounder(creator, "chanserv/saset/founder", "chanserv/saset/founder")
+ CommandCSSASetFounder(Module *creator) : CommandCSSetFounder(creator, "chanserv/saset/founder")
{
}
};
diff --git a/modules/core/cs_set_keeptopic.cpp b/modules/core/cs_set_keeptopic.cpp
index 0322987e4..05578a2e5 100644
--- a/modules/core/cs_set_keeptopic.cpp
+++ b/modules/core/cs_set_keeptopic.cpp
@@ -16,7 +16,7 @@
class CommandCSSetKeepTopic : public Command
{
public:
- CommandCSSetKeepTopic(Module *creator, const Anope::string &cname = "chanserv/set/keeptopic", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission)
+ CommandCSSetKeepTopic(Module *creator, const Anope::string &cname = "chanserv/set/keeptopic") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Retain topic when channel is not in use"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
@@ -32,7 +32,7 @@ class CommandCSSetKeepTopic : public Command
return;
}
- if (!this->permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
@@ -70,7 +70,7 @@ class CommandCSSetKeepTopic : public Command
class CommandCSSASetKeepTopic : public CommandCSSetKeepTopic
{
public:
- CommandCSSASetKeepTopic(Module *creator) : CommandCSSetKeepTopic(creator, "chanserv/saset/keeptopic", "chanserv/saset/keeptopic")
+ CommandCSSASetKeepTopic(Module *creator) : CommandCSSetKeepTopic(creator, "chanserv/saset/keeptopic")
{
}
};
diff --git a/modules/core/cs_set_opnotice.cpp b/modules/core/cs_set_opnotice.cpp
index cfcaf358c..018b89437 100644
--- a/modules/core/cs_set_opnotice.cpp
+++ b/modules/core/cs_set_opnotice.cpp
@@ -16,7 +16,7 @@
class CommandCSSetOpNotice : public Command
{
public:
- CommandCSSetOpNotice(Module *creator, const Anope::string &cname = "chanserv/set/notice", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission)
+ CommandCSSetOpNotice(Module *creator, const Anope::string &cname = "chanserv/set/notice") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Send a notice when OP/DEOP commands are used"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
@@ -32,7 +32,7 @@ class CommandCSSetOpNotice : public Command
return;
}
- if (!this->permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
@@ -69,7 +69,7 @@ class CommandCSSetOpNotice : public Command
class CommandCSSASetOpNotice : public CommandCSSetOpNotice
{
public:
- CommandCSSASetOpNotice(Module *creator) : CommandCSSetOpNotice(creator, "chanserv/saset/opnotice", "chanserv/saset/opnotice")
+ CommandCSSASetOpNotice(Module *creator) : CommandCSSetOpNotice(creator, "chanserv/saset/opnotice")
{
}
};
diff --git a/modules/core/cs_set_peace.cpp b/modules/core/cs_set_peace.cpp
index cb208e540..3a045fc6d 100644
--- a/modules/core/cs_set_peace.cpp
+++ b/modules/core/cs_set_peace.cpp
@@ -16,7 +16,7 @@
class CommandCSSetPeace : public Command
{
public:
- CommandCSSetPeace(Module *creator, const Anope::string &cname = "chanserv/set/peace", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission)
+ CommandCSSetPeace(Module *creator, const Anope::string &cname = "chanserv/set/peace") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Regulate the use of critical commands"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
@@ -32,7 +32,7 @@ class CommandCSSetPeace : public Command
return;
}
- if (!this->permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
@@ -69,7 +69,7 @@ class CommandCSSetPeace : public Command
class CommandCSSASetPeace : public CommandCSSetPeace
{
public:
- CommandCSSASetPeace(Module *creator) : CommandCSSetPeace(creator, "chanserv/saset/peace", "chanserv/saset/peace")
+ CommandCSSASetPeace(Module *creator) : CommandCSSetPeace(creator, "chanserv/saset/peace")
{
}
};
diff --git a/modules/core/cs_set_persist.cpp b/modules/core/cs_set_persist.cpp
index 2402a3370..3cc9564c4 100644
--- a/modules/core/cs_set_persist.cpp
+++ b/modules/core/cs_set_persist.cpp
@@ -16,7 +16,7 @@
class CommandCSSetPersist : public Command
{
public:
- CommandCSSetPersist(Module *creator, const Anope::string &cname = "chanserv/set/persist", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission)
+ CommandCSSetPersist(Module *creator, const Anope::string &cname = "chanserv/set/persist") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Set the channel as permanent"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
@@ -32,7 +32,7 @@ class CommandCSSetPersist : public Command
return;
}
- if (!this->permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
@@ -156,7 +156,7 @@ class CommandCSSetPersist : public Command
class CommandCSSASetPersist : public CommandCSSetPersist
{
public:
- CommandCSSASetPersist(Module *creator) : CommandCSSetPersist(creator, "chanserv/saset/persist", "chanserv/saset/persist")
+ CommandCSSASetPersist(Module *creator) : CommandCSSetPersist(creator, "chanserv/saset/persist")
{
}
};
diff --git a/modules/core/cs_set_private.cpp b/modules/core/cs_set_private.cpp
index 85880d5da..108b11569 100644
--- a/modules/core/cs_set_private.cpp
+++ b/modules/core/cs_set_private.cpp
@@ -16,7 +16,7 @@
class CommandCSSetPrivate : public Command
{
public:
- CommandCSSetPrivate(Module *creator, const Anope::string &cname = "chanserv/set/private", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission)
+ CommandCSSetPrivate(Module *creator, const Anope::string &cname = "chanserv/set/private") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Hide channel from LIST command"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
@@ -32,7 +32,7 @@ class CommandCSSetPrivate : public Command
return;
}
- if (!this->permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
@@ -69,7 +69,7 @@ class CommandCSSetPrivate : public Command
class CommandCSSASetPrivate : public CommandCSSetPrivate
{
public:
- CommandCSSASetPrivate(Module *creator) : CommandCSSetPrivate(creator, "chanserv/saset/private", "chanserv/saset/private")
+ CommandCSSASetPrivate(Module *creator) : CommandCSSetPrivate(creator, "chanserv/saset/private")
{
}
};
diff --git a/modules/core/cs_set_restricted.cpp b/modules/core/cs_set_restricted.cpp
index 9796c97da..5d675d2e7 100644
--- a/modules/core/cs_set_restricted.cpp
+++ b/modules/core/cs_set_restricted.cpp
@@ -15,7 +15,7 @@
class CommandCSSetRestricted : public Command
{
public:
- CommandCSSetRestricted(Module *creator, const Anope::string &cname = "chanserv/set/restricted", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission)
+ CommandCSSetRestricted(Module *creator, const Anope::string &cname = "chanserv/set/restricted") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Restrict access to the channel"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
@@ -31,7 +31,7 @@ class CommandCSSetRestricted : public Command
return;
}
- if (!this->permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
@@ -67,7 +67,7 @@ class CommandCSSetRestricted : public Command
class CommandCSSASetRestricted : public CommandCSSetRestricted
{
public:
- CommandCSSASetRestricted(Module *creator) : CommandCSSetRestricted(creator, "chanserv/saset/restricted", "chanserv/saset/restricted")
+ CommandCSSASetRestricted(Module *creator) : CommandCSSetRestricted(creator, "chanserv/saset/restricted")
{
}
};
diff --git a/modules/core/cs_set_secure.cpp b/modules/core/cs_set_secure.cpp
index 2042ed7b9..26e8c5768 100644
--- a/modules/core/cs_set_secure.cpp
+++ b/modules/core/cs_set_secure.cpp
@@ -16,7 +16,7 @@
class CommandCSSetSecure : public Command
{
public:
- CommandCSSetSecure(Module *creator, const Anope::string &cname = "chanserv/set/secure", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission)
+ CommandCSSetSecure(Module *creator, const Anope::string &cname = "chanserv/set/secure") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Activate security features"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
@@ -32,7 +32,7 @@ class CommandCSSetSecure : public Command
return;
}
- if (!this->permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
@@ -70,7 +70,7 @@ class CommandCSSetSecure : public Command
class CommandCSSASetSecure : public CommandCSSetSecure
{
public:
- CommandCSSASetSecure(Module *creator) : CommandCSSetSecure(creator, "chanserv/saset/secure", "chanserv/saset/secure")
+ CommandCSSASetSecure(Module *creator) : CommandCSSetSecure(creator, "chanserv/saset/secure")
{
}
};
diff --git a/modules/core/cs_set_securefounder.cpp b/modules/core/cs_set_securefounder.cpp
index 6e11bbce4..7afc2e32d 100644
--- a/modules/core/cs_set_securefounder.cpp
+++ b/modules/core/cs_set_securefounder.cpp
@@ -16,7 +16,7 @@
class CommandCSSetSecureFounder : public Command
{
public:
- CommandCSSetSecureFounder(Module *creator, const Anope::string &cname = "chanserv/set/securefounder", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission)
+ CommandCSSetSecureFounder(Module *creator, const Anope::string &cname = "chanserv/set/securefounder") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Stricter control of channel founder status"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
@@ -33,7 +33,7 @@ class CommandCSSetSecureFounder : public Command
}
- if (this->permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->HasPriv(u, CA_FOUNDER))
+ if (source.permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->HasPriv(u, CA_FOUNDER))
{
source.Reply(ACCESS_DENIED);
return;
@@ -71,7 +71,7 @@ class CommandCSSetSecureFounder : public Command
class CommandCSSASetSecureFounder : public CommandCSSetSecureFounder
{
public:
- CommandCSSASetSecureFounder(Module *creator) : CommandCSSetSecureFounder(creator, "chanserv/saset/securefounder", "chanserv/saset/securefounder")
+ CommandCSSASetSecureFounder(Module *creator) : CommandCSSetSecureFounder(creator, "chanserv/saset/securefounder")
{
}
};
diff --git a/modules/core/cs_set_secureops.cpp b/modules/core/cs_set_secureops.cpp
index ed15f7cb5..4c3c54b05 100644
--- a/modules/core/cs_set_secureops.cpp
+++ b/modules/core/cs_set_secureops.cpp
@@ -16,7 +16,7 @@
class CommandCSSetSecureOps : public Command
{
public:
- CommandCSSetSecureOps(Module *creator, const Anope::string &cname = "chanserv/set/secureops", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission)
+ CommandCSSetSecureOps(Module *creator, const Anope::string &cname = "chanserv/set/secureops") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Stricter control of chanop status"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
@@ -32,7 +32,7 @@ class CommandCSSetSecureOps : public Command
return;
}
- if (!this->permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
@@ -68,7 +68,7 @@ class CommandCSSetSecureOps : public Command
class CommandCSSASetSecureOps : public CommandCSSetSecureOps
{
public:
- CommandCSSASetSecureOps(Module *creator) : CommandCSSetSecureOps(creator, "chanserv/saset/secureops", "chanserv/saset/secureops")
+ CommandCSSASetSecureOps(Module *creator) : CommandCSSetSecureOps(creator, "chanserv/saset/secureops")
{
}
};
diff --git a/modules/core/cs_set_signkick.cpp b/modules/core/cs_set_signkick.cpp
index 38894b62b..0d421576d 100644
--- a/modules/core/cs_set_signkick.cpp
+++ b/modules/core/cs_set_signkick.cpp
@@ -16,7 +16,7 @@
class CommandCSSetSignKick : public Command
{
public:
- CommandCSSetSignKick(Module *creator, const Anope::string &cname = "chanserv/set/signkick", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission)
+ CommandCSSetSignKick(Module *creator, const Anope::string &cname = "chanserv/set/signkick") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Sign kicks that are done with KICK command"));
this->SetSyntax(_("\037channel\037 SIGNKICK {ON | LEVEL | OFF}"));
@@ -32,7 +32,7 @@ class CommandCSSetSignKick : public Command
return;
}
- if (!this->permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
@@ -80,7 +80,7 @@ class CommandCSSetSignKick : public Command
class CommandCSSASetSignKick : public CommandCSSetSignKick
{
public:
- CommandCSSASetSignKick(Module *creator) : CommandCSSetSignKick(creator, "chanserv/saset/signkick", "chanserv/saset/signkick")
+ CommandCSSASetSignKick(Module *creator) : CommandCSSetSignKick(creator, "chanserv/saset/signkick")
{
}
};
diff --git a/modules/core/cs_set_successor.cpp b/modules/core/cs_set_successor.cpp
index a1c756b5d..f7ed8dba9 100644
--- a/modules/core/cs_set_successor.cpp
+++ b/modules/core/cs_set_successor.cpp
@@ -16,7 +16,7 @@
class CommandCSSetSuccessor : public Command
{
public:
- CommandCSSetSuccessor(Module *creator, const Anope::string &cname = "chanserv/set/successor", const Anope::string &cpermission = "") : Command(creator, cname, 1, 2, cpermission)
+ CommandCSSetSuccessor(Module *creator, const Anope::string &cname = "chanserv/set/successor") : Command(creator, cname, 1, 2)
{
this->SetDesc(_("Set the successor for a channel"));
this->SetSyntax(_("\037channel\037 \037nick\037"));
@@ -32,13 +32,13 @@ class CommandCSSetSuccessor : public Command
return;
}
- if (!this->permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
}
- if (this->permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->HasPriv(u, CA_FOUNDER))
+ if (source.permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->HasPriv(u, CA_FOUNDER))
{
source.Reply(ACCESS_DENIED);
return;
@@ -65,7 +65,7 @@ class CommandCSSetSuccessor : public Command
else
nc = NULL;
- Log(!this->permission.empty() ? LOG_ADMIN : LOG_COMMAND, u, this, ci) << "to change the successor from " << (ci->successor ? ci->successor->display : "none") << " to " << (nc ? nc->display : "none");
+ Log(!source.permission.empty() ? LOG_ADMIN : LOG_COMMAND, u, this, ci) << "to change the successor from " << (ci->successor ? ci->successor->display : "none") << " to " << (nc ? nc->display : "none");
ci->successor = nc;
@@ -95,7 +95,7 @@ class CommandCSSetSuccessor : public Command
class CommandCSSASetSuccessor : public CommandCSSetSuccessor
{
public:
- CommandCSSASetSuccessor(Module *creator) : CommandCSSetSuccessor(creator, "chanserv/saset/successor", "chanserv/saset/successor")
+ CommandCSSASetSuccessor(Module *creator) : CommandCSSetSuccessor(creator, "chanserv/saset/successor")
{
}
};
diff --git a/modules/core/cs_set_topiclock.cpp b/modules/core/cs_set_topiclock.cpp
index 3dea981f6..e670385ba 100644
--- a/modules/core/cs_set_topiclock.cpp
+++ b/modules/core/cs_set_topiclock.cpp
@@ -16,7 +16,7 @@
class CommandCSSetTopicLock : public Command
{
public:
- CommandCSSetTopicLock(Module *creator, const Anope::string &cname = "chanserv/set/topiclock", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission)
+ CommandCSSetTopicLock(Module *creator, const Anope::string &cname = "chanserv/set/topiclock") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Topic can only be changed with TOPIC"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
@@ -32,7 +32,7 @@ class CommandCSSetTopicLock : public Command
return;
}
- if (!this->permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
@@ -68,7 +68,7 @@ class CommandCSSetTopicLock : public Command
class CommandCSSASetTopicLock : public CommandCSSetTopicLock
{
public:
- CommandCSSASetTopicLock(Module *creator) : CommandCSSetTopicLock(creator, "chanserv/saset/topiclock", "chanserv/saset/topiclock")
+ CommandCSSASetTopicLock(Module *creator) : CommandCSSetTopicLock(creator, "chanserv/saset/topiclock")
{
}
};
diff --git a/modules/core/cs_suspend.cpp b/modules/core/cs_suspend.cpp
index 0e0a72bcf..d59ffb44b 100644
--- a/modules/core/cs_suspend.cpp
+++ b/modules/core/cs_suspend.cpp
@@ -16,7 +16,7 @@
class CommandCSSuspend : public Command
{
public:
- CommandCSSuspend(Module *creator) : Command(creator, "chanserv/suspend", 1, 2, "chanserv/suspend")
+ CommandCSSuspend(Module *creator) : Command(creator, "chanserv/suspend", 1, 2)
{
this->SetDesc(_("Prevent a channel from being used preserving channel data and settings"));
this->SetSyntax(_("\037channel\037 [\037reason\037]"));
@@ -86,7 +86,7 @@ class CommandCSSuspend : public Command
class CommandCSUnSuspend : public Command
{
public:
- CommandCSUnSuspend(Module *creator) : Command(creator, "chanserv/unsuspend", 1, 1, "chanserv/suspend")
+ CommandCSUnSuspend(Module *creator) : Command(creator, "chanserv/unsuspend", 1, 1)
{
this->SetDesc(_("Releases a suspended channel"));
this->SetSyntax(_("\037channel\037"));
diff --git a/modules/core/db_mysql.cpp b/modules/core/db_mysql.cpp
index 3f18230fe..4e6a7de4f 100644
--- a/modules/core/db_mysql.cpp
+++ b/modules/core/db_mysql.cpp
@@ -52,7 +52,7 @@ static void WriteBotMetadata(const Anope::string &key, const Anope::string &data
class CommandSQLSync : public Command
{
public:
- CommandSQLSync(Module *creator) : Command(creator, "SQLSYNC", 0, 0, "operserv/sqlsync")
+ CommandSQLSync(Module *creator) : Command(creator, "SQLSYNC", 0, 0)
{
this->SetDesc(_("Import your databases to SQL"));
this->SetSyntax("");
diff --git a/modules/core/gl_global.cpp b/modules/core/gl_global.cpp
index 390d912ef..80c42e017 100644
--- a/modules/core/gl_global.cpp
+++ b/modules/core/gl_global.cpp
@@ -17,7 +17,7 @@
class CommandGLGlobal : public Command
{
public:
- CommandGLGlobal(Module *creator) : Command(creator, "global/global", 1, 1, "global/global")
+ CommandGLGlobal(Module *creator) : Command(creator, "global/global", 1, 1)
{
this->SetDesc(_("Send a message to all users"));
this->SetSyntax(_("\037message\037"));
diff --git a/modules/core/help.cpp b/modules/core/help.cpp
index 8362b48d9..2a4f25b6c 100644
--- a/modules/core/help.cpp
+++ b/modules/core/help.cpp
@@ -32,19 +32,22 @@ class CommandHelp : public Command
if (params.empty())
{
- for (command_map::iterator it = bi->commands.begin(), it_end = bi->commands.end(); it != it_end; ++it)
+ for (BotInfo::command_map::iterator it = bi->commands.begin(), it_end = bi->commands.end(); it != it_end; ++it)
{
+ const Anope::string &c_name = it->first;
+ CommandInfo &info = it->second;
+
// Smaller command exists
- Anope::string cmd = myStrGetToken(it->first, ' ', 0);
+ Anope::string cmd = myStrGetToken(c_name, ' ', 0);
if (cmd != it->first && bi->commands.count(cmd))
continue;
- service_reference<Command> c(it->second);
+ service_reference<Command> c(info.name);
if (!c)
continue;
- if (!Config->HidePrivilegedCommands || c->permission.empty() || u->HasCommand(c->permission))
+ if (!Config->HidePrivilegedCommands || info.permission.empty() || u->HasCommand(info.permission))
{
- source.command = it->first;
+ source.command = c_name;
c->OnServHelp(source);
}
}
@@ -59,15 +62,17 @@ class CommandHelp : public Command
full_command += " " + params[i];
full_command.erase(full_command.begin());
- std::map<Anope::string, Anope::string>::iterator it = bi->commands.find(full_command);
+ BotInfo::command_map::iterator it = bi->commands.find(full_command);
if (it == bi->commands.end())
continue;
- service_reference<Command> c(it->second);
+ CommandInfo &info = it->second;
+
+ service_reference<Command> c(info.name);
if (!c)
continue;
- if (Config->HidePrivilegedCommands && !c->permission.empty() && !u->HasCommand(c->permission))
+ if (Config->HidePrivilegedCommands && !info.permission.empty() && !u->HasCommand(info.permission))
continue;
const Anope::string &subcommand = params.size() > max ? params[max] : "";
@@ -76,19 +81,24 @@ class CommandHelp : public Command
continue;
helped = true;
- source.Reply(" ");
/* Inform the user what permission is required to use the command */
- if (!c->permission.empty())
- source.Reply(_("Access to this command requires the permission \002%s\002 to be present in your opertype."), c->permission.c_str());
+ if (!info.permission.empty())
+ {
+ source.Reply(" ");
+ source.Reply(_("Access to this command requires the permission \002%s\002 to be present in your opertype."), info.permission.c_str());
+ }
if (!c->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !u->IsIdentified())
+ {
+ if (info.permission.empty())
+ source.Reply(" ");
source.Reply( _("You need to be identified to use this command."));
+ }
/* User doesn't have the proper permission to use this command */
- else if (!c->permission.empty() && !u->HasCommand(c->permission))
+ else if (!info.permission.empty() && !u->HasCommand(info.permission))
+ {
source.Reply(_("You cannot use this command."));
- /* User can use this command */
- else
- source.Reply(_("You can use this command."));
+ }
break;
}
diff --git a/modules/core/hs_del.cpp b/modules/core/hs_del.cpp
index b4d101d44..541986aff 100644
--- a/modules/core/hs_del.cpp
+++ b/modules/core/hs_del.cpp
@@ -16,7 +16,7 @@
class CommandHSDel : public Command
{
public:
- CommandHSDel(Module *creator) : Command(creator, "hostserv/del", 1, 1, "hostserv/del")
+ CommandHSDel(Module *creator) : Command(creator, "hostserv/del", 1, 1)
{
this->SetDesc(_("Delete the vhost of another user"));
this->SetSyntax(_("\037nick\037"));
@@ -51,7 +51,7 @@ class CommandHSDel : public Command
class CommandHSDelAll : public Command
{
public:
- CommandHSDelAll(Module *creator) : Command(creator, "hostserv/delall", 1, 1, "hostserv/del")
+ CommandHSDelAll(Module *creator) : Command(creator, "hostserv/delall", 1, 1)
{
this->SetDesc(_("Delete the vhost for all nicks in a group"));
this->SetSyntax(_("\037nick\037"));
diff --git a/modules/core/hs_list.cpp b/modules/core/hs_list.cpp
index dbc852e5b..589eef3e1 100644
--- a/modules/core/hs_list.cpp
+++ b/modules/core/hs_list.cpp
@@ -16,7 +16,7 @@
class CommandHSList : public Command
{
public:
- CommandHSList(Module *creator) : Command(creator, "hostserv/list", 0, 1, "hostserv/list")
+ CommandHSList(Module *creator) : Command(creator, "hostserv/list", 0, 1)
{
this->SetDesc(_("Displays one or more vhost entries."));
this->SetSyntax(_("\002[<key>|<#X-Y>]"));
diff --git a/modules/core/hs_set.cpp b/modules/core/hs_set.cpp
index 2b427983d..4711022db 100644
--- a/modules/core/hs_set.cpp
+++ b/modules/core/hs_set.cpp
@@ -16,7 +16,7 @@
class CommandHSSet : public Command
{
public:
- CommandHSSet(Module *creator) : Command(creator, "hostserv/set", 2, 2, "hostserv/set")
+ CommandHSSet(Module *creator) : Command(creator, "hostserv/set", 2, 2)
{
this->SetDesc(_("Set the vhost of another user"));
this->SetSyntax(_("\037nick\037 \037hostmask\037"));
@@ -123,7 +123,7 @@ class CommandHSSetAll : public Command
}
public:
- CommandHSSetAll(Module *creator) : Command(creator, "hostserv/setall", 2, 2, "hostserv/set")
+ CommandHSSetAll(Module *creator) : Command(creator, "hostserv/setall", 2, 2)
{
this->SetDesc(_("Set the vhost for all nicks in a group"));
this->SetSyntax(_("\037nick\037 \037hostmask>\037"));
diff --git a/modules/core/ms_sendall.cpp b/modules/core/ms_sendall.cpp
index 6a764f829..7af5ac7af 100644
--- a/modules/core/ms_sendall.cpp
+++ b/modules/core/ms_sendall.cpp
@@ -17,7 +17,7 @@
class CommandMSSendAll : public Command
{
public:
- CommandMSSendAll(Module *creator) : Command(creator, "memoserv/sendall", 1, 1, "memoserv/sendall")
+ CommandMSSendAll(Module *creator) : Command(creator, "memoserv/sendall", 1, 1)
{
this->SetDesc(_("Send a memo to all registered users"));
this->SetSyntax(_("\037memo-text\037"));
diff --git a/modules/core/ms_staff.cpp b/modules/core/ms_staff.cpp
index b4fe26f5c..6264dbea4 100644
--- a/modules/core/ms_staff.cpp
+++ b/modules/core/ms_staff.cpp
@@ -17,7 +17,7 @@
class CommandMSStaff : public Command
{
public:
- CommandMSStaff(Module *creator) : Command(creator, "memoserv/staff", 1, 1, "memoserv/staff")
+ CommandMSStaff(Module *creator) : Command(creator, "memoserv/staff", 1, 1)
{
this->SetDesc(_("Send a memo to all opers/admins"));
this->SetSyntax(_("\037memo-text\037"));
diff --git a/modules/core/ns_getemail.cpp b/modules/core/ns_getemail.cpp
index 7519ae6d0..fa27e5174 100644
--- a/modules/core/ns_getemail.cpp
+++ b/modules/core/ns_getemail.cpp
@@ -20,7 +20,7 @@
class CommandNSGetEMail : public Command
{
public:
- CommandNSGetEMail(Module *creator) : Command(creator, "nickserv/getemail", 1, 1, "nickserv/getemail")
+ CommandNSGetEMail(Module *creator) : Command(creator, "nickserv/getemail", 1, 1)
{
this->SetDesc(_("Matches and returns all users that registered using given email"));
this->SetSyntax(_("\037user@email-host\037"));
diff --git a/modules/core/ns_getpass.cpp b/modules/core/ns_getpass.cpp
index ab4bcd4e2..9ebea5263 100644
--- a/modules/core/ns_getpass.cpp
+++ b/modules/core/ns_getpass.cpp
@@ -16,7 +16,7 @@
class CommandNSGetPass : public Command
{
public:
- CommandNSGetPass(Module *creator) : Command(creator, "nickserv/getpass", 1, 1, "nickserv/getpass")
+ CommandNSGetPass(Module *creator) : Command(creator, "nickserv/getpass", 1, 1)
{
this->SetDesc(_("Retrieve the password for a nickname"));
this->SetSyntax(_("\037nickname\037"));
diff --git a/modules/core/ns_list.cpp b/modules/core/ns_list.cpp
index e14983530..96049ba02 100644
--- a/modules/core/ns_list.cpp
+++ b/modules/core/ns_list.cpp
@@ -36,12 +36,6 @@ class CommandNSList : public Command
suspended = nsnoexpire = unconfirmed = false;
- if (Config->NSListOpersOnly && !u->HasMode(UMODE_OPER)) /* reverse the help logic */
- {
- source.Reply(ACCESS_DENIED);
- return;
- }
-
if (pattern[0] == '#')
{
Anope::string n1 = myStrGetToken(pattern.substr(1), '-', 0), /* Read FROM out */
diff --git a/modules/core/ns_saset.cpp b/modules/core/ns_saset.cpp
index b3f732176..a4aa2f422 100644
--- a/modules/core/ns_saset.cpp
+++ b/modules/core/ns_saset.cpp
@@ -33,14 +33,17 @@ class CommandNSSASet : public Command
this->SendSyntax(source);
source.Reply(_("Sets various nickname options. \037option\037 can be one of:"));
Anope::string this_name = source.command;
- for (command_map::iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it)
+ for (BotInfo::command_map::iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it)
{
- if (it->first.find_ci(this_name + " ") == 0)
+ const Anope::string &c_name = it->first;
+ CommandInfo &info = it->second;
+
+ if (c_name.find_ci(this_name + " ") == 0)
{
- service_reference<Command> command(it->second);
+ service_reference<Command> command(info.name);
if (command)
{
- source.command = it->first;
+ source.command = c_name;
command->OnServHelp(source);
}
}
@@ -55,7 +58,7 @@ class CommandNSSASet : public Command
class CommandNSSASetDisplay : public Command
{
public:
- CommandNSSASetDisplay(Module *creator) : Command(creator, "nickserv/saset/display", 2, 2, "nickserv/saset/display")
+ CommandNSSASetDisplay(Module *creator) : Command(creator, "nickserv/saset/display", 2, 2)
{
this->SetDesc(_("Set the display of the group in Services"));
this->SetSyntax(_("\037nickname\037 \037new-display\037"));
@@ -95,7 +98,7 @@ class CommandNSSASetDisplay : public Command
class CommandNSSASetPassword : public Command
{
public:
- CommandNSSASetPassword(Module *creator) : Command(creator, "nickserv/saset/password", 2, 2, "nickserv/saset/password")
+ CommandNSSASetPassword(Module *creator) : Command(creator, "nickserv/saset/password", 2, 2)
{
this->SetDesc(_("Set the nickname password"));
this->SetSyntax(_("\037nickname\037 \037new-password\037"));
diff --git a/modules/core/ns_saset_noexpire.cpp b/modules/core/ns_saset_noexpire.cpp
index 26da7786f..1bff9b461 100644
--- a/modules/core/ns_saset_noexpire.cpp
+++ b/modules/core/ns_saset_noexpire.cpp
@@ -16,7 +16,7 @@
class CommandNSSASetNoexpire : public Command
{
public:
- CommandNSSASetNoexpire(Module *creator) : Command(creator, "nickserv/saset/noexpire", 1, 2, "nickserv/saset/noexpire")
+ CommandNSSASetNoexpire(Module *creator) : Command(creator, "nickserv/saset/noexpire", 1, 2)
{
this->SetDesc(_("Prevent the nickname from expiring"));
this->SetSyntax(_("\037nickname\037 {ON | OFF}"));
diff --git a/modules/core/ns_set.cpp b/modules/core/ns_set.cpp
index 8a419153f..ad7acb5a4 100644
--- a/modules/core/ns_set.cpp
+++ b/modules/core/ns_set.cpp
@@ -34,14 +34,17 @@ class CommandNSSet : public Command
source.Reply(" ");
source.Reply(_("Sets various nickname options. \037option\037 can be one of:"));
Anope::string this_name = source.command;
- for (command_map::iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it)
+ for (BotInfo::command_map::iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it)
{
- if (it->first.find_ci(this_name + " ") == 0)
+ const Anope::string &c_name = it->first;
+ CommandInfo &info = it->second;
+
+ if (c_name.find_ci(this_name + " ") == 0)
{
- service_reference<Command> command(it->second);
+ service_reference<Command> command(info.name);
if (command)
{
- source.command = it->first;
+ source.command = c_name;
command->OnServHelp(source);
}
}
diff --git a/modules/core/ns_set_autoop.cpp b/modules/core/ns_set_autoop.cpp
index a107f7188..ff178141f 100644
--- a/modules/core/ns_set_autoop.cpp
+++ b/modules/core/ns_set_autoop.cpp
@@ -16,7 +16,7 @@
class CommandNSSetAutoOp : public Command
{
public:
- CommandNSSetAutoOp(Module *creator, const Anope::string &sname = "nickserv/set/autoop", size_t min = 1, const Anope::string &spermission = "") : Command(creator, sname, min, min + 1, spermission)
+ CommandNSSetAutoOp(Module *creator, const Anope::string &sname = "nickserv/set/autoop", size_t min = 1) : Command(creator, sname, min, min + 1)
{
this->SetDesc(_("Should services op you automatically."));
this->SetSyntax(_("{ON | OFF}"));
@@ -66,7 +66,7 @@ class CommandNSSetAutoOp : public Command
class CommandNSSASetAutoOp : public CommandNSSetAutoOp
{
public:
- CommandNSSASetAutoOp(Module *creator) : CommandNSSetAutoOp(creator, "nickserv/saset/autoop", 2, "nickserv/saset/autoop")
+ CommandNSSASetAutoOp(Module *creator) : CommandNSSetAutoOp(creator, "nickserv/saset/autoop", 2)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 {ON | OFF}"));
diff --git a/modules/core/ns_set_email.cpp b/modules/core/ns_set_email.cpp
index 4f4131950..f0914eb51 100644
--- a/modules/core/ns_set_email.cpp
+++ b/modules/core/ns_set_email.cpp
@@ -44,7 +44,7 @@ static bool SendConfirmMail(User *u, BotInfo *bi)
class CommandNSSetEmail : public Command
{
public:
- CommandNSSetEmail(Module *creator, const Anope::string &cname = "nickserv/set/email", size_t min = 0, const Anope::string &spermission = "") : Command(creator, cname, min, min + 1, spermission)
+ CommandNSSetEmail(Module *creator, const Anope::string &cname = "nickserv/set/email", size_t min = 0) : Command(creator, cname, min, min + 1)
{
this->SetDesc(_("Associate an E-mail address with your nickname"));
this->SetSyntax(_("\037address\037"));
@@ -122,7 +122,7 @@ class CommandNSSetEmail : public Command
class CommandNSSASetEmail : public CommandNSSetEmail
{
public:
- CommandNSSASetEmail(Module *creator) : CommandNSSetEmail(creator, "nickserv/saset/email", 2, "nickserv/saset/email")
+ CommandNSSASetEmail(Module *creator) : CommandNSSetEmail(creator, "nickserv/saset/email", 2)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 \037address\037"));
diff --git a/modules/core/ns_set_greet.cpp b/modules/core/ns_set_greet.cpp
index ab5243724..03bcd3834 100644
--- a/modules/core/ns_set_greet.cpp
+++ b/modules/core/ns_set_greet.cpp
@@ -16,7 +16,7 @@
class CommandNSSetGreet : public Command
{
public:
- CommandNSSetGreet(Module *creator, const Anope::string &sname = "nickserv/set/greet", size_t min = 0, const Anope::string &spermission = "") : Command(creator, sname, min, min + 1, spermission)
+ CommandNSSetGreet(Module *creator, const Anope::string &sname = "nickserv/set/greet", size_t min = 0) : Command(creator, sname, min, min + 1)
{
this->SetDesc(_("Associate a greet message with your nickname"));
this->SetSyntax(_("\037message\037"));
@@ -66,7 +66,7 @@ class CommandNSSetGreet : public Command
class CommandNSSASetGreet : public CommandNSSetGreet
{
public:
- CommandNSSASetGreet(Module *creator) : CommandNSSetGreet(creator, "nickserv/saset/greet", 1, "nickserv/saset/greet")
+ CommandNSSASetGreet(Module *creator) : CommandNSSetGreet(creator, "nickserv/saset/greet", 1)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 \037message\037"));
diff --git a/modules/core/ns_set_hide.cpp b/modules/core/ns_set_hide.cpp
index de3a96a1a..e0fb0e85e 100644
--- a/modules/core/ns_set_hide.cpp
+++ b/modules/core/ns_set_hide.cpp
@@ -16,7 +16,7 @@
class CommandNSSetHide : public Command
{
public:
- CommandNSSetHide(Module *creator, const Anope::string &sname = "nickserv/set/hide", size_t min = 2, const Anope::string &spermission = "") : Command(creator, sname, min, min + 1, spermission)
+ CommandNSSetHide(Module *creator, const Anope::string &sname = "nickserv/set/hide", size_t min = 2) : Command(creator, sname, min, min + 1)
{
this->SetDesc(_("Hide certain pieces of nickname information"));
this->SetSyntax(_("{EMAIL | STATUS | USERMASK | QUIT} {ON | OFF}"));
@@ -104,7 +104,7 @@ class CommandNSSetHide : public Command
class CommandNSSASetHide : public CommandNSSetHide
{
public:
- CommandNSSASetHide(Module *creator) : CommandNSSetHide(creator, "nickserv/saset/hide", 3, "nickserv/saset/hide")
+ CommandNSSASetHide(Module *creator) : CommandNSSetHide(creator, "nickserv/saset/hide", 3)
{
this->SetSyntax("\037nickname\037 {EMAIL | STATUS | USERMASK | QUIT} {ON | OFF}");
}
diff --git a/modules/core/ns_set_kill.cpp b/modules/core/ns_set_kill.cpp
index 26a23292b..f57a93893 100644
--- a/modules/core/ns_set_kill.cpp
+++ b/modules/core/ns_set_kill.cpp
@@ -16,7 +16,7 @@
class CommandNSSetKill : public Command
{
public:
- CommandNSSetKill(Module *creator, const Anope::string &sname = "nickserv/set/kill", size_t min = 1, const Anope::string &spermission = "") : Command(creator, sname, min, min + 1, spermission)
+ CommandNSSetKill(Module *creator, const Anope::string &sname = "nickserv/set/kill", size_t min = 1) : Command(creator, sname, min, min + 1)
{
this->SetDesc(_("Turn protection on or off"));
this->SetSyntax(_("{ON | QUICK | IMMED | OFF}"));
@@ -99,7 +99,7 @@ class CommandNSSetKill : public Command
class CommandNSSASetKill : public CommandNSSetKill
{
public:
- CommandNSSASetKill(Module *creator) : CommandNSSetKill(creator, "nickserv/saset/kill", 2, "nickserv/saset/kill")
+ CommandNSSASetKill(Module *creator) : CommandNSSetKill(creator, "nickserv/saset/kill", 2)
{
this->SetSyntax(_("\037nickname\037 {ON | QUICK | IMMED | OFF}"));
}
diff --git a/modules/core/ns_set_language.cpp b/modules/core/ns_set_language.cpp
index dcad104c5..3429ad688 100644
--- a/modules/core/ns_set_language.cpp
+++ b/modules/core/ns_set_language.cpp
@@ -16,7 +16,7 @@
class CommandNSSetLanguage : public Command
{
public:
- CommandNSSetLanguage(Module *creator, const Anope::string &sname = "nickserv/set/language", size_t min = 1, const Anope::string &spermission = "") : Command(creator, sname, min, min + 1, spermission)
+ CommandNSSetLanguage(Module *creator, const Anope::string &sname = "nickserv/set/language", size_t min = 1) : Command(creator, sname, min, min + 1)
{
this->SetDesc(_("Set the language Services will use when messaging you"));
this->SetSyntax(_("\037language\037"));
@@ -79,7 +79,7 @@ class CommandNSSetLanguage : public Command
class CommandNSSASetLanguage : public CommandNSSetLanguage
{
public:
- CommandNSSASetLanguage(Module *creator) : CommandNSSetLanguage(creator, "nickserv/saset/language", 2, "nickserv/saset/language")
+ CommandNSSASetLanguage(Module *creator) : CommandNSSetLanguage(creator, "nickserv/saset/language", 2)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 \037language\037"));
diff --git a/modules/core/ns_set_message.cpp b/modules/core/ns_set_message.cpp
index fa9c7ae18..677002c78 100644
--- a/modules/core/ns_set_message.cpp
+++ b/modules/core/ns_set_message.cpp
@@ -16,7 +16,7 @@
class CommandNSSetMessage : public Command
{
public:
- CommandNSSetMessage(Module *creator, const Anope::string &sname = "nickserv/set/message", size_t min = 1, const Anope::string &spermission = "") : Command(creator, sname, min, min + 1, spermission)
+ CommandNSSetMessage(Module *creator, const Anope::string &sname = "nickserv/set/message", size_t min = 1) : Command(creator, sname, min, min + 1)
{
this->SetDesc(_("Change the communication method of Services"));
this->SetSyntax(_("{ON | OFF}"));
@@ -73,7 +73,7 @@ class CommandNSSetMessage : public Command
class CommandNSSASetMessage : public CommandNSSetMessage
{
public:
- CommandNSSASetMessage(Module *creator) : CommandNSSetMessage(creator, "nickserv/saset/message", 2, "nickserv/saset/message")
+ CommandNSSASetMessage(Module *creator) : CommandNSSetMessage(creator, "nickserv/saset/message", 2)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 {ON | OFF}"));
diff --git a/modules/core/ns_set_private.cpp b/modules/core/ns_set_private.cpp
index 6e2948067..63fec57d6 100644
--- a/modules/core/ns_set_private.cpp
+++ b/modules/core/ns_set_private.cpp
@@ -16,7 +16,7 @@
class CommandNSSetPrivate : public Command
{
public:
- CommandNSSetPrivate(Module *creator, const Anope::string &sname = "nickserv/set/private", size_t min = 1, const Anope::string &spermission = "") : Command(creator, sname, min, min + 1, spermission)
+ CommandNSSetPrivate(Module *creator, const Anope::string &sname = "nickserv/set/private", size_t min = 1) : Command(creator, sname, min, min + 1)
{
this->SetDesc(Anope::printf(_("Prevent the nickname from appearing in a \002%s%s LIST\002"), Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str()));
this->SetSyntax(_("{ON | OFF}"));
@@ -70,7 +70,7 @@ class CommandNSSetPrivate : public Command
class CommandNSSASetPrivate : public CommandNSSetPrivate
{
public:
- CommandNSSASetPrivate(Module *creator) : CommandNSSetPrivate(creator, "nickserv/saset/private", 2, "nickserv/saset/private")
+ CommandNSSASetPrivate(Module *creator) : CommandNSSetPrivate(creator, "nickserv/saset/private", 2)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 {ON | OFF}"));
diff --git a/modules/core/ns_set_secure.cpp b/modules/core/ns_set_secure.cpp
index 35baeec3b..31314a5a5 100644
--- a/modules/core/ns_set_secure.cpp
+++ b/modules/core/ns_set_secure.cpp
@@ -16,7 +16,7 @@
class CommandNSSetSecure : public Command
{
public:
- CommandNSSetSecure(Module *creator, const Anope::string &sname = "nickserv/set/secure", size_t min = 1, const Anope::string &cpermission = "") : Command(creator, sname, min, min + 1, cpermission)
+ CommandNSSetSecure(Module *creator, const Anope::string &sname = "nickserv/set/secure", size_t min = 1) : Command(creator, sname, min, min + 1)
{
this->SetDesc(_("Turn nickname security on or off"));
this->SetSyntax(_("{ON | OFF}"));
@@ -69,7 +69,7 @@ class CommandNSSetSecure : public Command
class CommandNSSASetSecure : public CommandNSSetSecure
{
public:
- CommandNSSASetSecure(Module *creator) : CommandNSSetSecure(creator, "nickserv/saset/secure", 2, "nickserv/saset/secure")
+ CommandNSSASetSecure(Module *creator) : CommandNSSetSecure(creator, "nickserv/saset/secure", 2)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 {ON | OFF}"));
diff --git a/modules/core/ns_suspend.cpp b/modules/core/ns_suspend.cpp
index 33eb5ad67..50cf039ce 100644
--- a/modules/core/ns_suspend.cpp
+++ b/modules/core/ns_suspend.cpp
@@ -16,7 +16,7 @@
class CommandNSSuspend : public Command
{
public:
- CommandNSSuspend(Module *creator) : Command(creator, "nickserv/suspend", 2, 2, "nickserv/suspend")
+ CommandNSSuspend(Module *creator) : Command(creator, "nickserv/suspend", 2, 2)
{
this->SetDesc(_("Suspend a given nick"));
this->SetSyntax(_("\037nickname\037 \037reason\037"));
@@ -92,7 +92,7 @@ class CommandNSSuspend : public Command
class CommandNSUnSuspend : public Command
{
public:
- CommandNSUnSuspend(Module *creator) : Command(creator, "nickserv/unsuspend", 1, 1, "nickserv/suspend")
+ CommandNSUnSuspend(Module *creator) : Command(creator, "nickserv/unsuspend", 1, 1)
{
this->SetDesc(_("Unsuspend a given nick"));
this->SetSyntax(_("\037nickname\037"));
diff --git a/modules/core/os_akill.cpp b/modules/core/os_akill.cpp
index 9a268d333..05602a746 100644
--- a/modules/core/os_akill.cpp
+++ b/modules/core/os_akill.cpp
@@ -370,7 +370,7 @@ class CommandOSAKill : public Command
return;
}
public:
- CommandOSAKill(Module *creator) : Command(creator, "operserv/akill", 1, 4, "operserv/akill")
+ CommandOSAKill(Module *creator) : Command(creator, "operserv/akill", 1, 4)
{
this->SetDesc(_("Manipulate the AKILL list"));
this->SetSyntax(_("ADD [+\037expiry\037] \037mask\037 \037reason\037"));
diff --git a/modules/core/os_chankill.cpp b/modules/core/os_chankill.cpp
index 54530d7af..9ce895c59 100644
--- a/modules/core/os_chankill.cpp
+++ b/modules/core/os_chankill.cpp
@@ -18,7 +18,7 @@ static service_reference<XLineManager> akills("xlinemanager/sgline");
class CommandOSChanKill : public Command
{
public:
- CommandOSChanKill(Module *creator) : Command(creator, "operserv/chankill", 2, 3, "operserv/chankill")
+ CommandOSChanKill(Module *creator) : Command(creator, "operserv/chankill", 2, 3)
{
this->SetDesc(_("AKILL all users on a specific channel"));
this->SetSyntax(_("[+\037expiry\037] \037channel\037 \037reason\037"));
diff --git a/modules/core/os_config.cpp b/modules/core/os_config.cpp
index ea7842b5d..1d1fead33 100644
--- a/modules/core/os_config.cpp
+++ b/modules/core/os_config.cpp
@@ -32,7 +32,7 @@ class CommandOSConfig : public Command
}
public:
- CommandOSConfig(Module *creator) : Command(creator, "operserv/config", 1, 4, "operserv/config")
+ CommandOSConfig(Module *creator) : Command(creator, "operserv/config", 1, 4)
{
this->SetDesc(_("View and change configuration file settings"));
this->SetSyntax(_("{\037MODIFY\037|\037VIEW\037} [\037block name\037 \037item name\037 \037item value\037]"));
diff --git a/modules/core/os_forbid.cpp b/modules/core/os_forbid.cpp
index 8c788006f..d4b4c2b41 100644
--- a/modules/core/os_forbid.cpp
+++ b/modules/core/os_forbid.cpp
@@ -77,7 +77,7 @@ class CommandOSForbid : public Command
{
service_reference<ForbidService> fs;
public:
- CommandOSForbid(Module *creator) : Command(creator, "operserv/forbid", 1, 5, "operserv/forbid"), fs("forbid")
+ CommandOSForbid(Module *creator) : Command(creator, "operserv/forbid", 1, 5), fs("forbid")
{
this->SetDesc(_("Forbid usage of nicknames, channels, and emails"));
this->SetSyntax(_("ADD {NICK|CHAN|EMAIL} [+\037expiry\037] \037entry\037\002 [\037reason\037]"));
diff --git a/modules/core/os_ignore.cpp b/modules/core/os_ignore.cpp
index 0713f928f..9f50ec967 100644
--- a/modules/core/os_ignore.cpp
+++ b/modules/core/os_ignore.cpp
@@ -233,7 +233,7 @@ class CommandOSIgnore : public Command
}
public:
- CommandOSIgnore(Module *creator) : Command(creator, "operserv/ignore", 1, 4, "operserv/ignore")
+ CommandOSIgnore(Module *creator) : Command(creator, "operserv/ignore", 1, 4)
{
this->SetDesc(_("Modify the Services ignore list"));
this->SetSyntax(_("ADD \037time\037 \037nick\037 \037reason\037"));
diff --git a/modules/core/os_jupe.cpp b/modules/core/os_jupe.cpp
index a0e06c272..a689b33e2 100644
--- a/modules/core/os_jupe.cpp
+++ b/modules/core/os_jupe.cpp
@@ -16,7 +16,7 @@
class CommandOSJupe : public Command
{
public:
- CommandOSJupe(Module *creator) : Command(creator, "operserv/jupe", 1, 2, "operserv/jupe")
+ CommandOSJupe(Module *creator) : Command(creator, "operserv/jupe", 1, 2)
{
this->SetDesc(_("\"Jupiter\" a server"));
this->SetSyntax(_("\037server\037 [\037reason\037]"));
diff --git a/modules/core/os_kick.cpp b/modules/core/os_kick.cpp
index cd36c118e..341ea1ee6 100644
--- a/modules/core/os_kick.cpp
+++ b/modules/core/os_kick.cpp
@@ -16,7 +16,7 @@
class CommandOSKick : public Command
{
public:
- CommandOSKick(Module *creator) : Command(creator, "operserv/kick", 3, 3, "operserv/kick")
+ CommandOSKick(Module *creator) : Command(creator, "operserv/kick", 3, 3)
{
this->SetDesc(_("Kick a user from a channel"));
this->SetSyntax(_("\037channel\037 \037user\037 \037reason\037"));
diff --git a/modules/core/os_kill.cpp b/modules/core/os_kill.cpp
index a3f9b658f..11a0636ef 100644
--- a/modules/core/os_kill.cpp
+++ b/modules/core/os_kill.cpp
@@ -16,7 +16,7 @@
class CommandOSKill : public Command
{
public:
- CommandOSKill(Module *creator) : Command(creator, "operserv/kill", 1, 2, "operserv/kill")
+ CommandOSKill(Module *creator) : Command(creator, "operserv/kill", 1, 2)
{
this->SetDesc(_("Kill a user"));
this->SetSyntax(_("\037user\037 [\037reason\037]"));
diff --git a/modules/core/os_mode.cpp b/modules/core/os_mode.cpp
index 41f870d64..b3e62ca25 100644
--- a/modules/core/os_mode.cpp
+++ b/modules/core/os_mode.cpp
@@ -16,7 +16,7 @@
class CommandOSMode : public Command
{
public:
- CommandOSMode(Module *creator) : Command(creator, "operserv/mode", 2, 2, "operserv/mode")
+ CommandOSMode(Module *creator) : Command(creator, "operserv/mode", 2, 2)
{
this->SetDesc(_("Change channel modes"));
this->SetSyntax(_("\037channel\037 \037modes\037"));
@@ -54,7 +54,7 @@ class CommandOSMode : public Command
class CommandOSUMode : public Command
{
public:
- CommandOSUMode(Module *creator) : Command(creator, "operserv/umode", 2, 2, "operserv/umode")
+ CommandOSUMode(Module *creator) : Command(creator, "operserv/umode", 2, 2)
{
this->SetDesc(_("Change channel or user modes"));
this->SetSyntax(_("\037user\037 \037modes\037"));
diff --git a/modules/core/os_modinfo.cpp b/modules/core/os_modinfo.cpp
index d62a7ebce..38d9cf905 100644
--- a/modules/core/os_modinfo.cpp
+++ b/modules/core/os_modinfo.cpp
@@ -43,11 +43,13 @@ class CommandOSModInfo : public Command
{
BotInfo *bi = it->second;
- for (command_map::const_iterator cit = bi->commands.begin(), cit_end = bi->commands.end(); cit != cit_end; ++cit)
+ for (BotInfo::command_map::const_iterator cit = bi->commands.begin(), cit_end = bi->commands.end(); cit != cit_end; ++cit)
{
- if (cit->second != s->name)
+ const Anope::string &c_name = cit->first;
+ const CommandInfo &info = cit->second;
+ if (info.name != s->name)
continue;
- source.Reply(_(" Command \002%s\002 on \002%s\002 is linked to \002%s\002"), cit->first.c_str(), bi->nick.c_str(), s->name.c_str());
+ source.Reply(_(" Command \002%s\002 on \002%s\002 is linked to \002%s\002"), c_name.c_str(), bi->nick.c_str(), s->name.c_str());
}
}
}
@@ -70,7 +72,7 @@ class CommandOSModInfo : public Command
class CommandOSModList : public Command
{
public:
- CommandOSModList(Module *creator) : Command(creator, "operserv/modlist", 0, 1, "operserv/modlist")
+ CommandOSModList(Module *creator) : Command(creator, "operserv/modlist", 0, 1)
{
this->SetDesc(_("List loaded modules"));
this->SetSyntax(_("[Core|3rd|protocol|encryption|supported]"));
diff --git a/modules/core/os_module.cpp b/modules/core/os_module.cpp
index fb56d322e..562e130aa 100644
--- a/modules/core/os_module.cpp
+++ b/modules/core/os_module.cpp
@@ -16,7 +16,7 @@
class CommandOSModLoad : public Command
{
public:
- CommandOSModLoad(Module *creator) : Command(creator, "operserv/modload", 1, 1, "operserv/modload")
+ CommandOSModLoad(Module *creator) : Command(creator, "operserv/modload", 1, 1)
{
this->SetDesc(_("Load a module"));
this->SetSyntax(_("\037modname\037"));
@@ -61,7 +61,7 @@ class CommandOSModLoad : public Command
class CommandOSModReLoad : public Command
{
public:
- CommandOSModReLoad(Module *creator) : Command(creator, "operserv/modreload", 1, 1, "operserv/modload")
+ CommandOSModReLoad(Module *creator) : Command(creator, "operserv/modreload", 1, 1)
{
this->SetDesc(_("Reload a module"));
this->SetSyntax(_("\037modname\037"));
@@ -131,7 +131,7 @@ class CommandOSModReLoad : public Command
class CommandOSModUnLoad : public Command
{
public:
- CommandOSModUnLoad(Module *creator) : Command(creator, "operserv/modunload", 1, 1, "operserv/modload")
+ CommandOSModUnLoad(Module *creator) : Command(creator, "operserv/modunload", 1, 1)
{
this->SetDesc(_("Un-Load a module"));
this->SetSyntax(_("\037modname\037"));
diff --git a/modules/core/os_news.cpp b/modules/core/os_news.cpp
index 6eac9db1f..9c9aae0a4 100644
--- a/modules/core/os_news.cpp
+++ b/modules/core/os_news.cpp
@@ -216,7 +216,7 @@ class NewsBase : public Command
return;
}
public:
- NewsBase(Module *creator, const Anope::string &newstype) : Command(creator, newstype, 1, 2, "operserv/news"), ns("news")
+ NewsBase(Module *creator, const Anope::string &newstype) : Command(creator, newstype, 1, 2), ns("news")
{
this->SetSyntax(_("ADD \037text\037"));
this->SetSyntax(_("DEL {\037num\037 | ALL}"));
diff --git a/modules/core/os_noop.cpp b/modules/core/os_noop.cpp
index 9fdaf0ebb..2eec522a3 100644
--- a/modules/core/os_noop.cpp
+++ b/modules/core/os_noop.cpp
@@ -16,7 +16,7 @@
class CommandOSNOOP : public Command
{
public:
- CommandOSNOOP(Module *creator) : Command(creator, "operserv/noop", 2, 2, "operserv/noop")
+ CommandOSNOOP(Module *creator) : Command(creator, "operserv/noop", 2, 2)
{
this->SetDesc(_("Temporarily remove all O:lines of a server remotely"));
this->SetSyntax(_("SET \037server\037"));
diff --git a/modules/core/os_oline.cpp b/modules/core/os_oline.cpp
index f07996542..adebc52a1 100644
--- a/modules/core/os_oline.cpp
+++ b/modules/core/os_oline.cpp
@@ -16,7 +16,7 @@
class CommandOSOLine : public Command
{
public:
- CommandOSOLine(Module *creator) : Command(creator, "operserv/oline", 2, 2, "operserv/oline")
+ CommandOSOLine(Module *creator) : Command(creator, "operserv/oline", 2, 2)
{
this->SetDesc(_("Give Operflags to a certain user"));
this->SetSyntax(_("\037nick\037 \037flags\037"));
diff --git a/modules/core/os_oper.cpp b/modules/core/os_oper.cpp
index 8c4745c2a..237c0b5bc 100644
--- a/modules/core/os_oper.cpp
+++ b/modules/core/os_oper.cpp
@@ -16,7 +16,7 @@
class CommandOSOper : public Command
{
public:
- CommandOSOper(Module *creator) : Command(creator, "operserv/oper", 1, 3, "operserv/oper")
+ CommandOSOper(Module *creator) : Command(creator, "operserv/oper", 1, 3)
{
this->SetDesc(_("View and change services operators"));
this->SetSyntax(_("ADD \037oper\037 \037type\037"));
diff --git a/modules/core/os_reload.cpp b/modules/core/os_reload.cpp
index 4d34a8ab1..d4d8eac7c 100644
--- a/modules/core/os_reload.cpp
+++ b/modules/core/os_reload.cpp
@@ -16,7 +16,7 @@
class CommandOSReload : public Command
{
public:
- CommandOSReload(Module *creator) : Command(creator, "operserv/reload", 0, 0, "operserv/reload")
+ CommandOSReload(Module *creator) : Command(creator, "operserv/reload", 0, 0)
{
this->SetDesc(_("Reload services' configuration file"));
this->SetSyntax("");
diff --git a/modules/core/os_session.cpp b/modules/core/os_session.cpp
index d39896608..990cd1b4b 100644
--- a/modules/core/os_session.cpp
+++ b/modules/core/os_session.cpp
@@ -266,7 +266,7 @@ class CommandOSSession : public Command
return;
}
public:
- CommandOSSession(Module *creator) : Command(creator, "operserv/session", 2, 2, "operserv/session")
+ CommandOSSession(Module *creator) : Command(creator, "operserv/session", 2, 2)
{
this->SetDesc(_("View the list of host sessions"));
this->SetSyntax(_("LIST \037threshold\037"));
diff --git a/modules/core/os_set.cpp b/modules/core/os_set.cpp
index 36c46e439..2a50f851c 100644
--- a/modules/core/os_set.cpp
+++ b/modules/core/os_set.cpp
@@ -168,7 +168,7 @@ class CommandOSSet : public Command
return;
}
public:
- CommandOSSet(Module *creator) : Command(creator, "operserv/set", 1, 2, "operserv/set")
+ CommandOSSet(Module *creator) : Command(creator, "operserv/set", 1, 2)
{
this->SetDesc(_("Set various global Services options"));
this->SetSyntax(_("\037option\037 \037setting\037"));
diff --git a/modules/core/os_shutdown.cpp b/modules/core/os_shutdown.cpp
index 47cb2e4cf..bc3a19353 100644
--- a/modules/core/os_shutdown.cpp
+++ b/modules/core/os_shutdown.cpp
@@ -16,7 +16,7 @@
class CommandOSQuit : public Command
{
public:
- CommandOSQuit(Module *creator) : Command(creator, "operserv/quit", 0, 0, "operserv/quit")
+ CommandOSQuit(Module *creator) : Command(creator, "operserv/quit", 0, 0)
{
this->SetDesc(_("Terminate Services WITHOUT saving"));
this->SetSyntax("");
@@ -45,7 +45,7 @@ class CommandOSQuit : public Command
class CommandOSRestart : public Command
{
public:
- CommandOSRestart(Module *creator) : Command(creator, "operserv/restart", 0, 0, "operserv/restart")
+ CommandOSRestart(Module *creator) : Command(creator, "operserv/restart", 0, 0)
{
this->SetDesc(_("Save databases and restart Services"));
this->SetSyntax("");
@@ -72,7 +72,7 @@ class CommandOSRestart : public Command
class CommandOSShutdown : public Command
{
public:
- CommandOSShutdown(Module *creator) : Command(creator, "operserv/shutdown", 0, 0, "operserv/shutdown")
+ CommandOSShutdown(Module *creator) : Command(creator, "operserv/shutdown", 0, 0)
{
this->SetDesc(_("Terminate services with save"));
this->SetSyntax("");
diff --git a/modules/core/os_stats.cpp b/modules/core/os_stats.cpp
index 2627a4538..2c20395d0 100644
--- a/modules/core/os_stats.cpp
+++ b/modules/core/os_stats.cpp
@@ -157,7 +157,7 @@ class CommandOSStats : public Command
}
public:
- CommandOSStats(Module *creator) : Command(creator, "operserv/stats", 0, 1, "operserv/stats"),
+ CommandOSStats(Module *creator) : Command(creator, "operserv/stats", 0, 1),
akills("xlinemanager/sgline"), snlines("xlinemanager/snline"), sqlines("xlinemanager/sqline"), szlines("xlinemanager/szline")
{
this->SetDesc(_("Show status of Services and network"));
diff --git a/modules/core/os_svsnick.cpp b/modules/core/os_svsnick.cpp
index 0e2199399..dc7c77a6c 100644
--- a/modules/core/os_svsnick.cpp
+++ b/modules/core/os_svsnick.cpp
@@ -16,7 +16,7 @@
class CommandOSSVSNick : public Command
{
public:
- CommandOSSVSNick(Module *creator) : Command(creator, "operserv/svsnick", 2, 2, "operserv/svsnick")
+ CommandOSSVSNick(Module *creator) : Command(creator, "operserv/svsnick", 2, 2)
{
this->SetDesc(_("Forcefully change a user's nickname"));
this->SetSyntax(_("\037nick\037 \037newnick\037"));
diff --git a/modules/core/os_sxline.cpp b/modules/core/os_sxline.cpp
index 27df5d5d1..f949cb7d2 100644
--- a/modules/core/os_sxline.cpp
+++ b/modules/core/os_sxline.cpp
@@ -278,7 +278,7 @@ class CommandOSSXLineBase : public Command
return;
}
public:
- CommandOSSXLineBase(Module *creator, const Anope::string &cmd, const Anope::string &perm) : Command(creator, cmd, 1, 3, perm)
+ CommandOSSXLineBase(Module *creator, const Anope::string &cmd) : Command(creator, cmd, 1, 3)
{
this->SetDesc(Anope::printf(_("Manipulate the %s list"), cmd.c_str()));
this->SetSyntax(_("ADD [+\037expiry\037] \037mask\037:\037reason\037"));
@@ -430,7 +430,7 @@ class CommandOSSNLine : public CommandOSSXLineBase
service_reference<XLineManager> snlines;
public:
- CommandOSSNLine(Module *creator) : CommandOSSXLineBase(creator, "SNLINE", "operserv/snline"), snlines("xlinemanager/snline")
+ CommandOSSNLine(Module *creator) : CommandOSSXLineBase(creator, "operserv/snline"), snlines("xlinemanager/snline")
{
}
@@ -580,7 +580,7 @@ class CommandOSSQLine : public CommandOSSXLineBase
service_reference<XLineManager> sqlines;
public:
- CommandOSSQLine(Module *creator) : CommandOSSXLineBase(creator, "SQLINE", "operserv/sqline"), sqlines("xlinemanager/sqline")
+ CommandOSSQLine(Module *creator) : CommandOSSXLineBase(creator, "operserv/sqline"), sqlines("xlinemanager/sqline")
{
}
@@ -736,7 +736,7 @@ class CommandOSSZLine : public CommandOSSXLineBase
service_reference<XLineManager> szlines;
public:
- CommandOSSZLine(Module *creator) : CommandOSSXLineBase(creator, "SZLINE", "operserv/szline"), szlines("xlinemanager/szline")
+ CommandOSSZLine(Module *creator) : CommandOSSXLineBase(creator, "operserv/szline"), szlines("xlinemanager/szline")
{
}
diff --git a/modules/core/os_update.cpp b/modules/core/os_update.cpp
index a128f711f..776835cf7 100644
--- a/modules/core/os_update.cpp
+++ b/modules/core/os_update.cpp
@@ -16,7 +16,7 @@
class CommandOSUpdate : public Command
{
public:
- CommandOSUpdate(Module *creator) : Command(creator, "operserv/update", 0, 0, "operserv/update")
+ CommandOSUpdate(Module *creator) : Command(creator, "operserv/update", 0, 0)
{
this->SetDesc(_("Force the Services databases to be updated immediately"));
this->SetSyntax("");
diff --git a/modules/extra/cs_set_misc.cpp b/modules/extra/cs_set_misc.cpp
index fc9ae9cf6..8f145ab88 100644
--- a/modules/extra/cs_set_misc.cpp
+++ b/modules/extra/cs_set_misc.cpp
@@ -15,7 +15,7 @@
class CommandCSSetMisc : public Command
{
public:
- CommandCSSetMisc(Module *creator, const Anope::string &cname = "chanserv/set/misc", const Anope::string &cpermission = "") : Command(creator, cname, 1, 2, cpermission)
+ CommandCSSetMisc(Module *creator, const Anope::string &cname = "chanserv/set/misc") : Command(creator, cname, 1, 2)
{
this->SetSyntax(_("\037channel\037 \037parameters\037"));
}
@@ -43,7 +43,7 @@ class CommandCSSetMisc : public Command
class CommandCSSASetMisc : public CommandCSSetMisc
{
public:
- CommandCSSASetMisc(Module *creator) : CommandCSSetMisc(creator, "chanserv/saset/misc", "chanserv/saset/misc")
+ CommandCSSASetMisc(Module *creator) : CommandCSSetMisc(creator, "chanserv/saset/misc")
{
}
};
diff --git a/modules/extra/hs_request.cpp b/modules/extra/hs_request.cpp
index f846b6167..7686794f5 100644
--- a/modules/extra/hs_request.cpp
+++ b/modules/extra/hs_request.cpp
@@ -134,7 +134,7 @@ class CommandHSRequest : public Command
class CommandHSActivate : public Command
{
public:
- CommandHSActivate(Module *creator) : Command(creator, "hostserv/activate", 1, 1, "hostserv/set")
+ CommandHSActivate(Module *creator) : Command(creator, "hostserv/activate", 1, 1)
{
this->SetDesc(_("Approve the requested vHost of a user"));
this->SetSyntax(_("\037nick\037"));
@@ -187,7 +187,7 @@ class CommandHSActivate : public Command
class CommandHSReject : public Command
{
public:
- CommandHSReject(Module *creator) : Command(creator, "hostserv/reject", 1, 2, "hostserv/set")
+ CommandHSReject(Module *creator) : Command(creator, "hostserv/reject", 1, 2)
{
this->SetDesc(_("Reject the requested vHost of a user"));
}
@@ -264,7 +264,7 @@ class HSListBase : public Command
return;
}
public:
- HSListBase(Module *creator, const Anope::string &cmd, int min, int max) : Command(creator, cmd, min, max, "hostserv/set")
+ HSListBase(Module *creator, const Anope::string &cmd, int min, int max) : Command(creator, cmd, min, max)
{
}
};
diff --git a/modules/extra/m_async_commands.cpp b/modules/extra/m_async_commands.cpp
index 84d7a4f41..814c86c92 100644
--- a/modules/extra/m_async_commands.cpp
+++ b/modules/extra/m_async_commands.cpp
@@ -46,7 +46,7 @@ class AsynchCommandMutex : public CommandMutex
return;
}
- if (!command->permission.empty() && !u->HasCommand(command->permission))
+ if (!this->source.permission.empty() && !u->HasCommand(this->source.permission))
{
u->SendMessage(bi, ACCESS_DENIED);
Log(LOG_COMMAND, "denied", bi) << "Access denied for user " << u->GetMask() << " with command " << command;
diff --git a/modules/extra/ns_set_misc.cpp b/modules/extra/ns_set_misc.cpp
index 47506ce89..f0ee269cc 100644
--- a/modules/extra/ns_set_misc.cpp
+++ b/modules/extra/ns_set_misc.cpp
@@ -16,7 +16,7 @@
class CommandNSSetMisc : public Command
{
public:
- CommandNSSetMisc(Module *creator, const Anope::string &cname = "nickserv/set/misc", const Anope::string &cpermission = "", size_t min = 1) : Command(creator, cname, min, min + 1, cpermission)
+ CommandNSSetMisc(Module *creator, const Anope::string &cname = "nickserv/set/misc", size_t min = 1) : Command(creator, cname, min, min + 1)
{
this->SetSyntax(_("\037parameter\037"));
}
@@ -52,7 +52,7 @@ class CommandNSSetMisc : public Command
class CommandNSSASetMisc : public CommandNSSetMisc
{
public:
- CommandNSSASetMisc(Module *creator) : CommandNSSetMisc(creator, "nickserv/saset/misc", "nickserv/saset/misc", 2)
+ CommandNSSASetMisc(Module *creator) : CommandNSSetMisc(creator, "nickserv/saset/misc", 2)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 \037parameter\037"));
diff --git a/modules/extra/os_defcon.cpp b/modules/extra/os_defcon.cpp
index 26120feff..ea513e1dc 100644
--- a/modules/extra/os_defcon.cpp
+++ b/modules/extra/os_defcon.cpp
@@ -163,7 +163,7 @@ class CommandOSDefcon : public Command
}
public:
- CommandOSDefcon(Module *creator) : Command(creator, "operserv/defcon", 1, 1, "operserv/defcon")
+ CommandOSDefcon(Module *creator) : Command(creator, "operserv/defcon", 1, 1)
{
this->SetDesc(_("Manipulate the DefCon system"));
this->SetSyntax(_("[\0021\002|\0022\002|\0023\002|\0024\002|\0025\002]"));
diff --git a/src/bots.cpp b/src/bots.cpp
index 13947c0bb..bff2adac8 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -203,7 +203,7 @@ void BotInfo::OnMessage(User *u, const Anope::string &message)
{
std::vector<Anope::string> params = BuildStringVector(message);
- command_map::iterator it = this->commands.end();
+ BotInfo::command_map::iterator it = this->commands.end();
unsigned count = 0;
for (unsigned max = params.size(); it == this->commands.end() && max > 0; --max)
{
@@ -222,11 +222,12 @@ void BotInfo::OnMessage(User *u, const Anope::string &message)
return;
}
- service_reference<Command> c(it->second);
+ CommandInfo &info = it->second;
+ service_reference<Command> c(info.name);
if (!c)
{
u->SendMessage(this, _("Unknown command \002%s\002. \"%s%s HELP\" for help."), message.c_str(), Config->UseStrictPrivMsgString.c_str(), this->nick.c_str());
- Log(this) << "Command " << it->first << " exists on me, but its service " << it->second << " was not found!";
+ Log(this) << "Command " << it->first << " exists on me, but its service " << info.name << " was not found!";
return;
}
@@ -253,6 +254,7 @@ void BotInfo::OnMessage(User *u, const Anope::string &message)
source.owner = this;
source.service = this;
source.command = it->first;
+ source.permission = info.permission;
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnPreCommand, OnPreCommand(source, c, params));
@@ -271,7 +273,7 @@ void BotInfo::OnMessage(User *u, const Anope::string &message)
}
// If the command requires a permission, and they aren't registered or don't have the required perm, DENIED
- if (!c->permission.empty() && !u->HasCommand(c->permission))
+ if (!info.permission.empty() && !u->HasCommand(info.permission))
{
u->SendMessage(this, ACCESS_DENIED);
Log(LOG_COMMAND, "denied", this) << "Access denied for user " << u->GetMask() << " with command " << c->name;
@@ -289,3 +291,28 @@ void BotInfo::OnMessage(User *u, const Anope::string &message)
}
}
+/** Link a command name to a command in services
+ * @param cname The command name
+ * @param sname The service name
+ * @param permission Permission required to execute the command, if any
+ */
+void BotInfo::SetCommand(const Anope::string &cname, const Anope::string &sname, const Anope::string &permission)
+{
+ CommandInfo ci;
+ ci.name = sname;
+ ci.permission = permission;
+ this->commands[cname] = ci;
+}
+
+/** Get command info for a command
+ * @param cname The command name
+ * @return A struct containing service name and permission
+ */
+CommandInfo *BotInfo::GetCommand(const Anope::string &cname)
+{
+ command_map::iterator it = this->commands.find(cname);
+ if (it != this->commands.end())
+ return &it->second;
+ return NULL;
+}
+
diff --git a/src/command.cpp b/src/command.cpp
index 0663ec2fa..041551bd4 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -56,7 +56,7 @@ void CommandSource::DoReply()
}
}
-Command::Command(Module *o, const Anope::string &sname, size_t min_params, size_t max_params, const Anope::string &spermission) : Service(o, sname), Flags<CommandFlag>(CommandFlagStrings), MaxParams(max_params), MinParams(min_params), permission(spermission), module(owner)
+Command::Command(Module *o, const Anope::string &sname, size_t min_params, size_t max_params) : Service(o, sname), Flags<CommandFlag>(CommandFlagStrings), MaxParams(max_params), MinParams(min_params), module(owner)
{
}
@@ -113,8 +113,3 @@ void Command::OnSyntaxError(CommandSource &source, const Anope::string &subcomma
source.Reply(MORE_INFO, Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str(), source.command.c_str());
}
-void Command::SetPermission(const Anope::string &reststr)
-{
- this->permission = reststr;
-}
-
diff --git a/src/config.cpp b/src/config.cpp
index ae27d7273..c59188bd7 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -871,6 +871,7 @@ static bool DoCommands(ServerConfig *config, const Anope::string &, const Anope:
Anope::string service = values[0].GetValue();
Anope::string name = values[1].GetValue();
Anope::string command = values[2].GetValue();
+ Anope::string permission = values[3].GetValue();
ValueItem vi(service);
if (!ValidateNotEmpty(config, "command", "service", vi))
@@ -891,7 +892,7 @@ static bool DoCommands(ServerConfig *config, const Anope::string &, const Anope:
if (bi->commands.count(name))
throw ConfigException("Command name " + name + " already exists on " + bi->nick);
- bi->commands[name] = command;
+ bi->SetCommand(name, command, permission);
return true;
}
@@ -1127,7 +1128,6 @@ ConfigItems::ConfigItems(ServerConfig *conf)
{"nickserv", "releasetimeout", "0", new ValueContainerTime(&conf->NSReleaseTimeout), DT_TIME, ValidateNotZero},
{"nickserv", "allowkillimmed", "no", new ValueContainerBool(&conf->NSAllowKillImmed), DT_BOOLEAN | DT_NORELOAD, NoValidation},
{"nickserv", "nogroupchange", "no", new ValueContainerBool(&conf->NSNoGroupChange), DT_BOOLEAN, NoValidation},
- {"nickserv", "listopersonly", "no", new ValueContainerBool(&conf->NSListOpersOnly), DT_BOOLEAN, NoValidation},
{"nickserv", "listmax", "0", new ValueContainerUInt(&conf->NSListMax), DT_UINTEGER, ValidateNotZero},
{"nickserv", "guestnickprefix", "", new ValueContainerString(&conf->NSGuestNickPrefix), DT_STRING, ValidateGuestPrefix},
{"nickserv", "secureadmins", "no", new ValueContainerBool(&conf->NSSecureAdmins), DT_BOOLEAN, NoValidation},
@@ -1154,7 +1154,6 @@ ConfigItems::ConfigItems(ServerConfig *conf)
{"chanserv", "autokickmax", "0", new ValueContainerUInt(&conf->CSAutokickMax), DT_UINTEGER, ValidateChanServ},
{"chanserv", "autokickreason", "User has been banned from the channel", new ValueContainerString(&conf->CSAutokickReason), DT_STRING, ValidateChanServ},
{"chanserv", "inhabit", "0", new ValueContainerTime(&conf->CSInhabit), DT_TIME, ValidateChanServ},
- {"chanserv", "listopersonly", "no", new ValueContainerBool(&conf->CSListOpersOnly), DT_BOOLEAN, ValidateChanServ},
{"chanserv", "listmax", "0", new ValueContainerUInt(&conf->CSListMax), DT_UINTEGER, ValidateChanServ},
{"chanserv", "opersonly", "no", new ValueContainerBool(&conf->CSOpersOnly), DT_BOOLEAN, ValidateChanServ},
{"memoserv", "name", "", new ValueContainerString(&conf->MemoServ), DT_STRING, NoValidation},
@@ -1242,9 +1241,9 @@ ConfigItems::ConfigItems(ServerConfig *conf)
{DT_STRING, DT_STRING, DT_INTEGER, DT_BOOLEAN, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_BOOLEAN, DT_BOOLEAN},
InitLogs, DoLogs, DoneLogs},
{"command",
- {"service", "name", "command", ""},
- {"", "", "", ""},
- {DT_STRING, DT_STRING, DT_STRING},
+ {"service", "name", "command", "permission", ""},
+ {"", "", "", "", ""},
+ {DT_STRING, DT_STRING, DT_STRING, DT_STRING},
InitCommands, DoCommands, DoneCommands},
{"",
{""},