From e2e581f0d3d5d844dc4b5210f566e5a5571a0570 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 26 Feb 2006 11:48:09 +0000 Subject: Server* Srv marked static or moved to private member of module class in all modules, paves way for removal of static-build-munging-regexp that breaks +eI git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3330 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_chghost.cpp | 3 +-- src/modules/m_devoice.cpp | 2 +- src/modules/m_globalload.cpp | 2 +- src/modules/m_globops.cpp | 2 +- src/modules/m_helpop.cpp | 5 ++--- src/modules/m_knock.cpp | 2 +- src/modules/m_nicklock.cpp | 2 +- src/modules/m_operchans.cpp | 4 +--- src/modules/m_operlevels.cpp | 3 +-- src/modules/m_opermd5.cpp | 3 +-- src/modules/m_opermotd.cpp | 4 ++-- src/modules/m_park.cpp | 2 +- src/modules/m_randquote.cpp | 4 ++-- src/modules/m_remove.cpp | 39 ++++++++++++++++++++++++--------------- src/modules/m_restrictchans.cpp | 3 +-- src/modules/m_sajoin.cpp | 2 +- src/modules/m_samode.cpp | 2 +- src/modules/m_sanick.cpp | 2 +- src/modules/m_sapart.cpp | 2 +- src/modules/m_saquit.cpp | 2 +- src/modules/m_sethost.cpp | 2 +- src/modules/m_setident.cpp | 2 +- src/modules/m_setidle.cpp | 2 +- src/modules/m_setname.cpp | 2 +- src/modules/m_spanningtree.cpp | 2 +- src/modules/m_spy.cpp | 2 +- src/modules/m_testcommand.cpp | 2 +- src/modules/m_timedbans.cpp | 2 +- src/modules/m_uninvite.cpp | 2 +- src/modules/m_userip.cpp | 2 +- src/modules/m_watch.cpp | 2 +- 31 files changed, 57 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 8a2e696bc..8cfc515cd 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -25,8 +25,7 @@ using namespace std; /* $ModDesc: Provides support for the CHGHOST command */ -Server *Srv; - +static Server *Srv; class cmd_chghost : public command_t { diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp index e0ded1712..3ea72de39 100644 --- a/src/modules/m_devoice.cpp +++ b/src/modules/m_devoice.cpp @@ -28,7 +28,7 @@ using namespace std; #include "channels.h" #include "modules.h" -Server *Srv; +static Server *Srv; class cmd_devoice : public command_t { diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index 5d3ed7656..18258e3ba 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -29,7 +29,6 @@ using namespace std; #include "modules.h" #include "inspircd.h" -Server *Srv; extern InspIRCd *ServerInstance; class cmd_gloadmodule : public command_t @@ -80,6 +79,7 @@ class ModuleGlobalLoad : public Module { cmd_gloadmodule *mycommand; cmd_gunloadmodule *mycommand2; + Server *Srv; public: ModuleGlobalLoad(Server* Me) : Module::Module(Me) { diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp index 3d6e2d12e..ec729f720 100644 --- a/src/modules/m_globops.cpp +++ b/src/modules/m_globops.cpp @@ -26,7 +26,7 @@ using namespace std; /* $ModDesc: Provides support for unreal-style GLOBOPS and umode +g */ -Server *Srv; +static Server *Srv; class cmd_globops : public command_t { diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index b3b3d113a..a76cb87a8 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -22,9 +22,8 @@ using namespace std; #include "helperfuncs.h" // Global Vars -/* XXX - should all this be marked static? clear the global namespace, etc. */ -ConfigReader *helpop; -Server *Srv; +static ConfigReader *helpop; +static Server *Srv; void handle_helpop(char**, int, userrec*); bool do_helpop(char**, int, userrec*); diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index fa4ee68bb..2a9fd30fa 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -25,7 +25,7 @@ using namespace std; /* $ModDesc: Provides support for /KNOCK and mode +K */ -Server *Srv; +static Server *Srv; class cmd_knock : public command_t { diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 4bdbaa8f0..0f0b87445 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -26,7 +26,7 @@ using namespace std; /* $ModDesc: Provides the NICKLOCK command, allows an oper to chage a users nick and lock them to it until they quit */ -Server *Srv; +static Server *Srv; class cmd_nicklock : public command_t { diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index fb181d1f5..21e360b1d 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -24,11 +24,9 @@ using namespace std; /* $ModDesc: Provides support for oper-only chans via the +O channel mode */ -Server *Srv; - - class ModuleOperChans : public Module { + Server* Srv; public: ModuleOperChans(Server* Me) : Module::Module(Me) diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index bf5596330..b598dec1f 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -8,13 +8,12 @@ using namespace std; /* $ModDesc: Gives each oper type a 'level', cannot kill opers 'above' your level. */ -Server *Srv; - class ModuleOperLevels : public Module { private: + Server* Srv; ConfigReader* conf; public: diff --git a/src/modules/m_opermd5.cpp b/src/modules/m_opermd5.cpp index da26d37cc..9dd2960ff 100644 --- a/src/modules/m_opermd5.cpp +++ b/src/modules/m_opermd5.cpp @@ -44,8 +44,6 @@ struct MD5Context { word32 in[16]; }; -Server *Srv; - void MD5Init(struct MD5Context *context); void MD5Update(struct MD5Context *context, byte const *buf, int len); void MD5Final(byte digest[16], struct MD5Context *context); @@ -279,6 +277,7 @@ class cmd_mkpasswd : public command_t class ModuleOperMD5 : public Module { + Server* Srv; cmd_mkpasswd* mycommand; public: diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index 6ea7af048..0cf4efdc0 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -10,8 +10,8 @@ using namespace std; /* $ModDesc: Shows a message to opers after oper-up, adds /opermotd */ -FileReader* opermotd; -Server* Srv; +static FileReader* opermotd; +static Server* Srv; void LoadOperMOTD() { diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp index 8c529ba97..a5c123a5d 100644 --- a/src/modules/m_park.cpp +++ b/src/modules/m_park.cpp @@ -42,7 +42,7 @@ class parkedinfo time_t parktime; }; -Server *Srv; +static Server *Srv; typedef std::vector awaylog; typedef std::vector parkinfo; parkinfo pinfo; diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index 6fca3c5b0..7dfd44da3 100644 --- a/src/modules/m_randquote.cpp +++ b/src/modules/m_randquote.cpp @@ -24,8 +24,8 @@ using namespace std; #include "modules.h" #include "helperfuncs.h" -Server *Srv; -FileReader *quotes = NULL; +static Server *Srv; +static FileReader *quotes = NULL; std::string q_file = ""; std::string prefix = ""; diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index afd02d0f9..2c7fd8b9d 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -17,24 +17,33 @@ using namespace std; * eg: +h can remove +hv and users with no modes. +a can remove +aohv and users with no modes. */ -Server *Srv; +static Server *Srv; /* This little function just converts a chanmode character (~ & @ & +) into an integer (5 4 3 2 1) */ /* XXX - this could be handy in the core, so it can be used elsewhere */ -int chartolevel(std::string privs) -{ - /* XXX - if we just passed this a char, we could do a switch. Look nicer, really. */ - - if (privs == "~") - return 5; - else if (privs == "&") - return 4; - else if (privs == "@") - return 3; - else if (privs == "%") - return 2; - else - return 1; +int chartolevel(std::string &privs) +{1 + const char* n = privs.c_str(); + + switch (*n) + { + case '~': + return 5; + break; + case '&': + return 4; + break; + case '@': + return 3; + break; + case '%': + return 2; + break; + default: + return 1; + break; + } + return 1; } class cmd_remove : public command_t diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index d4fbdfbb5..b6d34bf25 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -25,10 +25,9 @@ using namespace std; /* $ModDesc: Only opers may create new channels if this module is loaded */ -Server *Srv; - class ModuleRestrictChans : public Module { + Server* Srv; std::map allowchans; diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index 6883ee5c4..2471efe91 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -25,7 +25,7 @@ using namespace std; /* $ModDesc: Provides support for unreal-style SAJOIN command */ -Server *Srv; +static Server *Srv; class cmd_sajoin : public command_t { diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index 440d0301e..afcc3082c 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -36,7 +36,7 @@ using namespace std; #include "channels.h" #include "modules.h" -Server *Srv; +static Server *Srv; class cmd_samode : public command_t { diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 618b3226b..8fbf8dd5a 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -24,7 +24,7 @@ using namespace std; /* $ModDesc: Provides support for SANICK command */ -Server *Srv; +static Server *Srv; class cmd_sanick : public command_t { diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index 7c3142cdd..33b323fea 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -25,7 +25,7 @@ using namespace std; /* $ModDesc: Provides support for unreal-style SAPART command */ -Server *Srv; +static Server *Srv; class cmd_sapart : public command_t { diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 212889e80..e5722bffe 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -34,7 +34,7 @@ using namespace std; /* $ModDesc: Provides support for an SAQUIT command, exits user with a reason */ -Server *Srv; +static Server *Srv; class cmd_saquit : public command_t { diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 7bc01e118..7244ba6de 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -25,7 +25,7 @@ using namespace std; /* $ModDesc: Provides support for the SETHOST command */ -Server *Srv; +static Server *Srv; class cmd_sethost : public command_t { diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp index 3af511419..4ec8e0fdb 100644 --- a/src/modules/m_setident.cpp +++ b/src/modules/m_setident.cpp @@ -4,7 +4,7 @@ /* $ModDesc: Provides support for the SETIDENT command */ -Server *Srv; +static Server *Srv; class cmd_setident : public command_t { diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index fc8ad9347..af0bc2c64 100644 --- a/src/modules/m_setidle.cpp +++ b/src/modules/m_setidle.cpp @@ -25,7 +25,7 @@ using namespace std; /* $ModDesc: Allows opers to set their idle time */ -Server *Srv = NULL; +static Server *Srv = NULL; class cmd_setidle : public command_t { diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index 0182fa7cc..b82f6de14 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -25,7 +25,7 @@ using namespace std; /* $ModDesc: Provides support for the SETNAME command */ -Server *Srv; +static Server *Srv; class cmd_setname : public command_t { diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 7bcb35a62..f879aecdb 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -109,7 +109,7 @@ class TreeSocket; */ TreeServer *TreeRoot; -Server* Srv; +static Server* Srv; /* This hash_map holds the hash equivalent of the server * tree, used for rapid linear lookups. diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp index 5d100528a..7e652b31c 100644 --- a/src/modules/m_spy.cpp +++ b/src/modules/m_spy.cpp @@ -55,7 +55,7 @@ using namespace std; #endif -Server *Srv; +static Server *Srv; extern ServerConfig* Config; extern InspIRCd* ServerInstance; diff --git a/src/modules/m_testcommand.cpp b/src/modules/m_testcommand.cpp index 205e285cf..ccb5bde6d 100644 --- a/src/modules/m_testcommand.cpp +++ b/src/modules/m_testcommand.cpp @@ -23,7 +23,7 @@ using namespace std; /* $ModDesc: Povides a proof-of-concept test /WOOT command */ -Server *Srv; +static Server *Srv; class cmd_woot : public command_t { diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index c9e9c243f..0af4b7d72 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -26,7 +26,7 @@ using namespace std; #include "helperfuncs.h" #include "hashcomp.h" -Server *Srv; +static Server *Srv; class TimedBan { diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp index 8e92cb0c6..e9c2078cb 100644 --- a/src/modules/m_uninvite.cpp +++ b/src/modules/m_uninvite.cpp @@ -25,7 +25,7 @@ using namespace std; #include "helperfuncs.h" #include "message.h" -Server *Srv; +static Server *Srv; class cmd_uninvite : public command_t { diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index 4ffeca3d5..fe6435b9d 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -25,7 +25,7 @@ using namespace std; /* $ModDesc: Provides support for USERIP command */ -Server *Srv; +static Server *Srv; class cmd_userip : public command_t { diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index a852db9c4..934a487b9 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -27,7 +27,7 @@ using namespace std; /* $ModDesc: Provides support for the /watch command */ -Server *Srv; +static Server *Srv; class watchentry { -- cgit v1.2.3