* ---------------------------------------------------
*/
-/* $Core: libIRCDmodules */
+/* $Core */
#include "inspircd.h"
-#include "wildcard.h"
#include "xline.h"
#include "socket.h"
#include "socketengine.h"
#endif
// version is a simple class for holding a modules version number
-Version::Version(int major, int minor, int revision, int build, int flags, int api_ver)
-: Major(major), Minor(minor), Revision(revision), Build(build), Flags(flags), API(api_ver)
+Version::Version(const std::string &sversion, int flags, int api_ver)
+: version(sversion), Flags(flags), API(api_ver)
{
}
// These declarations define the behavours of the base class Module (which does nothing at all)
- Module::Module(InspIRCd* Me) : ServerInstance(Me) { }
- Module::~Module() { }
+Module::Module(InspIRCd* Me) : ServerInstance(Me) { }
+Module::~Module() { }
+
+int Module::OnSendSnotice(char &snomask, std::string &type, const std::string &message) { return 0; }
void Module::OnUserConnect(User*) { }
void Module::OnUserQuit(User*, const std::string&, const std::string&) { }
void Module::OnUserDisconnect(User*) { }
void Module::OnUserJoin(User*, Channel*, bool, bool&) { }
void Module::OnPostJoin(User*, Channel*) { }
-void Module::OnUserPart(User*, Channel*, const std::string&, bool&) { }
+void Module::OnUserPart(User*, Channel*, std::string&, bool&) { }
void Module::OnRehash(User*, const std::string&) { }
void Module::OnServerRaw(std::string&, bool, User*) { }
int Module::OnUserPreJoin(User*, Channel*, const char*, std::string&, const std::string&) { return 0; }
void Module::OnMode(User*, void*, int, const std::string&) { }
-Version Module::GetVersion() { return Version(1,0,0,0,VF_VENDOR,-1); }
+Version Module::GetVersion() { return Version("Misconfigured", VF_VENDOR, -1); }
void Module::OnOper(User*, const std::string&) { }
void Module::OnPostOper(User*, const std::string&, const std::string &) { }
void Module::OnInfo(User*) { }
void Module::OnLoadModule(Module*, const std::string&) { }
void Module::OnUnloadModule(Module*, const std::string&) { }
void Module::OnBackgroundTimer(time_t) { }
-int Module::OnPreCommand(const std::string&, const std::vector<std::string>&, User *, bool, const std::string&) { return 0; }
+int Module::OnPreCommand(std::string&, std::vector<std::string>&, User *, bool, const std::string&) { return 0; }
void Module::OnPostCommand(const std::string&, const std::vector<std::string>&, User *, CmdResult, const std::string&) { }
bool Module::OnCheckReady(User*) { return true; }
int Module::OnUserRegister(User*) { return 0; }
int Module::OnCheckKey(User*, Channel*, const std::string&) { return 0; }
int Module::OnCheckLimit(User*, Channel*) { return 0; }
int Module::OnCheckBan(User*, Channel*) { return 0; }
+int Module::OnCheckExtBan(User *, Channel *, char) { return 0; }
+int Module::OnCheckStringExtBan(const std::string &s, Channel *c, char type) { return 0; }
int Module::OnStats(char, User*, string_list&) { return 0; }
int Module::OnChangeLocalUserHost(User*, const std::string&) { return 0; }
int Module::OnChangeLocalUserGECOS(User*, const std::string&) { return 0; }
/* Do we need to swap? */
if (swap && (swap_pos != source))
- std::swap(EventHandlers[i][swap_pos], EventHandlers[i][source]);
+ {
+ /* Suggestion from Phoenix, "shuffle" the modules to better retain call order */
+ int incrmnt = 1;
+
+ if (source > swap_pos)
+ incrmnt = -1;
+
+ for (unsigned int j = source; j != swap_pos; j += incrmnt)
+ {
+ if (( j + incrmnt > EventHandlers[i].size() - 1) || (j + incrmnt < 0))
+ continue;
+
+ std::swap(EventHandlers[i][j], EventHandlers[i][j+incrmnt]);
+ }
+ }
return true;
}
dirent* entry = NULL;
while (0 != (entry = readdir(library)))
{
- if (Instance->MatchText(entry->d_name, filename))
+ if (InspIRCd::Match(entry->d_name, filename, NULL))
{
if (!this->Load(entry->d_name))
n_match++;
}
else
{
- Instance->Logs->Log("MODULE", DEFAULT,"New module introduced: %s (API version %d, Module version %d.%d.%d.%d)%s", filename, v.API, v.Major, v.Minor, v.Revision, v.Build, (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]"));
+ Instance->Logs->Log("MODULE", DEFAULT,"New module introduced: %s (API version %d, Module version %s)%s", filename, v.API, v.version.c_str(), (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]"));
}
Modules[filename_str] = std::make_pair(newhandle, newmod);
return NULL;
}
-bool InspIRCd::MatchText(const std::string &sliteral, const std::string &spattern)
-{
- return match(sliteral, spattern);
-}
-
CmdResult InspIRCd::CallCommandHandler(const std::string &commandname, const std::vector<std::string>& parameters, User* user)
{
return this->Parser->CallHandler(commandname, parameters, user);