int maxbans;
public:
- /** Pointer to creator object
- */
- InspIRCd* ServerInstance;
-
/** Creates a channel record and initialises it with default values
* @throw Nothing at present.
*/
}
};
+extern InspIRCd* ServerInstance;
ENTRYPOINT;
template<class Cmd>
int levelrequired;
public:
- static InspIRCd* ServerInstance;
/** Module that created this mode. NULL for core modes */
Module* creator;
class CoreExport ModeParser : public classbase
{
private:
- /**
- * Creator/owner pointer
- */
- InspIRCd* ServerInstance;
/** Mode handlers for each mode, to access a handler subtract
* 65 from the ascii value of the mode letter.
* The upper bit of the value indicates if its a usermode
class CoreExport Module : public Extensible
{
public:
- /** Creator/owner pointer
- */
- InspIRCd* ServerInstance;
/** File that this module was loaded from
*/
std::string ModuleSourceFile;
std::bitset<64> AllowedChanModes;
public:
- /** Pointer to creator.
- * This is required to make use of core functions
- * from within the User class.
- */
- InspIRCd* ServerInstance;
-
static LocalIntExt NICKForced;
static LocalStringExt OperQuit;
#include <cstdarg>
#include "mode.h"
-Channel::Channel(InspIRCd* Instance, const std::string &cname, time_t ts) : ServerInstance(Instance)
+Channel::Channel(InspIRCd* Instance, const std::string &cname, time_t ts)
{
chan_hash::iterator findchan = ServerInstance->chanlist->find(cname);
if (findchan != Instance->chanlist->end())
unsigned int rv = 0;
if (mchar)
{
- ModeHandler* mh = chan->ServerInstance->Modes->FindMode(mchar, MODETYPE_CHANNEL);
+ ModeHandler* mh = ServerInstance->Modes->FindMode(mchar, MODETYPE_CHANNEL);
if (mh)
rv = mh->GetPrefixRank();
}
#include "caller.h"
#include "testsuite.h"
-InspIRCd* SI = NULL;
+InspIRCd* ServerInstance = NULL;
int* mysig = NULL;
/** Seperate from the other casemap tables so that code *can* still exclusively rely on RFC casemapping
WindowsIPC = 0;
#endif
+ ServerInstance = this;
+
Extensible::Register(&User::NICKForced);
Extensible::Register(&User::OperQuit);
*/
ENTRYPOINT
{
- SI = new InspIRCd(argc, argv);
- mysig = &SI->s_signal;
- SI->Run();
- delete SI;
+ new InspIRCd(argc, argv);
+ mysig = &ServerInstance->s_signal;
+ ServerInstance->Run();
+ delete ServerInstance;
return 0;
}
/* +s (server notice masks) */
#include "modes/umode_s.h"
-InspIRCd* ModeHandler::ServerInstance;
-
ModeHandler::ModeHandler(Module* Creator, char modeletter, ParamSpec Params, ModeType type)
: mode(modeletter), parameters_taken(Params), list(false), m_type(type), m_paramtype(TR_TEXT),
oper(false), prefix(0), count(0), levelrequired(HALFOP_VALUE), creator(Creator)
}
}
-ModeParser::ModeParser(InspIRCd* Instance) : ServerInstance(Instance)
+ModeParser::ModeParser(InspIRCd* Instance)
{
- ModeHandler::ServerInstance = Instance;
ModeHandler* modes[] =
{
new ModeChannelSecret(Instance),
// version is a simple class for holding a modules version number
Version::Version(const std::string &modv, int flags, int api_ver, const std::string& rev)
-: version(modv + " " + rev), Flags(flags), API(api_ver)
+: version(modv + " - " + rev), Flags(flags), API(api_ver)
{
}
return this->source;
}
-char* Event::Send(InspIRCd* ServerInstance)
+char* Event::Send(InspIRCd* SI)
{
FOREACH_MOD(I_OnEvent,OnEvent(this));
return NULL;
// These declarations define the behavours of the base class Module (which does nothing at all)
-Module::Module(InspIRCd* Me) : ServerInstance(Me) { }
+Module::Module(InspIRCd*) { }
Module::~Module() { }
ModResult Module::OnSendSnotice(char &snomask, std::string &type, const std::string &message) { return MOD_RES_PASSTHRU; }
std::list<callerid_data *> wholistsme;
callerid_data() : lastnotify(0) { }
- callerid_data(const std::string& str, InspIRCd* ServerInstance)
+ callerid_data(const std::string& str)
{
irc::commasepstream s(str);
std::string tok;
void unserialize(Module* requestor, Extensible* container, const std::string& value)
{
- callerid_data* dat = new callerid_data(value, requestor->ServerInstance);
+ callerid_data* dat = new callerid_data(value);
set_raw(container, dat);
}
/* Display the join to everyone else (the user who joined got it earlier) */
channel->WriteAllExceptSender(user, false, 0, "JOIN %s", channel->name.c_str());
- std::string n = this->ServerInstance->Modes->ModeString(user, channel);
+ std::string n = ServerInstance->Modes->ModeString(user, channel);
if (n.length() > 0)
channel->WriteAllExceptSender(user, false, 0, "MODE %s +%s", channel->name.c_str(), n.c_str());
}
{
public:
LocalIntExt& locked;
- CommandNicklock (Module* Creator, LocalIntExt& ext) : Command(Creator->ServerInstance, Creator,"NICKLOCK", "o", 2),
+ CommandNicklock (Module* Creator, LocalIntExt& ext) : Command(ServerInstance, Creator,"NICKLOCK", "o", 2),
locked(ext)
{
syntax = "<oldnick> <newnick>";
{
public:
LocalIntExt& locked;
- CommandNickunlock (Module* Creator, LocalIntExt& ext) : Command(Creator->ServerInstance, Creator,"NICKUNLOCK", "o", 1),
+ CommandNickunlock (Module* Creator, LocalIntExt& ext) : Command(ServerInstance, Creator,"NICKUNLOCK", "o", 1),
locked(ext)
{
syntax = "<locked-nick>";
modechange.push_back(channel->name);
modechange.push_back(modeline);
modechange.push_back(user->nick);
- ServerInstance->SendMode(modechange,this->ServerInstance->FakeClient);
+ ServerInstance->SendMode(modechange,ServerInstance->FakeClient);
}
void OnPostJoin(Membership* memb)
// Not in a class due to circular dependancy hell.
static std::string permchannelsconf;
-static bool WriteDatabase(InspIRCd *ServerInstance)
+static bool WriteDatabase()
{
FILE *f;
channel->SetMode('P',true);
// Save permchannels db if needed.
- WriteDatabase(ServerInstance);
+ WriteDatabase();
return MODEACTION_ALLOW;
}
}
channel->SetMode('P',false);
// Save permchannels db if needed.
- WriteDatabase(ServerInstance);
+ WriteDatabase();
return MODEACTION_ALLOW;
}
}
virtual ModResult OnRawMode(User* user, Channel* chan, const char mode, const std::string ¶m, bool adding, int pcnt)
{
if (chan && chan->IsModeSet('P'))
- WriteDatabase(ServerInstance);
+ WriteDatabase();
return MOD_RES_PASSTHRU;
}
virtual void OnPostTopicChange(User*, Channel *c, const std::string&)
{
if (c->IsModeSet('P'))
- WriteDatabase(ServerInstance);
+ WriteDatabase();
}
virtual Version GetVersion()
if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name)))
{
- this->ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Not connecting to myself.");
+ ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Not connecting to myself.");
return;
}
}
else
{
- this->ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: %s.",x->Name.c_str(),strerror(errno));
+ ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: %s.",x->Name.c_str(),strerror(errno));
if (ServerInstance->SocketCull.find(newsocket) == ServerInstance->SocketCull.end())
ServerInstance->SocketCull[newsocket] = newsocket;
Utils->DoFailOver(x);
}
catch (ModuleException& e)
{
- this->ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: %s.",x->Name.c_str(), e.GetReason());
+ ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: %s.",x->Name.c_str(), e.GetReason());
Utils->DoFailOver(x);
}
}
UserResolver *res_reverse;
QueryType resolvtype = this->client_sa.sa.sa_family == AF_INET6 ? DNS_QUERY_PTR6 : DNS_QUERY_PTR4;
- res_reverse = new UserResolver(this->ServerInstance, this, sip, resolvtype, cached);
+ res_reverse = new UserResolver(ServerInstance, this, sip, resolvtype, cached);
- this->ServerInstance->AddResolver(res_reverse, cached);
+ ServerInstance->AddResolver(res_reverse, cached);
}
catch (CoreException& e)
{
}
}
-User::User(InspIRCd* Instance, const std::string &uid) : ServerInstance(Instance)
+User::User(InspIRCd* Instance, const std::string &uid)
{
server = Instance->FindServerNamePtr(Instance->Config->ServerName);
age = ServerInstance->Time();
this->bytes_out += n_sent;
this->cmds_out++;
if (n_sent != old_sendq_length)
- this->ServerInstance->SE->WantWrite(this);
+ ServerInstance->SE->WantWrite(this);
}
}
this->AddWriteBuf("\r\n");
}
ServerInstance->stats->statsSent += text.length() + 2;
- this->ServerInstance->SE->WantWrite(this);
+ ServerInstance->SE->WantWrite(this);
}
/** Write()
Channel* c = *v;
snprintf(buffer, MAXBUF, ":%s JOIN %s", GetFullHost().c_str(), c->name.c_str());
std::string joinline(buffer);
- std::string modeline = this->ServerInstance->Modes->ModeString(this, c);
+ std::string modeline = ServerInstance->Modes->ModeString(this, c);
if (modeline.length() > 0)
{
snprintf(buffer, MAXBUF, ":%s MODE %s +%s", GetFullHost().c_str(), c->name.c_str(), modeline.c_str());