]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules.cpp
Added m_alias module which provides command aliases.
[user/henk/code/inspircd.git] / src / modules.cpp
index 1ff2f3f9d572ebdea1b48cd403dc48f1ac85fdbd..d2f01297781c3ef270e9262ece46abd3e7dff679 100644 (file)
 #include "ctables.h"
 #include "inspircd_io.h"
 #include "wildcard.h"
+#include "mode.h"
+#include "message.h"
+#include "commands.h"
 
 // class type for holding an extended mode character - internal to core
 
-class ExtMode
+class ExtMode : public classbase
 {
 public:
        char modechar;
@@ -114,7 +117,7 @@ void Module::OnUserPart(userrec* user, chanrec* channel) { }
 void Module::OnPacketTransmit(char *p) { }
 void Module::OnPacketReceive(char *p) { }
 void Module::OnRehash() { }
-void Module::OnServerRaw(std::string &raw, bool inbound) { }
+void Module::OnServerRaw(std::string &raw, bool inbound, userrec* user) { }
 int Module::OnUserPreJoin(userrec* user, chanrec* chan, const char* cname) { return 0; }
 bool Module::OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list &params) { return false; }
 Version Module::GetVersion() { return Version(1,0,0,0); }
@@ -123,6 +126,7 @@ void Module::OnInfo(userrec* user) { };
 void Module::OnWhois(userrec* source, userrec* dest) { };
 int Module::OnUserPreMessage(userrec* user,void* dest,int target_type, std::string text) { return 0; };
 int Module::OnUserPreNotice(userrec* user,void* dest,int target_type, std::string text) { return 0; };
+int Module::OnUserPreNick(userrec* user, std::string newnick) { return 0; };
 
 // server is a wrapper class that provides methods to all of the C-style
 // exports in the core
@@ -175,6 +179,11 @@ void Server::QuitUser(userrec* user, std::string reason)
        kill_link(user,reason.c_str());
 }
 
+bool Server::IsUlined(std::string server)
+{
+       return is_uline(server.c_str());
+}
+
 void Server::CallCommandHandler(std::string commandname, char** parameters, int pcnt, userrec* user)
 {
        call_handler(commandname.c_str(),parameters,pcnt,user);
@@ -258,6 +267,16 @@ void Server::SendWallops(userrec* User, std::string text)
        WriteWallOps(User,false,"%s",text.c_str());
 }
 
+void Server::ChangeHost(userrec* user, std::string host)
+{
+       ChangeDisplayedHost(user,host.c_str());
+}
+
+void Server::ChangeGECOS(userrec* user, std::string gecos)
+{
+       ChangeName(user,gecos.c_str());
+}
+
 bool Server::IsNick(std::string nick)
 {
        return (isnick(nick.c_str()) != 0);
@@ -344,8 +363,12 @@ ConfigReader::ConfigReader(std::string filename)
 std::string ConfigReader::ReadValue(std::string tag, std::string name, int index)
 {
        char val[MAXBUF];
-       ReadConf(cache,tag.c_str(),name.c_str(),index,val);
-       return val;
+       char t[MAXBUF];
+       char n[MAXBUF];
+       strncpy(t,tag.c_str(),MAXBUF);
+       strncpy(n,name.c_str(),MAXBUF);
+       ReadConf(cache,t,n,index,val);
+       return std::string(val);
 }