git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4863
e03df62e-2008-0410-955e-
edbf42e46eb7
68 files changed:
/* $ModDesc: Provides aliases of commands. */
/* $ModDesc: Provides aliases of commands. */
-extern InspIRCd* ServerInstance;
class Alias : public classbase
{
class Alias : public classbase
{
// 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
// 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
{
class BanException : public ListModeBase
{
/* $ModDesc: Attempt to block /amsg, at least some of the irritating mIRC scripts. */
extern time_t TIME;
/* $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 };
enum BlockAction { IBLOCK_KILL, IBLOCK_KILLOPERS, IBLOCK_NOTICE, IBLOCK_NOTICEOPERS, IBLOCK_SILENT };
/* $ModDesc: Provides support for channel mode +P to block all-CAPS channel messages and notices */
/* $ModDesc: Provides support for channel mode +P to block all-CAPS channel messages and notices */
-extern InspIRCd* ServerInstance;
class BlockCaps : public ModeHandler
{
class BlockCaps : public ModeHandler
{
/* $ModDesc: Provides support for unreal-style channel mode +c */
/* $ModDesc: Provides support for unreal-style channel mode +c */
-extern InspIRCd* ServerInstance;
class BlockColor : public ModeHandler
{
class BlockColor : public ModeHandler
{
/* $ModDesc: Provides support for unreal-style umode +B */
/* $ModDesc: Provides support for unreal-style umode +B */
-extern InspIRCd* ServerInstance;
class BotMode : public ModeHandler
{
class BotMode : public ModeHandler
{
/* $ModDesc: Gives /cban, aka C:lines. Think Q:lines, for channels. */
/* $ModDesc: Gives /cban, aka C:lines. Think Q:lines, for channels. */
-extern InspIRCd* ServerInstance;
class CBan : public classbase
{
class CBan : public classbase
{
+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;
class ModuleCBan : public Module
{
cmd_cban* mycommand;
{
return Version(1,0,0,1,VF_VENDOR);
}
{
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;
- for (cbanlist::iterator iter = cbans.begin(); iter != cbans.end(); iter++)
- /* 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
{
class ModuleCBanFactory : public ModuleFactory
{
/* $ModDesc: Provides user and channel +G mode */
/* $ModDesc: Provides user and channel +G mode */
-extern InspIRCd* ServerInstance;
class CensorException : public ModuleException
{
class CensorException : public ModuleException
{
/* $ModDesc: Change user's hosts connecting from known CGI:IRC hosts */
/* $ModDesc: Change user's hosts connecting from known CGI:IRC hosts */
-extern InspIRCd* ServerInstance;
enum CGItype { PASS, IDENT, PASSFIRST, IDENTFIRST };
enum CGItype { PASS, IDENT, PASSFIRST, IDENTFIRST };
/* $ModDesc: Provides channel-specific censor lists (like mode +G but varies from channel to channel) */
/* $ModDesc: Provides channel-specific censor lists (like mode +G but varies from channel to channel) */
-extern InspIRCd* ServerInstance;
class ChanFilter : public ListModeBase
{
class ChanFilter : public ListModeBase
{
/* $ModDesc: Provides channel modes +a and +q */
/* $ModDesc: Provides channel modes +a and +q */
-extern InspIRCd* ServerInstance;
const char* fakevalue = "on";
const char* fakevalue = "on";
/* $ModDesc: Provides the /check command to retrieve information on a user, channel, or IP address */
/* $ModDesc: Provides the /check command to retrieve information on a user, channel, or IP address */
-extern InspIRCd* ServerInstance;
class cmd_check : public command_t
{
class cmd_check : public command_t
{
/* $ModDesc: Provides support for the CHGHOST command */
/* $ModDesc: Provides support for the CHGHOST command */
-extern InspIRCd* ServerInstance;
class cmd_chghost : public command_t
{
class cmd_chghost : public command_t
{
/* $ModDesc: Provides support for the CHGIDENT command */
/* $ModDesc: Provides support for the CHGIDENT command */
-extern InspIRCd* ServerInstance;
class cmd_chgident : public command_t
{
class cmd_chgident : public command_t
{
/* $ModDesc: Provides masking of user hostnames */
/* $ModDesc: Provides masking of user hostnames */
-extern InspIRCd* ServerInstance;
/* The four core functions - F1 is optimized somewhat */
/* The four core functions - F1 is optimized somewhat */
/* $ModDesc: Sends the /LUSERS on connect */
/* $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
// This has to be the simplest module ever.
// The RFC doesnt specify that you should send the /LUSERS numerics
/* $ModDesc: Forces connecting clients to send a PONG message back to the server before they can complete their connection */
/* $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)
{
char* RandString(unsigned int length)
{
int conns = 0, throttled = 0;
extern time_t TIME;
int conns = 0, throttled = 0;
extern time_t TIME;
-extern InspIRCd* ServerInstance;
class ModuleConnFlood : public Module
{
class ModuleConnFlood : public Module
{
#include "modules.h"
#include "inspircd.h"
#include "modules.h"
#include "inspircd.h"
-extern InspIRCd* ServerInstance;
class cmd_devoice : public command_t
{
class cmd_devoice : public command_t
{
/* $ModDesc: An enhanced version of the unreal m_filter.so used by chatspike.net */
/* $ModDesc: An enhanced version of the unreal m_filter.so used by chatspike.net */
-extern InspIRCd* ServerInstance;
class Filter : public classbase
{
class Filter : public classbase
{
/* $ModDesc: Provides support for GLOBOPS and user mode +g */
/* $ModDesc: Provides support for GLOBOPS and user mode +g */
-extern InspIRCd* ServerInstance;
class cmd_globops : public command_t
{
class cmd_globops : public command_t
{
// Global Vars
static ConfigReader *helpop;
// Global Vars
static ConfigReader *helpop;
-extern InspIRCd* ServerInstance;
bool do_helpop(const char**, int, userrec*);
void sendtohelpop(userrec*, int, const char**);
bool do_helpop(const char**, int, userrec*);
void sendtohelpop(userrec*, int, const char**);
-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);
-}
-
-
-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)
+ 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
{
class HelpopException : public ModuleException
{
/* $ModDesc: Provides masking of user hostnames in a different way to m_cloaking */
/* $ModDesc: Provides masking of user hostnames in a different way to m_cloaking */
-extern InspIRCd* ServerInstance;
class Host : public classbase
{
class Host : public classbase
{
-extern InspIRCd* ServerInstance;
static ModuleHttp* HttpModule;
extern time_t TIME;
static ModuleHttp* HttpModule;
extern time_t TIME;
if (InternalState == HTTP_LISTEN)
{
HttpSocket* s = new HttpSocket(this->Instance, newsock, ip, index);
if (InternalState == HTTP_LISTEN)
{
HttpSocket* s = new HttpSocket(this->Instance, newsock, ip, index);
- ServerInstance->AddSocket(s);
+ this->Instance->AddSocket(s);
/* $ModDesc: Provides statistics over HTTP via m_httpd.so */
/* $ModDesc: Provides statistics over HTTP via m_httpd.so */
-extern InspIRCd* ServerInstance;
typedef std::map<irc::string,int> StatsHash;
typedef StatsHash::iterator StatsIter;
typedef std::map<irc::string,int> StatsHash;
typedef StatsHash::iterator StatsIter;
#include "modules.h"
#include "inspircd.h"
#include "modules.h"
#include "inspircd.h"
-extern InspIRCd* ServerInstance;
extern userrec* fd_ref_table[MAX_DESCRIPTORS];
extern userrec* fd_ref_table[MAX_DESCRIPTORS];
{
if (u && (fd_ref_table[ufd] == u))
{
{
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));
{
strlcpy(u->ident,section,IDENTMAX);
log(DEBUG,"IDENT SET: "+std::string(u->ident));
/* $ModDesc: Provides channel mode +j (join flood protection) */
/* $ModDesc: Provides channel mode +j (join flood protection) */
-extern InspIRCd* ServerInstance;
class joinfloodsettings : public classbase
{
class joinfloodsettings : public classbase
{
/* $ModDesc: Provides channel mode +J (delay rejoin after kick) */
/* $ModDesc: Provides channel mode +J (delay rejoin after kick) */
-extern InspIRCd* ServerInstance;
inline int strtoint(const std::string &str)
{
inline int strtoint(const std::string &str)
{
/* $ModDesc: Provides support for /KNOCK and mode +K */
/* $ModDesc: Provides support for /KNOCK and mode +K */
-extern InspIRCd* ServerInstance;
class cmd_knock : public command_t
{
class cmd_knock : public command_t
{
/* $ModDesc: Provides channel mode +f (message flood protection) */
/* $ModDesc: Provides channel mode +f (message flood protection) */
-extern InspIRCd* ServerInstance;
class floodsettings : public classbase
{
class floodsettings : public classbase
{
/* $ModDesc: Provides the NICKLOCK command, allows an oper to chage a users nick and lock them to it until they quit */
/* $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
{
class cmd_nicklock : public command_t
{
/* $ModDesc: Provides support for unreal-style channel mode +c */
/* $ModDesc: Provides support for unreal-style channel mode +c */
-extern InspIRCd* ServerInstance;
class NoCTCP : public ModeHandler
{
class NoCTCP : public ModeHandler
{
/* $ModDesc: Provides support for unreal-style channel mode +V */
/* $ModDesc: Provides support for unreal-style channel mode +V */
-extern InspIRCd* ServerInstance;
class NoInvite : public ModeHandler
{
class NoInvite : public ModeHandler
{
/* $ModDesc: Provides support for unreal-style channel mode +Q */
/* $ModDesc: Provides support for unreal-style channel mode +Q */
-extern InspIRCd* ServerInstance;
class NoKicks : public ModeHandler
{
class NoKicks : public ModeHandler
{
/* $ModDesc: Provides support for unreal-style GLOBOPS and umode +g */
/* $ModDesc: Provides support for unreal-style GLOBOPS and umode +g */
-extern InspIRCd* ServerInstance;
class NoNicks : public ModeHandler
{
class NoNicks : public ModeHandler
{
/* $ModDesc: Provides support for unreal-style channel mode +T */
/* $ModDesc: Provides support for unreal-style channel mode +T */
-extern InspIRCd* ServerInstance;
class NoNotice : public ModeHandler
{
class NoNotice : public ModeHandler
{
/* $ModDesc: Provides support for oper-only chans via the +O channel mode */
/* $ModDesc: Provides support for oper-only chans via the +O channel mode */
-extern InspIRCd* ServerInstance;
class OperChans : public ModeHandler
{
class OperChans : public ModeHandler
{
/* $ModDesc: Forces opers to join the specified channel(s) on oper-up */
/* $ModDesc: Forces opers to join the specified channel(s) on oper-up */
-extern InspIRCd* ServerInstance;
class ModuleOperjoin : public Module
{
class ModuleOperjoin : public Module
{
/* $ModDesc: Gives each oper type a 'level', cannot kill opers 'above' your level. */
/* $ModDesc: Gives each oper type a 'level', cannot kill opers 'above' your level. */
-extern InspIRCd* ServerInstance;
class ModuleOperLevels : public Module
{
class ModuleOperLevels : public Module
{
/* $ModDesc: Provides support for unreal-style oper-override */
/* $ModDesc: Provides support for unreal-style oper-override */
-extern InspIRCd* ServerInstance;
typedef std::map<std::string,std::string> override_t;
typedef std::map<std::string,std::string> override_t;
#include "modules.h"
#include "inspircd.h"
#include "modules.h"
#include "inspircd.h"
-extern InspIRCd* ServerInstance;
/* $ModDesc: Provides support for user parking/unparking */
/* $ModDesc: Provides support for user parking/unparking */
/* $ModDesc: Provides channel mode +L (limit redirection) */
/* $ModDesc: Provides channel mode +L (limit redirection) */
-extern InspIRCd* ServerInstance;
class Redirect : public ModeHandler
{
class Redirect : public ModeHandler
{
* eg: +h can remove +hv and users with no modes. +a can remove +aohv and users with no modes.
*/
* 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;
class RemoveBase
{
private:
bool& supportnokicks;
+ InspIRCd* ServerInstance;
- RemoveBase(bool& snk) : supportnokicks(snk)
+ RemoveBase(InspIRCd* Instance, bool& snk) : supportnokicks(snk), ServerInstance(Instance)
class cmd_remove : public command_t, public RemoveBase
{
public:
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>]";
{
this->source = "m_remove.so";
syntax = "<nick> <channel> [<reason>]";
class cmd_fpart : public command_t, public RemoveBase
{
public:
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>]";
{
this->source = "m_remove.so";
syntax = "<channel> <nick> [<reason>]";
-extern InspIRCd* ServerInstance;
class ListData : public classbase
{
class ListData : public classbase
{
char buffer[MAXBUF];
chanrec *chan;
char buffer[MAXBUF];
chanrec *chan;
+ InspIRCd* ServerInstance;
- ListTimer(long interval) : InspTimer(interval,TIME)
+ ListTimer(InspIRCd* Instance, long interval) : InspTimer(interval,TIME), ServerInstance(Instance)
- ListTimer* MyTimer = new ListTimer(1);
+ ListTimer* MyTimer = new ListTimer(ServerInstance,1);
ServerInstance->Timers->AddTimer(MyTimer);
}
};
ServerInstance->Timers->AddTimer(MyTimer);
}
};
public:
ModuleSafeList(InspIRCd* Me) : Module::Module(Me)
{
public:
ModuleSafeList(InspIRCd* Me) : Module::Module(Me)
{
- MyTimer = new ListTimer(1);
+ MyTimer = new ListTimer(ServerInstance,1);
ServerInstance->Timers->AddTimer(MyTimer);
}
ServerInstance->Timers->AddTimer(MyTimer);
}
/* $ModDesc: Provides support for unreal-style SAJOIN command */
/* $ModDesc: Provides support for unreal-style SAJOIN command */
-extern InspIRCd* ServerInstance;
class cmd_sajoin : public command_t
{
class cmd_sajoin : public command_t
{
-extern InspIRCd* ServerInstance;
class cmd_samode : public command_t
{
class cmd_samode : public command_t
{
/* $ModDesc: Provides support for SANICK command */
/* $ModDesc: Provides support for SANICK command */
-extern InspIRCd* ServerInstance;
class cmd_sanick : public command_t
class cmd_sanick : public command_t
/* $ModDesc: Provides support for unreal-style SAPART command */
/* $ModDesc: Provides support for unreal-style SAPART command */
-extern InspIRCd* ServerInstance;
class cmd_sapart : public command_t
{
class cmd_sapart : public command_t
{
/* $ModDesc: Provides support for an SAQUIT command, exits user with a reason */
/* $ModDesc: Provides support for an SAQUIT command, exits user with a reason */
-extern InspIRCd* ServerInstance;
class cmd_saquit : public command_t
{
class cmd_saquit : public command_t
{
/* $ModDesc: A module overriding /list, and making it safe - stop those sendq problems. */
/* $ModDesc: A module overriding /list, and making it safe - stop those sendq problems. */
-extern InspIRCd* ServerInstance;
class ModuleSecureList : public Module
{
class ModuleSecureList : public Module
{
/* $ModDesc: Povides support for services +r user/chan modes and more */
/* $ModDesc: Povides support for services +r user/chan modes and more */
-extern InspIRCd* ServerInstance;
class Channel_r : public ModeHandler
{
class Channel_r : public ModeHandler
{
/* $ModDesc: Povides support for ircu-style services accounts, including chmode +R, etc. */
/* $ModDesc: Povides support for ircu-style services accounts, including chmode +R, etc. */
-extern InspIRCd* ServerInstance;
class AChannel_R : public ModeHandler
{
class AChannel_R : public ModeHandler
{
/* $ModDesc: Provides support for the SETHOST command */
/* $ModDesc: Provides support for the SETHOST command */
-extern InspIRCd* ServerInstance;
class cmd_sethost : public command_t
{
class cmd_sethost : public command_t
{
/* $ModDesc: Provides support for the SETIDENT command */
/* $ModDesc: Provides support for the SETIDENT command */
-extern InspIRCd* ServerInstance;
class cmd_setident : public command_t
{
class cmd_setident : public command_t
{
/* $ModDesc: Allows opers to set their idle time */
/* $ModDesc: Allows opers to set their idle time */
-extern InspIRCd* ServerInstance;
class cmd_setidle : public command_t
{
class cmd_setidle : public command_t
{
/* $ModDesc: Provides support for the SETNAME command */
/* $ModDesc: Provides support for the SETNAME command */
-extern InspIRCd* ServerInstance;
class cmd_setname : public command_t
{
class cmd_setname : public command_t
{
/* $ModDesc: Allows opers to set +W to see when a user uses WHOIS on them */
/* $ModDesc: Allows opers to set +W to see when a user uses WHOIS on them */
-extern InspIRCd* ServerInstance;
class SeeWhois : public ModeHandler
{
class SeeWhois : public ModeHandler
{
#include "socket.h"
#include "helperfuncs.h"
#include "inspircd.h"
#include "socket.h"
#include "helperfuncs.h"
#include "inspircd.h"
#include "inspstring.h"
#include "hashcomp.h"
#include "xline.h"
#include "inspstring.h"
#include "hashcomp.h"
#include "xline.h"
class ModuleSpanningTree;
static ModuleSpanningTree* TreeProtocolModule;
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
/* Any socket can have one of five states at any one time.
* The LISTENER state indicates a socket which is listening
class TreeServer : 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 */
TreeServer* Parent; /* Parent entry */
TreeServer* Route; /* Route entry */
std::vector<TreeServer*> Children; /* List of child objects */
/* 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.
*/
/* 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(InspIRCd* Instance) : ServerInstance(Instance)
{
Parent = NULL;
ServerName = "";
{
Parent = NULL;
ServerName = "";
{
for (server_hash::iterator i = serverlist.begin(); i != serverlist.end(); i++)
{
{
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;
return i->second;
}
return NULL;
keylength = key.length();
if (!(keylength == 16 || keylength == 24 || keylength == 32))
{
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
{
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\
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\
{
if (x->Name == this->myhost)
{
{
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))
{
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.");
- 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->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);
* If that happens the connection hangs here until it's closed. Unlikely
* and rather harmless.
*/
* 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(!)");
*/
if (e == I_ERR_CONNECT)
{
*/
if (e == I_ERR_CONNECT)
{
- ServerInstance->WriteOpers("*** Connection failed: Connection refused");
+ this->Instance->WriteOpers("*** Connection failed: Connection refused");
std::vector<std::string> modlist;
std::string capabilities = "";
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++)
}
sort(modlist.begin(),modlist.end());
for (unsigned int i = 0; i < modlist.size(); i++)
quitserver = this->InboundServerName;
}
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;
}
this->WriteLine("ERROR :CAPAB mismatch; My capabilities: '"+this->MyCapabilities()+"'");
return false;
}
DoOneToAllButSender(Current->GetParent()->GetName(),"SQUIT",params,Current->GetName());
if (Current->GetParent() == TreeRoot)
{
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);
- 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;
}
num_lost_servers = 0;
num_lost_users = 0;
Current->Tidy();
Current->GetParent()->DelChild(Current);
DELETE(Current);
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);
std::string sourceserv;
/* Are we dealing with an FMODE from a user, or from a server? */
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 */
if (who)
{
/* FMODE from a user, set sourceserv to the users server name */
else
{
/* FMODE from a server, create a fake user to receive mode feedback */
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 */
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 */
}
/* Extract the TS value of the object, either userrec or chanrec */
}
/* 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)
chanrec* chan = NULL;
time_t ourTS = 0;
if (dst)
- chan = ServerInstance->FindChan(params[0]);
+ chan = this->Instance->FindChan(params[0]);
if (chan)
{
ourTS = chan->age;
if (chan)
{
ourTS = chan->age;
/* We only care about whats being set,
* not whats being unset
*/
/* 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()))
{
if ((mh) && (mh->GetNumParams(adding) > 0) && (!mh->IsListMode()))
{
- mh = ServerInstance->ModeGrok->FindMode(*x, chan ? MODETYPE_CHANNEL : MODETYPE_USER);
+ mh = this->Instance->ModeGrok->FindMode(*x, chan ? MODETYPE_CHANNEL : MODETYPE_USER);
- mh = ServerInstance->ModeGrok->FindMode(*x, chan ? MODETYPE_CHANNEL : MODETYPE_USER);
+ mh = this->Instance->ModeGrok->FindMode(*x, chan ? MODETYPE_CHANNEL : MODETYPE_USER);
newparams.push_back(params[0]);
newparams.push_back(ConvToStr(ourTS));
newparams.push_back(to_bounce+params_to_bounce);
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 (smode)
{
log(DEBUG,"Send mode");
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");
}
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! */
}
/* HOT POTATO! PASS IT ON! */
}
else
/* U-lined servers always win regardless of their TS */
}
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.
{
/* Bounce the mode back to its sender.* We use our lower TS, so the other end
* SHOULD accept it, if its clock is right.
break;
default:
/* Find the mode handler for this mode */
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.
/* Got a mode handler?
* This also prevents us bouncing modes we have no handler for.
/* 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 */
/* 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
log(DEBUG,"FMODE bounced intelligently, our TS less than theirs and the other server is NOT a uline.");
}
else
/* The server was ulined, but something iffy is up with the TS.
* Sound the alarm bells!
*/
/* 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)
}
/* 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);
- ServerInstance->CallCommandHandler("MODE", modelist, n, who);
+ this->Instance->CallCommandHandler("MODE", modelist, n, who);
/* HOT POTATO! PASS IT ON! */
DoOneToAllButSender(source,"FMODE",params,sourceserv);
/* HOT POTATO! PASS IT ON! */
DoOneToAllButSender(source,"FMODE",params,sourceserv);
time_t ts = atoi(params[1].c_str());
std::string nsource = source;
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))
if (c)
{
if ((ts >= c->topicset) || (!*c->topic))
*/
if (oldtopic != params[3])
{
*/
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);
if (!user)
{
c->WriteChannelWithServ(source.c_str(), "TOPIC %s :%s", c->name, c->topic);
time_t TS = atoi(params[1].c_str());
char* key = "";
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;
if (chan)
{
key = chan->key;
* channel will let the other side apply their modes.
*/
time_t ourTS = time(NULL)+600;
* 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;
if (us)
{
ourTS = us->age;
strlcat(modestring,"v",MAXBUF);
break;
}
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);
if (who)
{
chanrec::JoinUser(this->Instance, who, channel.c_str(), true, key);
/* theres a mode for this user. push them onto the mode queue, and flush it
* if there are more than MAXMODES to go.
*/
/* 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");
{
/* 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);
if (ourTS != TS)
{
log(DEFAULT,"Channel TS for %s changed from %lu to %lu",us->name,ourTS,TS);
}
// tell everyone to bounce the modes. bad modes, bad!
}
// 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;
}
strcpy(mode_users[1],"+");
modectr = 2;
if (ourTS >= TS)
{
log(DEBUG,"Our our channel newer than theirs, accepting their modes");
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);
if (ourTS != TS)
{
log(DEFAULT,"Channel TS for %s changed from %lu to %lu",us->name,ourTS,TS);
}
params.push_back(mode_users[x]);
}
}
params.push_back(mode_users[x]);
}
- DoOneToMany(ServerInstance->Config->ServerName,"FMODE",params);
+ DoOneToMany(this->Instance->Config->ServerName,"FMODE",params);
{
if (params.size() >= 2)
{
{
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());
if (c)
{
time_t theirTS = atoi(params[1].c_str());
- DoOneToAllButSender(ServerInstance->Config->ServerName,"SYNCTS",params,source);
+ DoOneToAllButSender(this->Instance->Config->ServerName,"SYNCTS",params,source);
return true;
if (params.size() > 8)
{
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
return true;
}
// NICK age nick host dhost ident +modes ip :gecos
{
// 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);
{
// 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");
else
_new->SetSockAddr(AF_INET, params[6].c_str(), 0);
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);
params[7] = ":" + params[7];
DoOneToAllButSender(source,"NICK",params,source);
{
log(DEBUG,"Sending FJOINs to other server for %s",c->name);
char list[MAXBUF];
{
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);
- 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;
int numusers = 0;
char* ptr = list + dlen;
if (curlen > (480-NICKMAX))
{
this->WriteLine(list);
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;
ptr = list + dlen;
ptrlen = 0;
numusers = 0;
{
modes.append("v");
params.append(specific_voice[y]->nick).append(" ");
{
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(" ");
}
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);
{
modes.append("v");
params.append(specific_voice[y]->nick).append(" ");
{
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(" ");
}
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(" ");
}
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];
}
/* 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 */
const char* sn = n.c_str();
int iterations = 0;
/* Yes, these arent too nice looking, but they get the job done */
char data[MAXBUF];
std::deque<std::string> list;
int iterations = 0;
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++)
{
const char* sn = n.c_str();
for (chan_hash::iterator c = this->Instance->chanlist.begin(); c != this->Instance->chanlist.end(); c++, iterations++)
{
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);
}
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++)
{
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]));
{
this->WriteLine(":"+std::string(u->second->nick)+" AWAY :"+std::string(u->second->awaymsg));
}
{
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++)
{
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]));
std::string endburst = "ENDBURST";
// Because by the end of the netburst, it could be gone!
std::string name = s->GetName();
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(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 */
/* Send server tree */
this->SendServers(TreeRoot,s,1);
/* Send users and their oper status */
/* Send everything else (channel modes, xlines etc) */
this->SendChannelModes(s);
this->SendXLines(s);
/* 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);
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
}
/* This function is called when we receive data from a remote
{
if (params.size() < 1)
return false;
{
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;
}
/* we will return false to cause the socket to close. */
return false;
}
*/
if (params.size() > 1)
{
*/
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;
{
/* 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;
if (source)
{
std::deque<std::string> par;
for (size_t i = 0; i < results.size(); i++)
{
par[1] = "::" + results[i];
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 */
}
}
}
else
{
/* Pass it on */
- userrec* source = ServerInstance->FindNick(prefix);
+ userrec* source = this->Instance->FindNick(prefix);
if (source)
DoOneToOne(prefix, "STATS", params, params[1]);
}
if (source)
DoOneToOne(prefix, "STATS", params, params[1]);
}
return true;
}
std::string opertype = params[0];
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;
if (u)
{
u->modes[UM_OPERATOR] = 1;
if (params.size() < 3)
return true;
if (params.size() < 3)
return true;
- userrec* u = ServerInstance->FindNick(params[0]);
+ userrec* u = this->Instance->FindNick(params[0]);
if (params.size() < 2)
return true;
if (params.size() < 2)
return true;
- userrec* u = ServerInstance->FindNick(params[0]);
+ userrec* u = this->Instance->FindNick(params[0]);
std::string servermask = params[0];
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);
ReadConfiguration(false);
}
DoOneToAllButSender(prefix,"REHASH",params,prefix);
return true;
std::string nick = params[0];
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);
else
{
std::string forwardto = params[1];
else
{
std::string forwardto = params[1];
- if (forwardto == ServerInstance->Config->ServerName)
+ if (forwardto == this->Instance->Config->ServerName)
{
/*
* this is a PONG for us
{
/*
* this is a PONG for us
* 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.
*/
* 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 (params[0] == "*")
{
{
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()) == '#')
{
}
else if (*(params[0].c_str()) == '#')
{
- chanrec* c = ServerInstance->FindChan(params[0]);
+ chanrec* c = this->Instance->FindChan(params[0]);
- 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()) != '#')
{
}
}
else if (*(params[0].c_str()) != '#')
{
- userrec* u = ServerInstance->FindNick(params[0]);
+ userrec* u = this->Instance->FindNick(params[0]);
- 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]));
if (params.size() < 1)
return true;
if (params.size() < 1)
return true;
- userrec* u = ServerInstance->FindNick(prefix);
+ userrec* u = this->Instance->FindNick(prefix);
break;
default:
/* Just in case... */
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;
}
propogate = false;
break;
}
{
if (atoi(params[4].c_str()))
{
{
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());
- 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);
}
params[5] = ":" + params[5];
DoOneToAllButSender(prefix,"ADDLINE",params,prefix);
if (params.size() < 1)
return true;
if (params.size() < 1)
return true;
- userrec* u = ServerInstance->FindNick(prefix);
+ userrec* u = this->Instance->FindNick(prefix);
return true;
log(DEBUG,"In IDLE command");
return true;
log(DEBUG,"In IDLE command");
- userrec* u = ServerInstance->FindNick(prefix);
+ userrec* u = this->Instance->FindNick(prefix);
// an incoming request
if (params.size() == 1)
{
// 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)))
{
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];
log(DEBUG,"Got IDLE");
char signon[MAXBUF];
char idle[MAXBUF];
else if (params.size() == 3)
{
std::string who_did_the_whois = params[0];
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");
if ((who_to_send_to) && (IS_LOCAL(who_to_send_to)))
{
log(DEBUG,"Got final IDLE");
if (params.size() < 2)
return true;
if (params.size() < 2)
return true;
- userrec* u = ServerInstance->FindNick(params[0]);
+ userrec* u = this->Instance->FindNick(params[0]);
if (params.size() == 2)
{
// someone querying our time?
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;
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
}
}
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]);
}
if (u)
DoOneToOne(prefix,"TIME",params,params[0]);
}
else if (params.size() == 3)
{
// a response to a previous TIME
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());
if ((u) && (IS_LOCAL(u)))
{
time_t rawtime = atol(params[2].c_str());
if (params.size() == 1)
{
std::string stufftobounce = params[0];
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];
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];
{
// this is a ping for us, send back PONG to the requesting server
params[1] = params[0];
if (CheckDupe)
{
this->WriteLine("ERROR :Server "+servername+" already exists!");
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);
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+")");
if (hops)
{
this->WriteLine("ERROR :Server too far away for authentication");
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];
return false;
}
std::string description = params[3];
if (CheckDupe)
{
this->WriteLine("ERROR :Server "+sname+" already exists on server "+CheckDupe->GetParent()->GetName()+"!");
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
return false;
}
// Begin the sync here. this kickstarts the
}
}
this->WriteLine("ERROR :Invalid credentials");
}
}
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");
if (hops)
{
this->WriteLine("ERROR :Server too far away for authentication");
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];
return false;
}
std::string description = params[3];
if (CheckDupe)
{
this->WriteLine("ERROR :Server "+sname+" already exists on server "+CheckDupe->GetParent()->GetName()+"!");
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
return false;
}
/* If the config says this link is encrypted, but the remote side
if ((x->EncryptionKey != "") && (!this->ctx_in))
{
this->WriteLine("ERROR :This link requires AES encryption to be enabled. Plaintext connection refused.");
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.");
- 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->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");
// 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");
}
else if ((this->ctx_in) && (command == "AES"))
{
}
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)
}
switch (this->LinkState)
long delta = THEM-time(NULL);
if ((delta < -600) || (delta > 600))
{
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))
{
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;
}
}
this->LinkState = CONNECTED;
if (prefix != "")
{
std::string direction = prefix;
if (prefix != "")
{
std::string direction = prefix;
- userrec* t = ServerInstance->FindNick(prefix);
+ userrec* t = this->Instance->FindNick(prefix);
if (t)
{
direction = t->server;
if (t)
{
direction = t->server;
std::string sourceserv = this->myhost;
if (params.size() == 3)
{
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))
if (user && chan)
{
if (!chan->ServerKickUser(user, params[2].c_str(), false))
{
sourceserv = this->InboundServerName;
}
{
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());
// not a special inter-server command.
// Emulate the actual user doing the command,
// this saves us having a huge ugly parser.
// 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 != "")
{
std::string sourceserv = this->myhost;
if (this->InboundServerName != "")
{
* already exist here. If it does, kill their copy,
* and our copy.
*/
* 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]+")");
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");
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::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");
if (y)
{
userrec::QuitUser(this->Instance,y,"Nickname collision");
{
strparams[q] = params[q].c_str();
}
{
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;
{
this->WriteLine("ERROR :Unrecognised command '"+std::string(command.c_str())+"' -- possibly loaded mismatched modules");
return false;
// its not a user. Its either a server, or somethings screwed up.
if (IsServer(prefix))
{
// its not a user. Its either a server, or somethings screwed up.
if (IsServer(prefix))
{
- target = ServerInstance->Config->ServerName;
+ target = this->Instance->Config->ServerName;
{
if (this->LinkState == CONNECTING)
{
{
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.");
{
Squit(s,"Remote host closed the connection");
}
{
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)
}
virtual int OnIncomingConnection(int newsock, char* ip)
- 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);
close(newsock);
return false;
}
}
TreeSocket* s = new TreeSocket(this->Instance, newsock, ip);
- ServerInstance->AddSocket(s);
+ this->Instance->AddSocket(s);
+ ::ServerInstance = this->ServerInstance;
+
// Create the root of the tree
TreeRoot = new TreeServer(ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc);
// Create the root of the tree
TreeRoot = new TreeServer(ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc);
-extern InspIRCd* ServerInstance;
extern chan_hash chanlist;
void spy_userlist(userrec *user,chanrec *c)
extern chan_hash chanlist;
void spy_userlist(userrec *user,chanrec *c)
-extern InspIRCd* ServerInstance;
class SSLMode : public ModeHandler
{
class SSLMode : public ModeHandler
{
/* $ModDesc: Provides channel +S mode (strip ansi colour) */
/* $ModDesc: Provides channel +S mode (strip ansi colour) */
-extern InspIRCd* ServerInstance;
class ChannelStripColor : public ModeHandler
{
class ChannelStripColor : public ModeHandler
{
/* $ModDesc: Provides the SWHOIS command which allows setting of arbitary WHOIS lines */
/* $ModDesc: Provides the SWHOIS command which allows setting of arbitary WHOIS lines */
-extern InspIRCd* ServerInstance;
class cmd_swhois : public command_t
{
class cmd_swhois : public command_t
{
/* $ModDesc: Povides a proof-of-concept test /WOOT command */
/* $ModDesc: Povides a proof-of-concept test /WOOT command */
-extern InspIRCd* ServerInstance;
class MyV6Resolver : public Resolver
{
class MyV6Resolver : public Resolver
{
-extern InspIRCd* ServerInstance;
class TimedBan : public classbase
{
class TimedBan : public classbase
{
/* $ModDesc: Provides /tline command used to test who a mask matches */
/* $ModDesc: Provides /tline command used to test who a mask matches */
-extern InspIRCd* ServerInstance;
class cmd_tline : public command_t
{
class cmd_tline : public command_t
{
-extern InspIRCd* ServerInstance;
class cmd_uninvite : public command_t
{
class cmd_uninvite : public command_t
{
/* $ModDesc: Provides support for USERIP command */
/* $ModDesc: Provides support for USERIP command */
-extern InspIRCd* ServerInstance;
class cmd_userip : public command_t
{
class cmd_userip : public command_t
{
/* $ModDesc: Provides support for the /watch command */
/* $ModDesc: Provides support for the /watch command */
-extern InspIRCd* ServerInstance;
class watchentry : public classbase
{
class watchentry : public classbase
{