]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
None of the modules use an extern InspIRCd* any more
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 11 Aug 2006 00:46:41 +0000 (00:46 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 11 Aug 2006 00:46:41 +0000 (00:46 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4863 e03df62e-2008-0410-955e-edbf42e46eb7

68 files changed:
src/modules/m_alias.cpp
src/modules/m_banexception.cpp
src/modules/m_blockamsg.cpp
src/modules/m_blockcaps.cpp
src/modules/m_blockcolor.cpp
src/modules/m_botmode.cpp
src/modules/m_cban.cpp
src/modules/m_censor.cpp
src/modules/m_cgiirc.cpp
src/modules/m_chanfilter.cpp
src/modules/m_chanprotect.cpp
src/modules/m_check.cpp
src/modules/m_chghost.cpp
src/modules/m_chgident.cpp
src/modules/m_cloaking.cpp
src/modules/m_conn_lusers.cpp
src/modules/m_conn_waitpong.cpp
src/modules/m_connflood.cpp
src/modules/m_devoice.cpp
src/modules/m_filter.cpp
src/modules/m_globops.cpp
src/modules/m_helpop.cpp
src/modules/m_hostchange.cpp
src/modules/m_httpd.cpp
src/modules/m_httpd_stats.cpp
src/modules/m_ident.cpp
src/modules/m_joinflood.cpp
src/modules/m_kicknorejoin.cpp
src/modules/m_knock.cpp
src/modules/m_messageflood.cpp
src/modules/m_nicklock.cpp
src/modules/m_noctcp.cpp
src/modules/m_noinvite.cpp
src/modules/m_nokicks.cpp
src/modules/m_nonicks.cpp
src/modules/m_nonotice.cpp
src/modules/m_operchans.cpp
src/modules/m_operjoin.cpp
src/modules/m_operlevels.cpp
src/modules/m_override.cpp
src/modules/m_park.cpp
src/modules/m_redirect.cpp
src/modules/m_remove.cpp
src/modules/m_safelist.cpp
src/modules/m_sajoin.cpp
src/modules/m_samode.cpp
src/modules/m_sanick.cpp
src/modules/m_sapart.cpp
src/modules/m_saquit.cpp
src/modules/m_securelist.cpp
src/modules/m_services.cpp
src/modules/m_services_account.cpp
src/modules/m_sethost.cpp
src/modules/m_setident.cpp
src/modules/m_setidle.cpp
src/modules/m_setname.cpp
src/modules/m_showwhois.cpp
src/modules/m_spanningtree.cpp
src/modules/m_spy.cpp
src/modules/m_sslmodes.cpp
src/modules/m_stripcolor.cpp
src/modules/m_swhois.cpp
src/modules/m_testcommand.cpp
src/modules/m_timedbans.cpp
src/modules/m_tline.cpp
src/modules/m_uninvite.cpp
src/modules/m_userip.cpp
src/modules/m_watch.cpp

index 399ad2ae5a90080be4c0fd28b9d3197d435edf42..3e09aef2f8bca736ac7c685c237a904c4340041f 100644 (file)
@@ -26,7 +26,7 @@ using namespace std;
 
 /* $ModDesc: Provides aliases of commands. */
 
-extern InspIRCd* ServerInstance;
+
 
 class Alias : public classbase
 {
index 4d817f43bfcdcdd8d94ea901f1326dcc89eeded1..36021a6a4a131b18b97d22a1c348d8bedb7a6ee7 100644 (file)
@@ -18,7 +18,7 @@
 // The +e channel mode takes a nick!ident@host, glob patterns allowed,
 // and if a user matches an entry on the +e list then they can join the channel, overriding any (+b) bans set on them
 
-extern InspIRCd* ServerInstance;
+
 
 class BanException : public ListModeBase
 {
index 78b7d278fe3ee1e6087cf342e5e86c1ce77ff253..856b4bd882b8773a4d0a73aa597217573f6542cc 100644 (file)
@@ -30,7 +30,7 @@
 /* $ModDesc: Attempt to block /amsg, at least some of the irritating mIRC scripts. */
 
 extern time_t TIME;
-extern InspIRCd* ServerInstance;
+
 
 enum BlockAction { IBLOCK_KILL, IBLOCK_KILLOPERS, IBLOCK_NOTICE, IBLOCK_NOTICEOPERS, IBLOCK_SILENT };
 
index d023bc733f751d1aa06c2f451a32b71a0c87beed..655643ed8c3a4c516ca5f7e3efb7ace6cc2884bf 100644 (file)
@@ -24,7 +24,7 @@
 
 /* $ModDesc: Provides support for channel mode +P to block all-CAPS channel messages and notices */
 
-extern InspIRCd* ServerInstance;
+
 
 class BlockCaps : public ModeHandler
 {
index 92919d15360489128e1e057f538ea36b397a0b38..ddba6ee2aaff82d53087a855cdb5ca3d6f9dce07 100644 (file)
@@ -26,7 +26,7 @@ using namespace std;
 
 /* $ModDesc: Provides support for unreal-style channel mode +c */
 
-extern InspIRCd* ServerInstance;
+
 
 class BlockColor : public ModeHandler
 {
index a2c866b7ce2db57ab98bb53965981e42ad594e73..eabe8a0b4e25745fd6702095b5796bc71c105f70 100644 (file)
@@ -27,7 +27,7 @@ using namespace std;
 
 /* $ModDesc: Provides support for unreal-style umode +B */
 
-extern InspIRCd* ServerInstance;
+
 
 class BotMode : public ModeHandler
 {
index 10193a2ad992a6b0bfa079abd6dcaa9ea828ff96..eba40ee0c803dae8cea8108591e8a7d59ea2488e 100644 (file)
@@ -30,7 +30,7 @@
 
 /* $ModDesc: Gives /cban, aka C:lines. Think Q:lines, for channels. */
 
-extern InspIRCd* ServerInstance;
+
 
 class CBan : public classbase
 {
@@ -126,6 +126,11 @@ class cmd_cban : public command_t
        }
 };
 
+bool CBanComp(const CBan &ban1, const CBan &ban2)
+{
+       return ((ban1.set_on + ban1.length) < (ban2.set_on + ban2.length));
+}
+
 class ModuleCBan : public Module
 {
        cmd_cban* mycommand;
@@ -203,60 +208,55 @@ class ModuleCBan : public Module
        {
                return Version(1,0,0,1,VF_VENDOR);
        }
-};
 
-std::string EncodeCBan(const CBan &ban)
-{
-       std::ostringstream stream;      
-       stream << ban.chname << " " << ban.set_by << " " << ban.set_on << " " << ban.length << " " << ban.reason;
-       return stream.str();    
-}
+       std::string EncodeCBan(const CBan &ban)
+       {
+               std::ostringstream stream;      
+               stream << ban.chname << " " << ban.set_by << " " << ban.set_on << " " << ban.length << " " << ban.reason;
+               return stream.str();    
+       }
 
-CBan DecodeCBan(const std::string &data)
-{
-       CBan res;
-       std::istringstream stream(data);
-       stream >> res.chname;
-       stream >> res.set_by;
-       stream >> res.set_on;
-       stream >> res.length;
-       res.reason = stream.str();
+       CBan DecodeCBan(const std::string &data)
+       {
+               CBan res;
+               std::istringstream stream(data);
+               stream >> res.chname;
+               stream >> res.set_by;
+               stream >> res.set_on;
+               stream >> res.length;
+               res.reason = stream.str();
        
-       return res;
-}
-
-bool CBanComp(const CBan &ban1, const CBan &ban2)
-{
-       return ((ban1.set_on + ban1.length) < (ban2.set_on + ban2.length));
-}
-
-void ExpireBans()
-{
-       bool go_again = true;
+               return res;
+       }
 
-       while (go_again)
+       void ExpireBans()
        {
-               go_again = false;
+               bool go_again = true;
 
-               for (cbanlist::iterator iter = cbans.begin(); iter != cbans.end(); iter++)
+               while (go_again)
                {
-                       /* 0 == permanent, don't mess with them! -- w00t */
-                       if (iter->length != 0)
+                       go_again = false;
+       
+                       for (cbanlist::iterator iter = cbans.begin(); iter != cbans.end(); iter++)
                        {
-                               if (iter->set_on + iter->length <= TIME)
+                               /* 0 == permanent, don't mess with them! -- w00t */
+                               if (iter->length != 0)
                                {
-                                       log(DEBUG, "m_cban.so: Ban on %s expired, removing...", iter->chname.c_str());
-                                       ServerInstance->WriteOpers("*** %li second CBAN on %s (%s) set %u seconds ago expired", iter->length, iter->chname.c_str(), iter->reason.c_str(), TIME - iter->set_on);
-                                       cbans.erase(iter);
-                                       go_again = true;
+                                       if (iter->set_on + iter->length <= TIME)
+                                       {
+                                               log(DEBUG, "m_cban.so: Ban on %s expired, removing...", iter->chname.c_str());
+                                               ServerInstance->WriteOpers("*** %li second CBAN on %s (%s) set %u seconds ago expired", iter->length, iter->chname.c_str(), iter->reason.c_str(), TIME - iter->set_on);
+                                               cbans.erase(iter);
+                                               go_again = true;
+                                       }
                                }
+       
+                               if (go_again == true)
+                                       break;
                        }
-
-                       if (go_again == true)
-                               break;
                }
        }
-}
+};
 
 class ModuleCBanFactory : public ModuleFactory
 {
index 60cc6dc392628728404bdec89e23127cb096f37a..796224890138ae3eaec432972421fbfa66c99a8d 100644 (file)
@@ -28,7 +28,7 @@ typedef std::map<irc::string,irc::string> censor_t;
 
 /* $ModDesc: Provides user and channel +G mode */
 
-extern InspIRCd* ServerInstance;
+
 
 class CensorException : public ModuleException
 {
index 36a432cfe60aeb6a2bb1daaf7dfa76807c8bec70..05f34d03763bd5457c4b2b3d75138cb84f200241 100644 (file)
@@ -29,7 +29,7 @@
 
 /* $ModDesc: Change user's hosts connecting from known CGI:IRC hosts */
 
-extern InspIRCd* ServerInstance;
+
 
 enum CGItype { PASS, IDENT, PASSFIRST, IDENTFIRST };
 
index 73c9d4f47b376f1bf4ebd0268dff3e0d60e4d80a..138df4aa9671a3d0e50075d3413b601203c72505 100644 (file)
@@ -29,7 +29,7 @@ using namespace std;
 
 /* $ModDesc: Provides channel-specific censor lists (like mode +G but varies from channel to channel) */
 
-extern InspIRCd* ServerInstance;
+
 
 class ChanFilter : public ListModeBase
 {
index dbf2f6e7de208480a1634596b0d8641eb7568228..c9cdc2f600c8abc082ab5ca993965ed0da9646fd 100644 (file)
@@ -23,7 +23,7 @@
 
 /* $ModDesc: Provides channel modes +a and +q */
 
-extern InspIRCd* ServerInstance;
+
 
 const char* fakevalue = "on";
 
index b8dc89f7cff2560c0243035fa80b7a548f218192..54abe0940557617cedd728776b3a698a34b831ac 100644 (file)
@@ -26,7 +26,7 @@ using namespace std;
 
 /* $ModDesc: Provides the /check command to retrieve information on a user, channel, or IP address */
 
-extern InspIRCd* ServerInstance;
+
 
 class cmd_check : public command_t
 {
index b4d7e53c85981e4c4f970cf7233dba861c602908..378c05ece4c34e1a7e1ad921b9d1026ede0d7391 100644 (file)
@@ -26,7 +26,7 @@ using namespace std;
 
 /* $ModDesc: Provides support for the CHGHOST command */
 
-extern InspIRCd* ServerInstance;
+
 
 class cmd_chghost : public command_t
 {
index cca24372a618d9f6e2f26af86b52a4d07952423e..5bc70e3d7e5490324890778c1bb52a158ec8906e 100644 (file)
@@ -6,7 +6,7 @@
 
 /* $ModDesc: Provides support for the CHGIDENT command */
 
-extern InspIRCd* ServerInstance;
+
 
 class cmd_chgident : public command_t
 {
index 91a6bc31b29911bf64e04c5b4ed26c9fecfe366c..e00e0ac86113458ac7b2d9249fb96491eb20852f 100644 (file)
@@ -43,7 +43,7 @@
 
 /* $ModDesc: Provides masking of user hostnames */
 
-extern InspIRCd* ServerInstance;
+
 
 /* The four core functions - F1 is optimized somewhat */
 
index 2d64819416c3e4c8bd45e617d6b627f9112c505b..bd444338edd9955b4f8d80f5be91e3c2c0ccec6d 100644 (file)
@@ -23,7 +23,7 @@ using namespace std;
 
 /* $ModDesc: Sends the /LUSERS on connect */
 
-extern InspIRCd* ServerInstance;
+
 
 // This has to be the simplest module ever.
 // The RFC doesnt specify that you should send the /LUSERS numerics
index 43d0f2216d0edae3fc912481178f2ccea7e5aed3..9bbac7aa382143b6f3da2da8b7af901bc8b8b97e 100644 (file)
@@ -9,7 +9,7 @@
 
 /* $ModDesc: Forces connecting clients to send a PONG message back to the server before they can complete their connection */
 
-extern InspIRCd* ServerInstance;
+
 
 char* RandString(unsigned int length)
 {
index a7a7d33b625c0997a9f9a11d33e3afeeef6379c8..89c7f4c6223fe12b06f8cea0daae9ae22cb0c015 100644 (file)
@@ -28,7 +28,7 @@ using namespace std;
 int conns = 0, throttled = 0;
 extern time_t TIME;
 
-extern InspIRCd* ServerInstance;
+
 
 class ModuleConnFlood : public Module
 {
index 45cb0372d81303f2a0045eb8c0d393a1e0417131..4dcca3d9d65346589a56f748c1bacd5069d7e678 100644 (file)
@@ -29,7 +29,7 @@ using namespace std;
 #include "modules.h"
 #include "inspircd.h"
 
-extern InspIRCd* ServerInstance;
+
         
 class cmd_devoice : public command_t
 {
index a0c2a97c2fa173b444d8eb1805ce09e4b539509b..c54be801e31652b166e4a94b1318a0e6ddb6d2c5 100644 (file)
@@ -30,7 +30,7 @@ using namespace std;
 
 /* $ModDesc: An enhanced version of the unreal m_filter.so used by chatspike.net */
 
-extern InspIRCd* ServerInstance;
+
 
 class Filter : public classbase
 {
index 2e081ead8a2eb2c161bb18bfdc928eb54dd11cfe..77a35294aafda02ac7a1d33a574d967c288e3184 100644 (file)
@@ -27,7 +27,7 @@ using namespace std;
 
 /* $ModDesc: Provides support for GLOBOPS and user mode +g */
 
-extern InspIRCd* ServerInstance;
+
 
 class cmd_globops : public command_t
 {
index 4d4263d280142e0a2646f747d2c3cbdd17b4062a..452a7114bf2642a26b4268fba7736fe661d1ba91 100644 (file)
@@ -25,7 +25,7 @@ using namespace std;
 // Global Vars
 static ConfigReader *helpop;
 
-extern InspIRCd* ServerInstance;
+
 
 bool do_helpop(const char**, int, userrec*);
 void sendtohelpop(userrec*, int, const char**);
@@ -127,60 +127,58 @@ class cmd_helpop : public command_t
                        }
                }
        }
-};
 
 
-bool do_helpop(const char** parameters, int pcnt, userrec *src)
-{
-       char search[MAXBUF];
-       std::string output = " "; // a fix bought to you by brain :p
-       char a[MAXBUF];
-       int nlines = 0;
-
-       if (!pcnt)
+       bool do_helpop(const char** parameters, int pcnt, userrec *src)
        {
-               strcpy(search,"start");
-       }
-       else
-       {
-               if (*parameters[0] == '?')
-                       parameters[0]++;
-               strlcpy(search,parameters[0],MAXBUF);
-       }
+               char search[MAXBUF];
+               std::string output = " "; // a fix bought to you by brain :p
+               char a[MAXBUF];
+               int nlines = 0;
 
-       for (char* n = search; *n; n++)
-               *n = tolower(*n);
+               if (!pcnt)
+               {
+                       strcpy(search,"start");
+               }
+               else
+               {
+                       if (*parameters[0] == '?')
+                               parameters[0]++;
+                       strlcpy(search,parameters[0],MAXBUF);
+               }
 
-       for (int i = 1; output != ""; i++)
-       {
-               snprintf(a,MAXBUF,"line%d",i);
-               output = helpop->ReadValue(search, a, 0);
-               if (output != "")
+               for (char* n = search; *n; n++)
+                       *n = tolower(*n);
+
+               for (int i = 1; output != ""; i++)
                {
-                       src->WriteServ("290 "+std::string(src->nick)+" :"+output);
-                       nlines++;
+                       snprintf(a,MAXBUF,"line%d",i);
+                       output = helpop->ReadValue(search, a, 0);
+                       if (output != "")
+                       {
+                               src->WriteServ("290 "+std::string(src->nick)+" :"+output);
+                               nlines++;
+                       }
                }
+               return (nlines>0);
        }
-       return (nlines>0);
-}
-
-
 
-void sendtohelpop(userrec *src, int pcnt, const char **params)
-{
-       const char* first = params[0];
-       if (*first == '!')
+       void sendtohelpop(userrec *src, int pcnt, const char **params)
        {
-               first++;
-       }
+               const char* first = params[0];
+               if (*first == '!')
+               {
+                       first++;
+               }
 
-       std::string line = "*** HELPOPS - From "+std::string(src->nick)+": "+std::string(first)+" ";
-       for (int i = 1; i < pcnt; i++)
-       {
-               line = line + std::string(params[i]) + " ";
+               std::string line = "*** HELPOPS - From "+std::string(src->nick)+": "+std::string(first)+" ";
+               for (int i = 1; i < pcnt; i++)
+               {
+                       line = line + std::string(params[i]) + " ";
+               }
+               ServerInstance->WriteMode("oh",WM_AND,line.c_str());
        }
-       ServerInstance->WriteMode("oh",WM_AND,line.c_str());
-}
+};
 
 class HelpopException : public ModuleException
 {
index 1a5986fc27e49dee83582b6a87bd39fe898f4076..2fe7ddbb89a4b4d6bcf1764655e48986b6662352 100644 (file)
@@ -24,7 +24,7 @@ using namespace std;
 
 /* $ModDesc: Provides masking of user hostnames in a different way to m_cloaking */
 
-extern InspIRCd* ServerInstance;
+
 
 class Host : public classbase
 {
index 4699d06966e6adc490412fa2f001eeb9390290e5..f8178ed3a4d9cbf1d2332c593c2a39a856091c4a 100644 (file)
@@ -29,7 +29,7 @@ using namespace std;
 
 class ModuleHttp;
 
-extern InspIRCd* ServerInstance;
+
 
 static ModuleHttp* HttpModule;
 extern time_t TIME;
@@ -66,7 +66,7 @@ class HttpSocket : public InspSocket
                if (InternalState == HTTP_LISTEN)
                {
                        HttpSocket* s = new HttpSocket(this->Instance, newsock, ip, index);
-                       ServerInstance->AddSocket(s);
+                       this->Instance->AddSocket(s);
                }
                return true;
        }
index 5fd161e2efd8590c2e7b9ee71a99e51c9591e988..a52089a93e77de7e863a2453e7b12f3a6f71b616 100644 (file)
@@ -28,7 +28,7 @@ using namespace std;
 
 /* $ModDesc: Provides statistics over HTTP via m_httpd.so */
 
-extern InspIRCd* ServerInstance;
+
 
 typedef std::map<irc::string,int> StatsHash;
 typedef StatsHash::iterator StatsIter;
index df6078c1d67c7d8dbb5d6cb82349a626224aa9f7..88229c6c1e4b6eac96ede8d8afc5195b2fa571d8 100644 (file)
@@ -23,7 +23,7 @@ using namespace std;
 #include "modules.h"
 #include "inspircd.h"
 
-extern InspIRCd* ServerInstance;
+
 
 extern userrec* fd_ref_table[MAX_DESCRIPTORS];
 
@@ -87,7 +87,7 @@ class RFC1413 : public InspSocket
                                                        {
                                                                if (u && (fd_ref_table[ufd] == u))
                                                                {
-                                                                       if (ServerInstance->IsIdent(section))
+                                                                       if (this->Instance->IsIdent(section))
                                                                        {
                                                                                strlcpy(u->ident,section,IDENTMAX);
                                                                                log(DEBUG,"IDENT SET: "+std::string(u->ident));
index 6246ea269e8130f1837b435c6d5f3192a3f07410..34d39c8b603b1bb6b5d50b82a2687e6a0417f7a4 100644 (file)
@@ -27,7 +27,7 @@ using namespace std;
 
 /* $ModDesc: Provides channel mode +j (join flood protection) */
 
-extern InspIRCd* ServerInstance;
+
 
 class joinfloodsettings : public classbase
 {
index 65a8c4dac03172c2b1fab85804de2086b78283d9..9ad952f11ff30db1e968c2520d4a51d4918683a3 100644 (file)
@@ -10,7 +10,7 @@
 
 /* $ModDesc: Provides channel mode +J (delay rejoin after kick) */
 
-extern InspIRCd* ServerInstance;
+
 
 inline int strtoint(const std::string &str)
 {
index 0121f04f4e130e09863b85570e62a5cbc0695394..afc3cfa02259c160f1e1b3fbd915d0a43533f301 100644 (file)
@@ -27,7 +27,7 @@ using namespace std;
 
 /* $ModDesc: Provides support for /KNOCK and mode +K */
 
-extern InspIRCd* ServerInstance;
+
 
 class cmd_knock : public command_t
 {
index 145bc51a285e0db28308fb1408431a916c8f0afb..25938d0cc4c7a3879abeb3311cd9efe1e8038a2a 100644 (file)
@@ -26,7 +26,7 @@ using namespace std;
 
 /* $ModDesc: Provides channel mode +f (message flood protection) */
 
-extern InspIRCd* ServerInstance;
+
 
 class floodsettings : public classbase
 {
index d63c7463359a3155892b51220faa8cf8cce215a0..16f6aafa62536ab90f57168cc589f69e3af96e9a 100644 (file)
@@ -27,7 +27,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 */
 
-extern InspIRCd* ServerInstance;
+
 
 class cmd_nicklock : public command_t
 {
index 273c6c93e8d2f89258b91922d98bb24bd45df101..a01862f70d403889de46783d175c5c4977f65401 100644 (file)
@@ -25,7 +25,7 @@ using namespace std;
 
 /* $ModDesc: Provides support for unreal-style channel mode +c */
 
-extern InspIRCd* ServerInstance;
+
 
 class NoCTCP : public ModeHandler
 {
index cb1597527034a0b2d48375e66f3c2f996691eca7..860ec17d2b45a24a4f92d697b9be7e2d70d01989 100644 (file)
@@ -25,7 +25,7 @@ using namespace std;
 
 /* $ModDesc: Provides support for unreal-style channel mode +V */
 
-extern InspIRCd* ServerInstance;
+
 
 class NoInvite : public ModeHandler
 {
index 0d7ad81da13ddecc6cc1362d56498c33d7239c4c..654d40be82a722cc0b1f21dc22071e255024ffe5 100644 (file)
@@ -25,7 +25,7 @@ using namespace std;
 
 /* $ModDesc: Provides support for unreal-style channel mode +Q */
 
-extern InspIRCd* ServerInstance;
+
 
 class NoKicks : public ModeHandler
 {
index 2ca3338f2a022ea9e45f40fa1fda47cddaded7b5..ff99f8eed01244037e8cade564130eaa6d04e7f4 100644 (file)
@@ -28,7 +28,7 @@ using namespace std;
 
 /* $ModDesc: Provides support for unreal-style GLOBOPS and umode +g */
 
-extern InspIRCd* ServerInstance;
+
 
 class NoNicks : public ModeHandler
 {
index 8c5e242486b311238cd1cd57c1462fb726c7e4c8..1dcd3482695ef396007079b0a8938702d0fb1eac 100644 (file)
@@ -25,7 +25,7 @@ using namespace std;
 
 /* $ModDesc: Provides support for unreal-style channel mode +T */
 
-extern InspIRCd* ServerInstance;
+
 
 class NoNotice : public ModeHandler
 {
index b6fe43549b816918b47a581bd71d9c00a919a9e7..3adff3c6b46170d06ce341fbd245ccd81d10dec4 100644 (file)
@@ -25,7 +25,7 @@ using namespace std;
 
 /* $ModDesc: Provides support for oper-only chans via the +O channel mode */
 
-extern InspIRCd* ServerInstance;
+
 
 class OperChans : public ModeHandler
 {
index aa4e777729f596ce1c94fa657a1718bb2d13e21f..dc8e1081a6e00da463933042d310b196c6ac2223 100644 (file)
@@ -10,7 +10,7 @@ using namespace std;
 
 /* $ModDesc: Forces opers to join the specified channel(s) on oper-up */
 
-extern InspIRCd* ServerInstance;
+
 
 class ModuleOperjoin : public Module
 {
index f8129a532273f540f8ec74499aa4f1d58c18b022..1909ab5c898ae90d78c28c179359a3c79a0edc16 100644 (file)
@@ -9,7 +9,7 @@ using namespace std;
 
 /* $ModDesc: Gives each oper type a 'level', cannot kill opers 'above' your level. */
 
-extern InspIRCd* ServerInstance;
+
 
 class ModuleOperLevels : public Module
 {
index 153f208bec0fe5fa33bedfcf7e8174a37dd3d3bd..7b53490686151e8d362708efedab9e5083431e7a 100644 (file)
@@ -23,7 +23,7 @@
 
 /* $ModDesc: Provides support for unreal-style oper-override */
 
-extern InspIRCd* ServerInstance;
+
 
 typedef std::map<std::string,std::string> override_t;
 
index 798c4edd80e946d46b08a4b5d08593715783f9b0..c232e8a2c0a2f9708f5582666bde95e0bea48610 100644 (file)
@@ -25,7 +25,7 @@ using namespace std;
 #include "modules.h"
 #include "inspircd.h"
 
-extern InspIRCd* ServerInstance;
+
 
 /* $ModDesc: Provides support for user parking/unparking */
 
index ae168730aa9d2531df6dad47f0ee9a234106b9aa..7d887e10044d7a825f74e869d83308862b057a40 100644 (file)
@@ -25,7 +25,7 @@ using namespace std;
 
 /* $ModDesc: Provides channel mode +L (limit redirection) */
 
-extern InspIRCd* ServerInstance;
+
 
 class Redirect : public ModeHandler
 {
index 58f64c83d1e9b92c2eaa27c89914de0d78270184..be23649344433e7f5c6921c5d81e85979e65e017 100644 (file)
  * eg: +h can remove +hv and users with no modes. +a can remove +aohv and users with no modes.
 */
 
-extern InspIRCd* ServerInstance;
-
 class RemoveBase
 {
  private: 
        bool& supportnokicks;
+       InspIRCd* ServerInstance;
  
  protected:
-       RemoveBase(bool& snk) : supportnokicks(snk)
+       RemoveBase(InspIRCd* Instance, bool& snk) : supportnokicks(snk), ServerInstance(Instance)
        {
        }               
  
@@ -207,7 +206,7 @@ class RemoveBase
 class cmd_remove : public command_t, public RemoveBase
 {
  public:
-       cmd_remove(InspIRCd* Instance, bool& snk) : command_t(Instance, "REMOVE", 0, 2), RemoveBase(snk)
+       cmd_remove(InspIRCd* Instance, bool& snk) : command_t(Instance, "REMOVE", 0, 2), RemoveBase(Instance, snk)
        {
                this->source = "m_remove.so";
                syntax = "<nick> <channel> [<reason>]";
@@ -222,7 +221,7 @@ class cmd_remove : public command_t, public RemoveBase
 class cmd_fpart : public command_t, public RemoveBase
 {
  public:
-       cmd_fpart(InspIRCd* Instance, bool& snk) : command_t(Instance, "FPART", 0, 2), RemoveBase(snk)
+       cmd_fpart(InspIRCd* Instance, bool& snk) : command_t(Instance, "FPART", 0, 2), RemoveBase(Instance, snk)
        {
                this->source = "m_remove.so";
                syntax = "<channel> <nick> [<reason>]";
index 925af1c5deae108876b2e5ef5f47b048104e4aa1..bc0b8bf3d75bd8551feef7dc98f4a82f03587349 100644 (file)
@@ -26,7 +26,7 @@ using namespace std;
 
 extern time_t TIME;
 
-extern InspIRCd* ServerInstance;
+
 
 class ListData : public classbase
 {
@@ -55,11 +55,11 @@ class ListTimer : public InspTimer
 
        char buffer[MAXBUF];
        chanrec *chan;
-       
+       InspIRCd* ServerInstance;
 
  public:
 
-       ListTimer(long interval) : InspTimer(interval,TIME)
+       ListTimer(InspIRCd* Instance, long interval) : InspTimer(interval,TIME), ServerInstance(Instance)
        {
        }
 
@@ -133,7 +133,7 @@ class ListTimer : public InspTimer
                        }
                }
 
-               ListTimer* MyTimer = new ListTimer(1);
+               ListTimer* MyTimer = new ListTimer(ServerInstance,1);
                ServerInstance->Timers->AddTimer(MyTimer);
        }
 };
@@ -146,7 +146,7 @@ class ModuleSafeList : public Module
  public:
        ModuleSafeList(InspIRCd* Me) : Module::Module(Me)
        {
-               MyTimer = new ListTimer(1);
+               MyTimer = new ListTimer(ServerInstance,1);
                ServerInstance->Timers->AddTimer(MyTimer);
        }
  
index d73e29f7b7f2c322c935d094390bd703f605672b..c1112cab8d1feb50ec41186371c3419fe2ab4d7d 100644 (file)
@@ -27,7 +27,7 @@ using namespace std;
 /* $ModDesc: Provides support for unreal-style SAJOIN command */
 
 
-extern InspIRCd* ServerInstance;
+
 
 class cmd_sajoin : public command_t
 {
index f1d246d7196d313146698b08a572953e77bf36d0..f034d5b43c691e43d7cf05e8877d54157d913499 100644 (file)
@@ -38,7 +38,7 @@ using namespace std;
 #include "inspircd.h"
 
 
-extern InspIRCd* ServerInstance;
+
         
 class cmd_samode : public command_t
 {
index 2856133d876c22e1e74c2bd4e45284a738227f19..0d9167c26020cadd1bcd77d6b3af13d782943c5d 100644 (file)
@@ -25,7 +25,7 @@ using namespace std;
 
 /* $ModDesc: Provides support for SANICK command */
 
-extern InspIRCd* ServerInstance;
+
 
 
 class cmd_sanick : public command_t
index 590c22c675b38a45bee247ae496539fbc880f143..43ab4b578262020688f6a3041361750c989bbf48 100644 (file)
@@ -27,7 +27,7 @@ using namespace std;
 /* $ModDesc: Provides support for unreal-style SAPART command */
 
 
-extern InspIRCd* ServerInstance;
+
 
 class cmd_sapart : public command_t
 {
index 2bb30be301281464d5cdff0e09c6c3bdcfd3792b..395776230a789ffd3c897f7ec8acf42a0c5b6f54 100644 (file)
@@ -36,7 +36,7 @@ using namespace std;
 /* $ModDesc: Provides support for an SAQUIT command, exits user with a reason */
 
 
-extern InspIRCd* ServerInstance;
+
 
 class cmd_saquit : public command_t
 {
index 0e7081e889a77f3a937e28482d89e751b6c55f62..dad59b6e3e037358a9cb32325e8b37dc47e1271b 100644 (file)
@@ -27,7 +27,7 @@ extern time_t TIME;
 
 /* $ModDesc: A module overriding /list, and making it safe - stop those sendq problems. */
 
-extern InspIRCd* ServerInstance;
+
  
 class ModuleSecureList : public Module
 {
index c7f2eca066c0d17b2004572c2a93e5c37b64c26c..924f8dc09971e52796b2989c3b5d77edc60b25bb 100644 (file)
@@ -30,7 +30,7 @@ static bool kludgeme = false;
 
 /* $ModDesc: Povides support for services +r user/chan modes and more */
 
-extern InspIRCd* ServerInstance;
+
 
 class Channel_r : public ModeHandler
 {
index 6248f6f03bb596f1e613a3dc9fdd7e1109866482..efcf7629ad33c008de7ad5c3611f2f68c5915999 100644 (file)
@@ -27,7 +27,7 @@ using namespace std;
 
 /* $ModDesc: Povides support for ircu-style services accounts, including chmode +R, etc. */
 
-extern InspIRCd* ServerInstance;
+
 
 class AChannel_R : public ModeHandler
 {
index 3803c716c0fac06c829b40e325304058997ceaaa..75d758f38178ec34662b9883e8f9c17f0b276c52 100644 (file)
@@ -27,7 +27,7 @@ using namespace std;
 /* $ModDesc: Provides support for the SETHOST command */
 
 
-extern InspIRCd* ServerInstance;
+
 
 class cmd_sethost : public command_t
 {
index 88375559823abeb8f7d3a0afb049359343411db9..e9795cc7e580974533080ae454fc59113e467bb0 100644 (file)
@@ -6,7 +6,7 @@
 /* $ModDesc: Provides support for the SETIDENT command */
 
 
-extern InspIRCd* ServerInstance;
+
 
 class cmd_setident : public command_t
 {
index 9b22506acd52418364e0acbbf377b29b6748ede5..8bc790fca61a8774f1972af3c89d84c2b5a3ecb4 100644 (file)
@@ -26,7 +26,7 @@ using namespace std;
 
 /* $ModDesc: Allows opers to set their idle time */
 
-extern InspIRCd* ServerInstance;
+
 
 class cmd_setidle : public command_t
 {
index 244c488187773655d0be8044370140c6153fc197..e088b796381abf64ab310e924a5cd37eb924ff16 100644 (file)
@@ -26,7 +26,7 @@ using namespace std;
 
 /* $ModDesc: Provides support for the SETNAME command */
 
-extern InspIRCd* ServerInstance;
+
 
 class cmd_setname : public command_t
 {
index 2f32b58de278ef05a3c71e65b9e9fb60bb5b3f44..728b07fc563117074d8de7c7f3c2de6ef3256bd8 100644 (file)
@@ -11,7 +11,7 @@ using namespace std;
 
 /* $ModDesc: Allows opers to set +W to see when a user uses WHOIS on them */
 
-extern InspIRCd* ServerInstance;
+
 
 class SeeWhois : public ModeHandler
 {
index 1e59d906bf5754602d3385a771a4092a7c5cc65b..1238261d455e231086b8ef907c774572272a800e 100644 (file)
@@ -34,6 +34,7 @@ using namespace std;
 #include "socket.h"
 #include "helperfuncs.h"
 #include "inspircd.h"
+#include "wildcard.h"
 #include "inspstring.h"
 #include "hashcomp.h"
 #include "xline.h"
@@ -68,8 +69,7 @@ using irc::sockets::MatchCIDR;
 
 class ModuleSpanningTree;
 static ModuleSpanningTree* TreeProtocolModule;
-
-extern InspIRCd* ServerInstance;
+static InspIRCd* ServerInstance;
 
 /* Any socket can have one of five states at any one time.
  * The LISTENER state indicates a socket which is listening
@@ -199,6 +199,7 @@ class UserManager : public classbase
 
 class TreeServer : public classbase
 {
+       InspIRCd* ServerInstance;               /* Creator */
        TreeServer* Parent;                     /* Parent entry */
        TreeServer* Route;                      /* Route entry */
        std::vector<TreeServer*> Children;      /* List of child objects */
@@ -216,7 +217,7 @@ class TreeServer : public classbase
        /* We don't use this constructor. Its a dummy, and won't cause any insertion
         * of the TreeServer into the hash_map. See below for the two we DO use.
         */
-       TreeServer()
+       TreeServer(InspIRCd* Instance) : ServerInstance(Instance)
        {
                Parent = NULL;
                ServerName = "";
@@ -582,7 +583,7 @@ TreeServer* FindServerMask(std::string ServerName)
 {
        for (server_hash::iterator i = serverlist.begin(); i != serverlist.end(); i++)
        {
-               if (ServerInstance->MatchText(i->first.c_str(),ServerName))
+               if (match(i->first.c_str(),ServerName.c_str()))
                        return i->second;
        }
        return NULL;
@@ -708,12 +709,12 @@ class TreeSocket : public InspSocket
                keylength = key.length();
                if (!(keylength == 16 || keylength == 24 || keylength == 32))
                {
-                       ServerInstance->WriteOpers("*** \2ERROR\2: Key length for encryptionkey is not 16, 24 or 32 bytes in length!");
+                       this->Instance->WriteOpers("*** \2ERROR\2: Key length for encryptionkey is not 16, 24 or 32 bytes in length!");
                        log(DEBUG,"Key length not 16, 24 or 32 characters!");
                }
                else
                {
-                       ServerInstance->WriteOpers("*** \2AES\2: Initialized %d bit encryption to server %s",keylength*8,SName.c_str());
+                       this->Instance->WriteOpers("*** \2AES\2: Initialized %d bit encryption to server %s",keylength*8,SName.c_str());
                        ctx_in->MakeKey(key.c_str(), "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
                                \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", keylength, keylength);
                        ctx_out->MakeKey(key.c_str(), "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
@@ -736,22 +737,22 @@ class TreeSocket : public InspSocket
                        {
                                if (x->Name == this->myhost)
                                {
-                                       ServerInstance->WriteOpers("*** Connection to \2"+myhost+"\2["+(x->HiddenFromStats ? "<hidden>" : this->GetIP())+"] established.");
+                                       this->Instance->WriteOpers("*** Connection to \2"+myhost+"\2["+(x->HiddenFromStats ? "<hidden>" : this->GetIP())+"] established.");
                                        this->SendCapabilities();
                                        if (x->EncryptionKey != "")
                                        {
                                                if (!(x->EncryptionKey.length() == 16 || x->EncryptionKey.length() == 24 || x->EncryptionKey.length() == 32))
                                                {
-                                                       ServerInstance->WriteOpers("\2WARNING\2: Your encryption key is NOT 16, 24 or 32 characters in length, encryption will \2NOT\2 be enabled.");
+                                                       this->Instance->WriteOpers("\2WARNING\2: Your encryption key is NOT 16, 24 or 32 characters in length, encryption will \2NOT\2 be enabled.");
                                                }
                                                else
                                                {
-                                                       this->WriteLine(std::string("AES ")+ServerInstance->Config->ServerName);
+                                                       this->WriteLine(std::string("AES ")+this->Instance->Config->ServerName);
                                                        this->InitAES(x->EncryptionKey,x->Name.c_str());
                                                }
                                        }
                                        /* found who we're supposed to be connecting to, send the neccessary gubbins. */
-                                       this->WriteLine(std::string("SERVER ")+ServerInstance->Config->ServerName+" "+x->SendPass+" 0 :"+ServerInstance->Config->ServerDesc);
+                                       this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+x->SendPass+" 0 :"+this->Instance->Config->ServerDesc);
                                        return true;
                                }
                        }
@@ -761,7 +762,7 @@ class TreeSocket : public InspSocket
                 * If that happens the connection hangs here until it's closed. Unlikely
                 * and rather harmless.
                 */
-               ServerInstance->WriteOpers("*** Connection to \2"+myhost+"\2 lost link tag(!)");
+               this->Instance->WriteOpers("*** Connection to \2"+myhost+"\2 lost link tag(!)");
                return true;
        }
        
@@ -773,7 +774,7 @@ class TreeSocket : public InspSocket
                 */
                if (e == I_ERR_CONNECT)
                {
-                       ServerInstance->WriteOpers("*** Connection failed: Connection refused");
+                       this->Instance->WriteOpers("*** Connection failed: Connection refused");
                }
        }
 
@@ -816,10 +817,10 @@ class TreeSocket : public InspSocket
                std::vector<std::string> modlist;
                std::string capabilities = "";
 
-               for (int i = 0; i <= ServerInstance->GetModuleCount(); i++)
+               for (int i = 0; i <= this->Instance->GetModuleCount(); i++)
                {
-                       if ((ServerInstance->modules[i]->GetVersion().Flags & VF_STATIC) || (ServerInstance->modules[i]->GetVersion().Flags & VF_COMMON))
-                               modlist.push_back(ServerInstance->Config->module_names[i]);
+                       if ((this->Instance->modules[i]->GetVersion().Flags & VF_STATIC) || (this->Instance->modules[i]->GetVersion().Flags & VF_COMMON))
+                               modlist.push_back(this->Instance->Config->module_names[i]);
                }
                sort(modlist.begin(),modlist.end());
                for (unsigned int i = 0; i < modlist.size(); i++)
@@ -852,10 +853,10 @@ class TreeSocket : public InspSocket
                                quitserver = this->InboundServerName;
                        }
 
-                       ServerInstance->WriteOpers("*** \2ERROR\2: Server '%s' does not have the same set of modules loaded, cannot link!",quitserver.c_str());
-                       ServerInstance->WriteOpers("*** Our networked module set is: '%s'",this->MyCapabilities().c_str());
-                       ServerInstance->WriteOpers("*** Other server's networked module set is: '%s'",params[0].c_str());
-                       ServerInstance->WriteOpers("*** These lists must match exactly on both servers. Please correct these errors, and try again.");
+                       this->Instance->WriteOpers("*** \2ERROR\2: Server '%s' does not have the same set of modules loaded, cannot link!",quitserver.c_str());
+                       this->Instance->WriteOpers("*** Our networked module set is: '%s'",this->MyCapabilities().c_str());
+                       this->Instance->WriteOpers("*** Other server's networked module set is: '%s'",params[0].c_str());
+                       this->Instance->WriteOpers("*** These lists must match exactly on both servers. Please correct these errors, and try again.");
                        this->WriteLine("ERROR :CAPAB mismatch; My capabilities: '"+this->MyCapabilities()+"'");
                        return false;
                }
@@ -899,11 +900,11 @@ class TreeSocket : public InspSocket
                        DoOneToAllButSender(Current->GetParent()->GetName(),"SQUIT",params,Current->GetName());
                        if (Current->GetParent() == TreeRoot)
                        {
-                               ServerInstance->WriteOpers("Server \002"+Current->GetName()+"\002 split: "+reason);
+                               this->Instance->WriteOpers("Server \002"+Current->GetName()+"\002 split: "+reason);
                        }
                        else
                        {
-                               ServerInstance->WriteOpers("Server \002"+Current->GetName()+"\002 split from server \002"+Current->GetParent()->GetName()+"\002 with reason: "+reason);
+                               this->Instance->WriteOpers("Server \002"+Current->GetName()+"\002 split from server \002"+Current->GetParent()->GetName()+"\002 with reason: "+reason);
                        }
                        num_lost_servers = 0;
                        num_lost_users = 0;
@@ -912,7 +913,7 @@ class TreeSocket : public InspSocket
                        Current->Tidy();
                        Current->GetParent()->DelChild(Current);
                        DELETE(Current);
-                       ServerInstance->WriteOpers("Netsplit complete, lost \002%d\002 users on \002%d\002 servers.", num_lost_users, num_lost_servers);
+                       this->Instance->WriteOpers("Netsplit complete, lost \002%d\002 users on \002%d\002 servers.", num_lost_users, num_lost_servers);
                }
                else
                {
@@ -934,7 +935,7 @@ class TreeSocket : public InspSocket
                std::string sourceserv;
 
                /* Are we dealing with an FMODE from a user, or from a server? */
-               userrec* who = ServerInstance->FindNick(source);
+               userrec* who = this->Instance->FindNick(source);
                if (who)
                {
                        /* FMODE from a user, set sourceserv to the users server name */
@@ -943,7 +944,7 @@ class TreeSocket : public InspSocket
                else
                {
                        /* FMODE from a server, create a fake user to receive mode feedback */
-                       who = new userrec(ServerInstance);
+                       who = new userrec(this->Instance);
                        who->fd = FD_MAGIC_NUMBER;
                        smode = true;           /* Setting this flag tells us we should free the userrec later */
                        sourceserv = source;    /* Set sourceserv to the actual source string */
@@ -970,7 +971,7 @@ class TreeSocket : public InspSocket
                                
                }
                 /* Extract the TS value of the object, either userrec or chanrec */
-               userrec* dst = ServerInstance->FindNick(params[0]);
+               userrec* dst = this->Instance->FindNick(params[0]);
                chanrec* chan = NULL;
                time_t ourTS = 0;
                if (dst)
@@ -979,7 +980,7 @@ class TreeSocket : public InspSocket
                }
                else
                {
-                       chan = ServerInstance->FindChan(params[0]);
+                       chan = this->Instance->FindChan(params[0]);
                        if (chan)
                        {
                                ourTS = chan->age;
@@ -1019,7 +1020,7 @@ class TreeSocket : public InspSocket
                                                        /* We only care about whats being set,
                                                         * not whats being unset
                                                         */
-                                                       mh = ServerInstance->ModeGrok->FindMode(*x, chan ? MODETYPE_CHANNEL : MODETYPE_USER);
+                                                       mh = this->Instance->ModeGrok->FindMode(*x, chan ? MODETYPE_CHANNEL : MODETYPE_USER);
 
                                                        if ((mh) && (mh->GetNumParams(adding) > 0) && (!mh->IsListMode()))
                                                        {
@@ -1084,7 +1085,7 @@ class TreeSocket : public InspSocket
                                                        }
                                                        else
                                                        {
-                                                               mh = ServerInstance->ModeGrok->FindMode(*x, chan ? MODETYPE_CHANNEL : MODETYPE_USER);
+                                                               mh = this->Instance->ModeGrok->FindMode(*x, chan ? MODETYPE_CHANNEL : MODETYPE_USER);
 
                                                                if (mh)
                                                                {
@@ -1109,7 +1110,7 @@ class TreeSocket : public InspSocket
                                                }
                                                else
                                                {
-                                                       mh = ServerInstance->ModeGrok->FindMode(*x, chan ? MODETYPE_CHANNEL : MODETYPE_USER);
+                                                       mh = this->Instance->ModeGrok->FindMode(*x, chan ? MODETYPE_CHANNEL : MODETYPE_USER);
 
                                                        if (mh)
                                                        {
@@ -1135,7 +1136,7 @@ class TreeSocket : public InspSocket
                                newparams.push_back(params[0]);
                                newparams.push_back(ConvToStr(ourTS));
                                newparams.push_back(to_bounce+params_to_bounce);
-                               DoOneToOne(ServerInstance->Config->ServerName,"FMODE",newparams,sourceserv);
+                               DoOneToOne(this->Instance->Config->ServerName,"FMODE",newparams,sourceserv);
                        }
 
                        if (to_keep.length())
@@ -1157,12 +1158,12 @@ class TreeSocket : public InspSocket
                                if (smode)
                                {
                                        log(DEBUG,"Send mode");
-                                       ServerInstance->SendMode(modelist, n+2, who);
+                                       this->Instance->SendMode(modelist, n+2, who);
                                }
                                else
                                {
                                        log(DEBUG,"Send mode client");
-                                       ServerInstance->CallCommandHandler("MODE", modelist, n+2, who);
+                                       this->Instance->CallCommandHandler("MODE", modelist, n+2, who);
                                }
 
                                /* HOT POTATO! PASS IT ON! */
@@ -1171,7 +1172,7 @@ class TreeSocket : public InspSocket
                }
                else
                /* U-lined servers always win regardless of their TS */
-               if ((TS > ourTS) && (!ServerInstance->IsUlined(source)))
+               if ((TS > ourTS) && (!this->Instance->IsUlined(source)))
                {
                        /* Bounce the mode back to its sender.* We use our lower TS, so the other end
                         * SHOULD accept it, if its clock is right.
@@ -1216,7 +1217,7 @@ class TreeSocket : public InspSocket
                                        break;
                                        default:
                                                /* Find the mode handler for this mode */
-                                               mh = ServerInstance->ModeGrok->FindMode(*x, chan ? MODETYPE_CHANNEL : MODETYPE_USER);
+                                               mh = this->Instance->ModeGrok->FindMode(*x, chan ? MODETYPE_CHANNEL : MODETYPE_USER);
 
                                                /* Got a mode handler?
                                                 * This also prevents us bouncing modes we have no handler for.
@@ -1275,7 +1276,7 @@ class TreeSocket : public InspSocket
                        /* Update the parameters for FMODE with the new 'bounced' string */
                        newparams[2] = modebounce;
                        /* Only send it back the way it came, no need to send it anywhere else */
-                       DoOneToOne(ServerInstance->Config->ServerName,"FMODE",newparams,sourceserv);
+                       DoOneToOne(this->Instance->Config->ServerName,"FMODE",newparams,sourceserv);
                        log(DEBUG,"FMODE bounced intelligently, our TS less than theirs and the other server is NOT a uline.");
                }
                else
@@ -1284,15 +1285,15 @@ class TreeSocket : public InspSocket
                        /* The server was ulined, but something iffy is up with the TS.
                         * Sound the alarm bells!
                         */
-                       if ((ServerInstance->IsUlined(sourceserv)) && (TS > ourTS))
+                       if ((this->Instance->IsUlined(sourceserv)) && (TS > ourTS))
                        {
-                               ServerInstance->WriteOpers("\2WARNING!\2 U-Lined server '%s' has bad TS for '%s' (accepted change): \2SYNC YOUR CLOCKS\2 to avoid this notice",sourceserv.c_str(),params[0].c_str());
+                               this->Instance->WriteOpers("\2WARNING!\2 U-Lined server '%s' has bad TS for '%s' (accepted change): \2SYNC YOUR CLOCKS\2 to avoid this notice",sourceserv.c_str(),params[0].c_str());
                        }
                        /* Allow the mode, route it to either server or user command handling */
                        if (smode)
-                               ServerInstance->SendMode(modelist,n,who);
+                               this->Instance->SendMode(modelist,n,who);
                        else
-                               ServerInstance->CallCommandHandler("MODE", modelist, n, who);
+                               this->Instance->CallCommandHandler("MODE", modelist, n, who);
 
                        /* HOT POTATO! PASS IT ON! */
                        DoOneToAllButSender(source,"FMODE",params,sourceserv);
@@ -1312,7 +1313,7 @@ class TreeSocket : public InspSocket
                time_t ts = atoi(params[1].c_str());
                std::string nsource = source;
 
-               chanrec* c = ServerInstance->FindChan(params[0]);
+               chanrec* c = this->Instance->FindChan(params[0]);
                if (c)
                {
                        if ((ts >= c->topicset) || (!*c->topic))
@@ -1327,7 +1328,7 @@ class TreeSocket : public InspSocket
                                 */
                                if (oldtopic != params[3])
                                {
-                                       userrec* user = ServerInstance->FindNick(source);
+                                       userrec* user = this->Instance->FindNick(source);
                                        if (!user)
                                        {
                                                c->WriteChannelWithServ(source.c_str(), "TOPIC %s :%s", c->name, c->topic);
@@ -1368,7 +1369,7 @@ class TreeSocket : public InspSocket
                time_t TS = atoi(params[1].c_str());
                char* key = "";
                
-               chanrec* chan = ServerInstance->FindChan(channel);
+               chanrec* chan = this->Instance->FindChan(channel);
                if (chan)
                {
                        key = chan->key;
@@ -1379,7 +1380,7 @@ class TreeSocket : public InspSocket
                 * channel will let the other side apply their modes.
                 */
                time_t ourTS = time(NULL)+600;
-               chanrec* us = ServerInstance->FindChan(channel);
+               chanrec* us = this->Instance->FindChan(channel);
                if (us)
                {
                        ourTS = us->age;
@@ -1419,7 +1420,7 @@ class TreeSocket : public InspSocket
                                                strlcat(modestring,"v",MAXBUF);
                                        break;
                                }
-                               who = ServerInstance->FindNick(usr);
+                               who = this->Instance->FindNick(usr);
                                if (who)
                                {
                                        chanrec::JoinUser(this->Instance, who, channel.c_str(), true, key);
@@ -1428,11 +1429,11 @@ class TreeSocket : public InspSocket
                                                /* theres a mode for this user. push them onto the mode queue, and flush it
                                                 * if there are more than MAXMODES to go.
                                                 */
-                                               if ((ourTS >= TS) || (ServerInstance->IsUlined(who->server)))
+                                               if ((ourTS >= TS) || (this->Instance->IsUlined(who->server)))
                                                {
                                                        /* We also always let u-lined clients win, no matter what the TS value */
                                                        log(DEBUG,"Our our channel newer than theirs, accepting their modes");
-                                                       ServerInstance->SendMode((const char**)mode_users,modectr,who);
+                                                       this->Instance->SendMode((const char**)mode_users,modectr,who);
                                                        if (ourTS != TS)
                                                        {
                                                                log(DEFAULT,"Channel TS for %s changed from %lu to %lu",us->name,ourTS,TS);
@@ -1457,7 +1458,7 @@ class TreeSocket : public InspSocket
                                                                
                                                        }
                                                        // tell everyone to bounce the modes. bad modes, bad!
-                                                       DoOneToMany(ServerInstance->Config->ServerName,"FMODE",params);
+                                                       DoOneToMany(this->Instance->Config->ServerName,"FMODE",params);
                                                }
                                                strcpy(mode_users[1],"+");
                                                modectr = 2;
@@ -1473,7 +1474,7 @@ class TreeSocket : public InspSocket
                        if (ourTS >= TS)
                        {
                                log(DEBUG,"Our our channel newer than theirs, accepting their modes");
-                               ServerInstance->SendMode((const char**)mode_users,modectr,who);
+                               this->Instance->SendMode((const char**)mode_users,modectr,who);
                                if (ourTS != TS)
                                {
                                        log(DEFAULT,"Channel TS for %s changed from %lu to %lu",us->name,ourTS,TS);
@@ -1494,7 +1495,7 @@ class TreeSocket : public InspSocket
                                        }
                                        params.push_back(mode_users[x]);
                                }
-                               DoOneToMany(ServerInstance->Config->ServerName,"FMODE",params);
+                               DoOneToMany(this->Instance->Config->ServerName,"FMODE",params);
                        }
                }
                return true;
@@ -1504,7 +1505,7 @@ class TreeSocket : public InspSocket
        {
                if (params.size() >= 2)
                {
-                       chanrec* c = ServerInstance->FindChan(params[0]);
+                       chanrec* c = this->Instance->FindChan(params[0]);
                        if (c)
                        {
                                time_t theirTS = atoi(params[1].c_str());
@@ -1516,7 +1517,7 @@ class TreeSocket : public InspSocket
                                }
                        }
                }
-               DoOneToAllButSender(ServerInstance->Config->ServerName,"SYNCTS",params,source);
+               DoOneToAllButSender(this->Instance->Config->ServerName,"SYNCTS",params,source);
                return true;
        }
 
@@ -1527,7 +1528,7 @@ class TreeSocket : public InspSocket
                        return true;
                if (params.size() > 8)
                {
-                       this->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" KILL "+params[1]+" :Invalid client introduction ("+params[1]+"?)");
+                       this->WriteLine(std::string(":")+this->Instance->Config->ServerName+" KILL "+params[1]+" :Invalid client introduction ("+params[1]+"?)");
                        return true;
                }
                // NICK age nick host dhost ident +modes ip :gecos
@@ -1548,7 +1549,7 @@ class TreeSocket : public InspSocket
                {
                        // nick collision
                        log(DEBUG,"Nick collision on %s!%s@%s: %lu %lu",tempnick,params[4].c_str(),params[2].c_str(),(unsigned long)age,(unsigned long)iter->second->age);
-                       this->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" KILL "+tempnick+" :Nickname collision");
+                       this->WriteLine(std::string(":")+this->Instance->Config->ServerName+" KILL "+tempnick+" :Nickname collision");
                        return true;
                }
 
@@ -1572,7 +1573,7 @@ class TreeSocket : public InspSocket
                else
                        _new->SetSockAddr(AF_INET, params[6].c_str(), 0);
 
-               ServerInstance->WriteOpers("*** Client connecting at %s: %s!%s@%s [%s]",_new->server,_new->nick,_new->ident,_new->host, _new->GetIPString());
+               this->Instance->WriteOpers("*** Client connecting at %s: %s!%s@%s [%s]",_new->server,_new->nick,_new->ident,_new->host, _new->GetIPString());
 
                params[7] = ":" + params[7];
                DoOneToAllButSender(source,"NICK",params,source);
@@ -1596,10 +1597,10 @@ class TreeSocket : public InspSocket
        {
                log(DEBUG,"Sending FJOINs to other server for %s",c->name);
                char list[MAXBUF];
-               std::string individual_halfops = std::string(":")+ServerInstance->Config->ServerName+" FMODE "+c->name+" "+ConvToStr(c->age);
+               std::string individual_halfops = std::string(":")+this->Instance->Config->ServerName+" FMODE "+c->name+" "+ConvToStr(c->age);
                
                size_t dlen, curlen;
-               dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu",ServerInstance->Config->ServerName,c->name,(unsigned long)c->age);
+               dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu",this->Instance->Config->ServerName,c->name,(unsigned long)c->age);
                int numusers = 0;
                char* ptr = list + dlen;
 
@@ -1645,7 +1646,7 @@ class TreeSocket : public InspSocket
                        if (curlen > (480-NICKMAX))
                        {
                                this->WriteLine(list);
-                               dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu",ServerInstance->Config->ServerName,c->name,(unsigned long)c->age);
+                               dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu",this->Instance->Config->ServerName,c->name,(unsigned long)c->age);
                                ptr = list + dlen;
                                ptrlen = 0;
                                numusers = 0;
@@ -1653,13 +1654,11 @@ class TreeSocket : public InspSocket
                                {
                                        modes.append("v");
                                        params.append(specific_voice[y]->nick).append(" ");
-                                       //this->WriteLine(":"+ServerInstance->Config->ServerName+" FMODE "+c->name+" "+ConvToStr(c->age)+" +v "+specific_voice[y]->nick);
                                }
                                for (unsigned int y = 0; y < specific_halfop.size(); y++)
                                {
                                        modes.append("h");
                                        params.append(specific_halfop[y]->nick).append(" ");
-                                       //this->WriteLine(":"+ServerInstance->Config->ServerName+" FMODE "+c->name+" "+ConvToStr(c->age)+" +h "+specific_halfop[y]->nick);
                                }
                        }
                }
@@ -1670,32 +1669,27 @@ class TreeSocket : public InspSocket
                        {
                                modes.append("v");
                                params.append(specific_voice[y]->nick).append(" ");
-                               //this->WriteLine(":"+ServerInstance->Config->ServerName+" FMODE "+c->name+" "+ConvToStr(c->age)+" +v "+specific_voice[y]->nick);
                        }
                        for (unsigned int y = 0; y < specific_halfop.size(); y++)
                        {
                                modes.append("h");
                                params.append(specific_halfop[y]->nick).append(" ");
-                               //this->WriteLine(":"+ServerInstance->Config->ServerName+" FMODE "+c->name+" "+ConvToStr(c->age)+" +h "+specific_halfop[y]->nick);
                        }
                }
-               //std::string modes = "";
-               //std::string params = "";
+
                 for (BanList::iterator b = c->bans.begin(); b != c->bans.end(); b++)
                 {
                        modes.append("b");
                        params.append(b->data).append(" ");
                 }
-               /* XXX: Send each channel mode and its params -- we'll need a method for this in ModeHandler? */
-                //FOREACH_MOD(I_OnSyncChannel,OnSyncChannel(c->second,(Module*)TreeProtocolModule,(void*)this));
-               this->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" FMODE "+c->name+" "+ConvToStr(c->age)+" +"+c->ChanModes(true)+modes+" "+params);
+               this->WriteLine(std::string(":")+this->Instance->Config->ServerName+" FMODE "+c->name+" "+ConvToStr(c->age)+" +"+c->ChanModes(true)+modes+" "+params);
        }
 
        /* Send G, Q, Z and E lines */
        void SendXLines(TreeServer* Current)
        {
                char data[MAXBUF];
-               std::string n = ServerInstance->Config->ServerName;
+               std::string n = this->Instance->Config->ServerName;
                const char* sn = n.c_str();
                int iterations = 0;
                /* Yes, these arent too nice looking, but they get the job done */
@@ -1747,7 +1741,7 @@ class TreeSocket : public InspSocket
                char data[MAXBUF];
                std::deque<std::string> list;
                int iterations = 0;
-               std::string n = ServerInstance->Config->ServerName;
+               std::string n = this->Instance->Config->ServerName;
                const char* sn = n.c_str();
                for (chan_hash::iterator c = this->Instance->chanlist.begin(); c != this->Instance->chanlist.end(); c++, iterations++)
                {
@@ -1757,12 +1751,12 @@ class TreeSocket : public InspSocket
                                snprintf(data,MAXBUF,":%s FTOPIC %s %lu %s :%s",sn,c->second->name,(unsigned long)c->second->topicset,c->second->setby,c->second->topic);
                                this->WriteLine(data);
                        }
-                       FOREACH_MOD(I_OnSyncChannel,OnSyncChannel(c->second,(Module*)TreeProtocolModule,(void*)this));
+                       FOREACH_MOD_I(this->Instance,I_OnSyncChannel,OnSyncChannel(c->second,(Module*)TreeProtocolModule,(void*)this));
                        list.clear();
                        c->second->GetExtList(list);
                        for (unsigned int j = 0; j < list.size(); j++)
                        {
-                               FOREACH_MOD(I_OnSyncChannelMetaData,OnSyncChannelMetaData(c->second,(Module*)TreeProtocolModule,(void*)this,list[j]));
+                               FOREACH_MOD_I(this->Instance,I_OnSyncChannelMetaData,OnSyncChannelMetaData(c->second,(Module*)TreeProtocolModule,(void*)this,list[j]));
                        }
                }
        }
@@ -1787,12 +1781,12 @@ class TreeSocket : public InspSocket
                                {
                                        this->WriteLine(":"+std::string(u->second->nick)+" AWAY :"+std::string(u->second->awaymsg));
                                }
-                               FOREACH_MOD(I_OnSyncUser,OnSyncUser(u->second,(Module*)TreeProtocolModule,(void*)this));
+                               FOREACH_MOD_I(this->Instance,I_OnSyncUser,OnSyncUser(u->second,(Module*)TreeProtocolModule,(void*)this));
                                list.clear();
                                u->second->GetExtList(list);
                                for (unsigned int j = 0; j < list.size(); j++)
                                {
-                                       FOREACH_MOD(I_OnSyncUserMetaData,OnSyncUserMetaData(u->second,(Module*)TreeProtocolModule,(void*)this,list[j]));
+                                       FOREACH_MOD_I(this->Instance,I_OnSyncUserMetaData,OnSyncUserMetaData(u->second,(Module*)TreeProtocolModule,(void*)this,list[j]));
                                }
                        }
                }
@@ -1809,10 +1803,10 @@ class TreeSocket : public InspSocket
                std::string endburst = "ENDBURST";
                // Because by the end of the netburst, it  could be gone!
                std::string name = s->GetName();
-               ServerInstance->WriteOpers("*** Bursting to \2"+name+"\2.");
+               this->Instance->WriteOpers("*** Bursting to \2"+name+"\2.");
                this->WriteLine(burst);
                /* send our version string */
-               this->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" VERSION :"+this->Instance->GetVersionString());
+               this->WriteLine(std::string(":")+this->Instance->Config->ServerName+" VERSION :"+this->Instance->GetVersionString());
                /* Send server tree */
                this->SendServers(TreeRoot,s,1);
                /* Send users and their oper status */
@@ -1820,9 +1814,9 @@ class TreeSocket : public InspSocket
                /* Send everything else (channel modes, xlines etc) */
                this->SendChannelModes(s);
                this->SendXLines(s);            
-               FOREACH_MOD(I_OnSyncOtherMetaData,OnSyncOtherMetaData((Module*)TreeProtocolModule,(void*)this));
+               FOREACH_MOD_I(this->Instance,I_OnSyncOtherMetaData,OnSyncOtherMetaData((Module*)TreeProtocolModule,(void*)this));
                this->WriteLine(endburst);
-               ServerInstance->WriteOpers("*** Finished bursting to \2"+name+"\2.");
+               this->Instance->WriteOpers("*** Finished bursting to \2"+name+"\2.");
        }
 
        /* This function is called when we receive data from a remote
@@ -1918,7 +1912,7 @@ class TreeSocket : public InspSocket
        {
                if (params.size() < 1)
                        return false;
-               ServerInstance->WriteOpers("*** ERROR from %s: %s",(InboundServerName != "" ? InboundServerName.c_str() : myhost.c_str()),params[0].c_str());
+               this->Instance->WriteOpers("*** ERROR from %s: %s",(InboundServerName != "" ? InboundServerName.c_str() : myhost.c_str()),params[0].c_str());
                /* we will return false to cause the socket to close. */
                return false;
        }
@@ -1930,11 +1924,11 @@ class TreeSocket : public InspSocket
                 */
                if (params.size() > 1)
                {
-                       if (ServerInstance->MatchText(ServerInstance->Config->ServerName, params[1]))
+                       if (this->Instance->MatchText(this->Instance->Config->ServerName, params[1]))
                        {
                                /* It's for our server */
                                string_list results;
-                               userrec* source = ServerInstance->FindNick(prefix);
+                               userrec* source = this->Instance->FindNick(prefix);
                                if (source)
                                {
                                        std::deque<std::string> par;
@@ -1944,14 +1938,14 @@ class TreeSocket : public InspSocket
                                        for (size_t i = 0; i < results.size(); i++)
                                        {
                                                par[1] = "::" + results[i];
-                                               DoOneToOne(ServerInstance->Config->ServerName, "PUSH",par, source->server);
+                                               DoOneToOne(this->Instance->Config->ServerName, "PUSH",par, source->server);
                                        }
                                }
                        }
                        else
                        {
                                /* Pass it on */
-                               userrec* source = ServerInstance->FindNick(prefix);
+                               userrec* source = this->Instance->FindNick(prefix);
                                if (source)
                                        DoOneToOne(prefix, "STATS", params, params[1]);
                        }
@@ -1971,7 +1965,7 @@ class TreeSocket : public InspSocket
                        return true;
                }
                std::string opertype = params[0];
-               userrec* u = ServerInstance->FindNick(prefix);
+               userrec* u = this->Instance->FindNick(prefix);
                if (u)
                {
                        u->modes[UM_OPERATOR] = 1;
@@ -1989,7 +1983,7 @@ class TreeSocket : public InspSocket
                if (params.size() < 3)
                        return true;
 
-               userrec* u = ServerInstance->FindNick(params[0]);
+               userrec* u = this->Instance->FindNick(params[0]);
 
                if (u)
                {
@@ -2017,7 +2011,7 @@ class TreeSocket : public InspSocket
                if (params.size() < 2)
                        return true;
 
-               userrec* u = ServerInstance->FindNick(params[0]);
+               userrec* u = this->Instance->FindNick(params[0]);
 
                if (u)
                {
@@ -2034,10 +2028,10 @@ class TreeSocket : public InspSocket
 
                std::string servermask = params[0];
 
-               if (ServerInstance->MatchText(ServerInstance->Config->ServerName,servermask))
+               if (this->Instance->MatchText(this->Instance->Config->ServerName,servermask))
                {
-                       ServerInstance->WriteOpers("*** Remote rehash initiated from server \002"+prefix+"\002.");
-                       ServerInstance->RehashServer();
+                       this->Instance->WriteOpers("*** Remote rehash initiated from server \002"+prefix+"\002.");
+                       this->Instance->RehashServer();
                        ReadConfiguration(false);
                }
                DoOneToAllButSender(prefix,"REHASH",params,prefix);
@@ -2050,8 +2044,8 @@ class TreeSocket : public InspSocket
                        return true;
 
                std::string nick = params[0];
-               userrec* u = ServerInstance->FindNick(prefix);
-               userrec* who = ServerInstance->FindNick(nick);
+               userrec* u = this->Instance->FindNick(prefix);
+               userrec* who = this->Instance->FindNick(nick);
 
                if (who)
                {
@@ -2090,7 +2084,7 @@ class TreeSocket : public InspSocket
                else
                {
                        std::string forwardto = params[1];
-                       if (forwardto == ServerInstance->Config->ServerName)
+                       if (forwardto == this->Instance->Config->ServerName)
                        {
                                /*
                                 * this is a PONG for us
@@ -2098,7 +2092,7 @@ class TreeSocket : public InspSocket
                                 * dump the PONG reply back to their fd. If its a server, do nowt.
                                 * Services might want to send these s->s, but we dont need to yet.
                                 */
-                               userrec* u = ServerInstance->FindNick(prefix);
+                               userrec* u = this->Instance->FindNick(prefix);
 
                                if (u)
                                {
@@ -2126,22 +2120,22 @@ class TreeSocket : public InspSocket
                {
                        if (params[0] == "*")
                        {
-                               FOREACH_MOD(I_OnDecodeMetaData,OnDecodeMetaData(TYPE_OTHER,NULL,params[1],params[2]));
+                               FOREACH_MOD_I(this->Instance,I_OnDecodeMetaData,OnDecodeMetaData(TYPE_OTHER,NULL,params[1],params[2]));
                        }
                        else if (*(params[0].c_str()) == '#')
                        {
-                               chanrec* c = ServerInstance->FindChan(params[0]);
+                               chanrec* c = this->Instance->FindChan(params[0]);
                                if (c)
                                {
-                                       FOREACH_MOD(I_OnDecodeMetaData,OnDecodeMetaData(TYPE_CHANNEL,c,params[1],params[2]));
+                                       FOREACH_MOD_I(this->Instance,I_OnDecodeMetaData,OnDecodeMetaData(TYPE_CHANNEL,c,params[1],params[2]));
                                }
                        }
                        else if (*(params[0].c_str()) != '#')
                        {
-                               userrec* u = ServerInstance->FindNick(params[0]);
+                               userrec* u = this->Instance->FindNick(params[0]);
                                if (u)
                                {
-                                       FOREACH_MOD(I_OnDecodeMetaData,OnDecodeMetaData(TYPE_USER,u,params[1],params[2]));
+                                       FOREACH_MOD_I(this->Instance,I_OnDecodeMetaData,OnDecodeMetaData(TYPE_USER,u,params[1],params[2]));
                                }
                        }
                }
@@ -2172,7 +2166,7 @@ class TreeSocket : public InspSocket
                if (params.size() < 1)
                        return true;
 
-               userrec* u = ServerInstance->FindNick(prefix);
+               userrec* u = this->Instance->FindNick(prefix);
 
                if (u)
                {
@@ -2212,7 +2206,7 @@ class TreeSocket : public InspSocket
                        break;
                        default:
                                /* Just in case... */
-                               ServerInstance->WriteOpers("*** \2WARNING\2: Invalid xline type '"+params[0]+"' sent by server "+prefix+", ignored!");
+                               this->Instance->WriteOpers("*** \2WARNING\2: Invalid xline type '"+params[0]+"' sent by server "+prefix+", ignored!");
                                propogate = false;
                        break;
                }
@@ -2222,11 +2216,11 @@ class TreeSocket : public InspSocket
                {
                        if (atoi(params[4].c_str()))
                        {
-                               ServerInstance->WriteOpers("*** %s Added %cLINE on %s to expire in %lu seconds (%s).",prefix.c_str(),*(params[0].c_str()),params[1].c_str(),atoi(params[4].c_str()),params[5].c_str());
+                               this->Instance->WriteOpers("*** %s Added %cLINE on %s to expire in %lu seconds (%s).",prefix.c_str(),*(params[0].c_str()),params[1].c_str(),atoi(params[4].c_str()),params[5].c_str());
                        }
                        else
                        {
-                               ServerInstance->WriteOpers("*** %s Added permenant %cLINE on %s (%s).",prefix.c_str(),*(params[0].c_str()),params[1].c_str(),params[5].c_str());
+                               this->Instance->WriteOpers("*** %s Added permenant %cLINE on %s (%s).",prefix.c_str(),*(params[0].c_str()),params[1].c_str(),params[5].c_str());
                        }
                        params[5] = ":" + params[5];
                        DoOneToAllButSender(prefix,"ADDLINE",params,prefix);
@@ -2244,7 +2238,7 @@ class TreeSocket : public InspSocket
                if (params.size() < 1)
                        return true;
 
-               userrec* u = ServerInstance->FindNick(prefix);
+               userrec* u = this->Instance->FindNick(prefix);
 
                if (u)
                {
@@ -2261,7 +2255,7 @@ class TreeSocket : public InspSocket
                        return true;
 
                log(DEBUG,"In IDLE command");
-               userrec* u = ServerInstance->FindNick(prefix);
+               userrec* u = this->Instance->FindNick(prefix);
 
                if (u)
                {
@@ -2269,10 +2263,10 @@ class TreeSocket : public InspSocket
                        // an incoming request
                        if (params.size() == 1)
                        {
-                               userrec* x = ServerInstance->FindNick(params[0]);
+                               userrec* x = this->Instance->FindNick(params[0]);
                                if ((x) && (IS_LOCAL(x)))
                                {
-                                       userrec* x = ServerInstance->FindNick(params[0]);
+                                       userrec* x = this->Instance->FindNick(params[0]);
                                        log(DEBUG,"Got IDLE");
                                        char signon[MAXBUF];
                                        char idle[MAXBUF];
@@ -2295,7 +2289,7 @@ class TreeSocket : public InspSocket
                        else if (params.size() == 3)
                        {
                                std::string who_did_the_whois = params[0];
-                               userrec* who_to_send_to = ServerInstance->FindNick(who_did_the_whois);
+                               userrec* who_to_send_to = this->Instance->FindNick(who_did_the_whois);
                                if ((who_to_send_to) && (IS_LOCAL(who_to_send_to)))
                                {
                                        log(DEBUG,"Got final IDLE");
@@ -2321,7 +2315,7 @@ class TreeSocket : public InspSocket
                if (params.size() < 2)
                        return true;
 
-               userrec* u = ServerInstance->FindNick(params[0]);
+               userrec* u = this->Instance->FindNick(params[0]);
 
                if (!u)
                        return true;
@@ -2346,22 +2340,22 @@ class TreeSocket : public InspSocket
                if (params.size() == 2)
                {
                        // someone querying our time?
-                       if (ServerInstance->Config->ServerName == params[0])
+                       if (this->Instance->Config->ServerName == params[0])
                        {
-                               userrec* u = ServerInstance->FindNick(params[1]);
+                               userrec* u = this->Instance->FindNick(params[1]);
                                if (u)
                                {
                                        char curtime[256];
                                        snprintf(curtime,256,"%lu",(unsigned long)time(NULL));
                                        params.push_back(curtime);
                                        params[0] = prefix;
-                                       DoOneToOne(ServerInstance->Config->ServerName,"TIME",params,params[0]);
+                                       DoOneToOne(this->Instance->Config->ServerName,"TIME",params,params[0]);
                                }
                        }
                        else
                        {
                                // not us, pass it on
-                               userrec* u = ServerInstance->FindNick(params[1]);
+                               userrec* u = this->Instance->FindNick(params[1]);
                                if (u)
                                        DoOneToOne(prefix,"TIME",params,params[0]);
                        }
@@ -2369,7 +2363,7 @@ class TreeSocket : public InspSocket
                else if (params.size() == 3)
                {
                        // a response to a previous TIME
-                       userrec* u = ServerInstance->FindNick(params[1]);
+                       userrec* u = this->Instance->FindNick(params[1]);
                        if ((u) && (IS_LOCAL(u)))
                        {
                        time_t rawtime = atol(params[2].c_str());
@@ -2397,13 +2391,13 @@ class TreeSocket : public InspSocket
                if (params.size() == 1)
                {
                        std::string stufftobounce = params[0];
-                       this->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" PONG "+stufftobounce);
+                       this->WriteLine(std::string(":")+this->Instance->Config->ServerName+" PONG "+stufftobounce);
                        return true;
                }
                else
                {
                        std::string forwardto = params[1];
-                       if (forwardto == ServerInstance->Config->ServerName)
+                       if (forwardto == this->Instance->Config->ServerName)
                        {
                                // this is a ping for us, send back PONG to the requesting server
                                params[1] = params[0];
@@ -2439,14 +2433,14 @@ class TreeSocket : public InspSocket
                if (CheckDupe)
                {
                        this->WriteLine("ERROR :Server "+servername+" already exists!");
-                       ServerInstance->WriteOpers("*** Server connection from \2"+servername+"\2 denied, already exists");
+                       this->Instance->WriteOpers("*** Server connection from \2"+servername+"\2 denied, already exists");
                        return false;
                }
                TreeServer* Node = new TreeServer(servername,description,ParentOfThis,NULL);
                ParentOfThis->AddChild(Node);
                params[3] = ":" + params[3];
                DoOneToAllButSender(prefix,"SERVER",params,prefix);
-               ServerInstance->WriteOpers("*** Server \002"+prefix+"\002 introduced server \002"+servername+"\002 ("+description+")");
+               this->Instance->WriteOpers("*** Server \002"+prefix+"\002 introduced server \002"+servername+"\002 ("+description+")");
                return true;
        }
 
@@ -2463,7 +2457,7 @@ class TreeSocket : public InspSocket
                if (hops)
                {
                        this->WriteLine("ERROR :Server too far away for authentication");
-                       ServerInstance->WriteOpers("*** Server connection from \2"+sname+"\2 denied, server is too far away for authentication");
+                       this->Instance->WriteOpers("*** Server connection from \2"+sname+"\2 denied, server is too far away for authentication");
                        return false;
                }
                std::string description = params[3];
@@ -2475,7 +2469,7 @@ class TreeSocket : public InspSocket
                                if (CheckDupe)
                                {
                                        this->WriteLine("ERROR :Server "+sname+" already exists on server "+CheckDupe->GetParent()->GetName()+"!");
-                                       ServerInstance->WriteOpers("*** Server connection from \2"+sname+"\2 denied, already exists on server "+CheckDupe->GetParent()->GetName());
+                                       this->Instance->WriteOpers("*** Server connection from \2"+sname+"\2 denied, already exists on server "+CheckDupe->GetParent()->GetName());
                                        return false;
                                }
                                // Begin the sync here. this kickstarts the
@@ -2496,7 +2490,7 @@ class TreeSocket : public InspSocket
                        }
                }
                this->WriteLine("ERROR :Invalid credentials");
-               ServerInstance->WriteOpers("*** Server connection from \2"+sname+"\2 denied, invalid link credentials");
+               this->Instance->WriteOpers("*** Server connection from \2"+sname+"\2 denied, invalid link credentials");
                return false;
        }
 
@@ -2513,7 +2507,7 @@ class TreeSocket : public InspSocket
                if (hops)
                {
                        this->WriteLine("ERROR :Server too far away for authentication");
-                       ServerInstance->WriteOpers("*** Server connection from \2"+sname+"\2 denied, server is too far away for authentication");
+                       this->Instance->WriteOpers("*** Server connection from \2"+sname+"\2 denied, server is too far away for authentication");
                        return false;
                }
                std::string description = params[3];
@@ -2525,7 +2519,7 @@ class TreeSocket : public InspSocket
                                if (CheckDupe)
                                {
                                        this->WriteLine("ERROR :Server "+sname+" already exists on server "+CheckDupe->GetParent()->GetName()+"!");
-                                       ServerInstance->WriteOpers("*** Server connection from \2"+sname+"\2 denied, already exists on server "+CheckDupe->GetParent()->GetName());
+                                       this->Instance->WriteOpers("*** Server connection from \2"+sname+"\2 denied, already exists on server "+CheckDupe->GetParent()->GetName());
                                        return false;
                                }
                                /* If the config says this link is encrypted, but the remote side
@@ -2535,22 +2529,22 @@ class TreeSocket : public InspSocket
                                if ((x->EncryptionKey != "") && (!this->ctx_in))
                                {
                                        this->WriteLine("ERROR :This link requires AES encryption to be enabled. Plaintext connection refused.");
-                                       ServerInstance->WriteOpers("*** Server connection from \2"+sname+"\2 denied, remote server did not enable AES.");
+                                       this->Instance->WriteOpers("*** Server connection from \2"+sname+"\2 denied, remote server did not enable AES.");
                                        return false;
                                }
-                               ServerInstance->WriteOpers("*** Verified incoming server connection from \002"+sname+"\002["+(x->HiddenFromStats ? "<hidden>" : this->GetIP())+"] ("+description+")");
+                               this->Instance->WriteOpers("*** Verified incoming server connection from \002"+sname+"\002["+(x->HiddenFromStats ? "<hidden>" : this->GetIP())+"] ("+description+")");
                                this->InboundServerName = sname;
                                this->InboundDescription = description;
                                // this is good. Send our details: Our server name and description and hopcount of 0,
                                // along with the sendpass from this block.
-                               this->WriteLine(std::string("SERVER ")+ServerInstance->Config->ServerName+" "+x->SendPass+" 0 :"+ServerInstance->Config->ServerDesc);
+                               this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+x->SendPass+" 0 :"+this->Instance->Config->ServerDesc);
                                // move to the next state, we are now waiting for THEM.
                                this->LinkState = WAIT_AUTH_2;
                                return true;
                        }
                }
                this->WriteLine("ERROR :Invalid credentials");
-               ServerInstance->WriteOpers("*** Server connection from \2"+sname+"\2 denied, invalid link credentials");
+               this->Instance->WriteOpers("*** Server connection from \2"+sname+"\2 denied, invalid link credentials");
                return false;
        }
 
@@ -2603,7 +2597,7 @@ class TreeSocket : public InspSocket
                }
                else if ((this->ctx_in) && (command == "AES"))
                {
-                       ServerInstance->WriteOpers("*** \2AES\2: Encryption already enabled on this connection yet %s is trying to enable it twice!",params[0].c_str());
+                       this->Instance->WriteOpers("*** \2AES\2: Encryption already enabled on this connection yet %s is trying to enable it twice!",params[0].c_str());
                }
 
                switch (this->LinkState)
@@ -2671,13 +2665,13 @@ class TreeSocket : public InspSocket
                                                long delta = THEM-time(NULL);
                                                if ((delta < -600) || (delta > 600))
                                                {
-                                                       ServerInstance->WriteOpers("*** \2ERROR\2: Your clocks are out by %d seconds (this is more than ten minutes). Link aborted, \2PLEASE SYNC YOUR CLOCKS!\2",abs(delta));
+                                                       this->Instance->WriteOpers("*** \2ERROR\2: Your clocks are out by %d seconds (this is more than ten minutes). Link aborted, \2PLEASE SYNC YOUR CLOCKS!\2",abs(delta));
                                                        this->WriteLine("ERROR :Your clocks are out by "+ConvToStr(abs(delta))+" seconds (this is more than ten minutes). Link aborted, PLEASE SYNC YOUR CLOCKS!");
                                                        return false;
                                                }
                                                else if ((delta < -60) || (delta > 60))
                                                {
-                                                       ServerInstance->WriteOpers("*** \2WARNING\2: Your clocks are out by %d seconds, please consider synching your clocks.",abs(delta));
+                                                       this->Instance->WriteOpers("*** \2WARNING\2: Your clocks are out by %d seconds, please consider synching your clocks.",abs(delta));
                                                }
                                        }
                                        this->LinkState = CONNECTED;
@@ -2729,7 +2723,7 @@ class TreeSocket : public InspSocket
                                if (prefix != "")
                                {
                                        std::string direction = prefix;
-                                       userrec* t = ServerInstance->FindNick(prefix);
+                                       userrec* t = this->Instance->FindNick(prefix);
                                        if (t)
                                        {
                                                direction = t->server;
@@ -2883,8 +2877,8 @@ class TreeSocket : public InspSocket
                                        std::string sourceserv = this->myhost;
                                        if (params.size() == 3)
                                        {
-                                               userrec* user = ServerInstance->FindNick(params[1]);
-                                               chanrec* chan = ServerInstance->FindChan(params[0]);
+                                               userrec* user = this->Instance->FindNick(params[1]);
+                                               chanrec* chan = this->Instance->FindChan(params[0]);
                                                if (user && chan)
                                                {
                                                        if (!chan->ServerKickUser(user, params[2].c_str(), false))
@@ -2923,7 +2917,7 @@ class TreeSocket : public InspSocket
                                        {
                                                sourceserv = this->InboundServerName;
                                        }
-                                       ServerInstance->WriteOpers("*** Received end of netburst from \2%s\2",sourceserv.c_str());
+                                       this->Instance->WriteOpers("*** Received end of netburst from \2%s\2",sourceserv.c_str());
                                        return true;
                                }
                                else
@@ -2931,7 +2925,7 @@ class TreeSocket : public InspSocket
                                        // not a special inter-server command.
                                        // Emulate the actual user doing the command,
                                        // this saves us having a huge ugly parser.
-                                       userrec* who = ServerInstance->FindNick(prefix);
+                                       userrec* who = this->Instance->FindNick(prefix);
                                        std::string sourceserv = this->myhost;
                                        if (this->InboundServerName != "")
                                        {
@@ -2945,19 +2939,19 @@ class TreeSocket : public InspSocket
                                                         * already exist here. If it does, kill their copy,
                                                         * and our copy.
                                                         */
-                                                       userrec* x = ServerInstance->FindNick(params[0]);
+                                                       userrec* x = this->Instance->FindNick(params[0]);
                                                        if ((x) && (x != who))
                                                        {
                                                                std::deque<std::string> p;
                                                                p.push_back(params[0]);
                                                                p.push_back("Nickname collision ("+prefix+" -> "+params[0]+")");
-                                                               DoOneToMany(ServerInstance->Config->ServerName,"KILL",p);
+                                                               DoOneToMany(this->Instance->Config->ServerName,"KILL",p);
                                                                p.clear();
                                                                p.push_back(prefix);
                                                                p.push_back("Nickname collision");
-                                                               DoOneToMany(ServerInstance->Config->ServerName,"KILL",p);
+                                                               DoOneToMany(this->Instance->Config->ServerName,"KILL",p);
                                                                userrec::QuitUser(this->Instance,x,"Nickname collision ("+prefix+" -> "+params[0]+")");
-                                                               userrec* y = ServerInstance->FindNick(prefix);
+                                                               userrec* y = this->Instance->FindNick(prefix);
                                                                if (y)
                                                                {
                                                                        userrec::QuitUser(this->Instance,y,"Nickname collision");
@@ -2972,7 +2966,7 @@ class TreeSocket : public InspSocket
                                                {
                                                        strparams[q] = params[q].c_str();
                                                }
-                                               if (!ServerInstance->CallCommandHandler(command.c_str(), strparams, params.size(), who))
+                                               if (!this->Instance->CallCommandHandler(command.c_str(), strparams, params.size(), who))
                                                {
                                                        this->WriteLine("ERROR :Unrecognised command '"+std::string(command.c_str())+"' -- possibly loaded mismatched modules");
                                                        return false;
@@ -2983,7 +2977,7 @@ class TreeSocket : public InspSocket
                                                // its not a user. Its either a server, or somethings screwed up.
                                                if (IsServer(prefix))
                                                {
-                                                       target = ServerInstance->Config->ServerName;
+                                                       target = this->Instance->Config->ServerName;
                                                }
                                                else
                                                {
@@ -3014,7 +3008,7 @@ class TreeSocket : public InspSocket
        {
                if (this->LinkState == CONNECTING)
                {
-                       ServerInstance->WriteOpers("*** CONNECT: Connection to \002"+myhost+"\002 timed out.");
+                       this->Instance->WriteOpers("*** CONNECT: Connection to \002"+myhost+"\002 timed out.");
                }
        }
 
@@ -3033,7 +3027,7 @@ class TreeSocket : public InspSocket
                {
                        Squit(s,"Remote host closed the connection");
                }
-               ServerInstance->WriteOpers("Server '\2%s\2' closed the connection.",quitserver.c_str());
+               this->Instance->WriteOpers("Server '\2%s\2' closed the connection.",quitserver.c_str());
        }
 
        virtual int OnIncomingConnection(int newsock, char* ip)
@@ -3053,13 +3047,13 @@ class TreeSocket : public InspSocket
 
                        if (!found)
                        {
-                               ServerInstance->WriteOpers("Server connection from %s denied (no link blocks with that IP address)", ip);
+                               this->Instance->WriteOpers("Server connection from %s denied (no link blocks with that IP address)", ip);
                                close(newsock);
                                return false;
                        }
                }
                TreeSocket* s = new TreeSocket(this->Instance, newsock, ip);
-               ServerInstance->AddSocket(s);
+               this->Instance->AddSocket(s);
                return true;
        }
 };
@@ -3426,6 +3420,8 @@ class ModuleSpanningTree : public Module
                
                Bindings.clear();
 
+               ::ServerInstance = this->ServerInstance;
+
                // Create the root of the tree
                TreeRoot = new TreeServer(ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc);
 
index 96cffd91aa9db83ea077a7ccf4eb4947783dc0e0..2f790c299fff9f73684574248d37d26e5cf275e8 100644 (file)
@@ -47,7 +47,7 @@ using namespace std;
 
 
 
-extern InspIRCd* ServerInstance;
+
 extern chan_hash chanlist;
 
 void spy_userlist(userrec *user,chanrec *c)
index a607f079e37163badfb83316c158974f325bfc84..708f1e3cecd565834365d7c0ec7abb30ef547ed6 100644 (file)
@@ -8,7 +8,7 @@
 
 static char* dummy;
 
-extern InspIRCd* ServerInstance;
+
 
 class SSLMode : public ModeHandler
 {
index db5a30f125ea9379d01b152af75f24ab4848e03c..994a50f33d4837c17de3aa7df08febcaecd84364 100644 (file)
@@ -26,7 +26,7 @@ using namespace std;
 
 /* $ModDesc: Provides channel +S mode (strip ansi colour) */
 
-extern InspIRCd* ServerInstance;
+
 
 class ChannelStripColor : public ModeHandler
 {
index b1199e878ff9da1a8cfc6d1d3502528bab59727d..23001d203959b814f32879fea05c830f0f48e63a 100644 (file)
@@ -22,7 +22,7 @@
 
 /* $ModDesc: Provides the SWHOIS command which allows setting of arbitary WHOIS lines */
 
-extern InspIRCd* ServerInstance;
+
 
 class cmd_swhois : public command_t
 {
index acffe2ee48df239f391d91dca7eacd73848bed06..9c5b1ab237550d4eee5303456d48580e21fd1dbc 100644 (file)
@@ -26,7 +26,7 @@ using namespace std;
 
 /* $ModDesc: Povides a proof-of-concept test /WOOT command */
 
-extern InspIRCd* ServerInstance;
+
 
 class MyV6Resolver : public Resolver
 {
index 3d38affabcc5f707cd01cc1ba09c89fce5b44834..30aba781c8f9a021320fac4f31a9bfb45f629424 100644 (file)
@@ -29,7 +29,7 @@ using namespace std;
 #include "inspircd.h"
 
 
-extern InspIRCd* ServerInstance;
+
 
 class TimedBan : public classbase
 {
index a52584661b0173e31156263be41b9d11f1961ea3..37574ea025b72c63a019bd3cd65829fb1ec6f8e4 100644 (file)
@@ -28,7 +28,7 @@ using namespace std;
 /* $ModDesc: Provides /tline command used to test who a mask matches */
 
 
-extern InspIRCd* ServerInstance;
+
         
 class cmd_tline : public command_t
 {
index a1b483690469bc4c8cf4f00ba5f13e671b0f29f1..3af5a7e6f0f54d9391f82fe79d96ca3d03b1ef6f 100644 (file)
@@ -27,7 +27,7 @@ using namespace std;
 #include "inspircd.h"
 
 
-extern InspIRCd* ServerInstance;
+
         
 class cmd_uninvite : public command_t
 {
index 48c343fa908984723ba1e90931360119007321aa..7389038eacfcb4356b126cf90cb1c3f6ae35294d 100644 (file)
@@ -27,7 +27,7 @@ using namespace std;
 /* $ModDesc: Provides support for USERIP command */
 
 
-extern InspIRCd* ServerInstance;
+
 
 class cmd_userip : public command_t
 {
index 5b911632c580df557a1c71a87145c08f3bb86515..50c656a342bff1ba0e1cf3de5f52df23710312f3 100644 (file)
@@ -29,7 +29,7 @@ using namespace std;
 /* $ModDesc: Provides support for the /watch command */
 
 
-extern InspIRCd* ServerInstance;
+
 
 class watchentry : public classbase
 {