]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules.cpp
Changed to non-conflicting numeric 948 for invalid idle time
[user/henk/code/inspircd.git] / src / modules.cpp
index 7242ae92e79678afee2c693bf2acb1b6fb1db25a..1bed5bd183996d3cdeab9e667c7fe281dbac9017 100644 (file)
@@ -309,13 +309,13 @@ void Module::OnUserConnect(userrec* user) { }
 void Module::OnUserQuit(userrec* user) { }
 void Module::OnUserJoin(userrec* user, chanrec* channel) { }
 void Module::OnUserPart(userrec* user, chanrec* channel) { }
-void Module::OnPacketTransmit(char *p) { }
-void Module::OnPacketReceive(char *p) { }
+void Module::OnPacketTransmit(std::string &data, std::string serv) { }
+void Module::OnPacketReceive(std::string &data, std::string serv) { }
 void Module::OnRehash() { }
 void Module::OnServerRaw(std::string &raw, bool inbound, userrec* user) { }
 int Module::OnUserPreJoin(userrec* user, chanrec* chan, const char* cname) { return 0; }
 int 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); }
+Version Module::GetVersion() { return Version(1,0,0,0,VF_VENDOR); }
 void Module::OnOper(userrec* user) { };
 void Module::OnInfo(userrec* user) { };
 void Module::OnWhois(userrec* source, userrec* dest) { };
@@ -330,7 +330,8 @@ string_list Module::OnChannelSync(chanrec* chan) { string_list empty; return emp
 void Module::On005Numeric(std::string &output) { };
 int Module::OnKill(userrec* source, userrec* dest, std::string reason) { return 0; };
 void Module::OnLoadModule(Module* mod,std::string name) { };
-
+void Module::OnBackgroundTimer(time_t curtime) { };
+void Module::OnSendList(userrec* user, chanrec* channel, char mode) { };
 
 // server is a wrapper class that provides methods to all of the C-style
 // exports in the core
@@ -576,6 +577,101 @@ int Server::CountUsers(chanrec* c)
 }
 
 
+bool Server::UserToPseudo(userrec* user,std::string message)
+{
+       unsigned int old_fd = user->fd;
+       user->fd = FD_MAGIC_NUMBER;
+       Write(old_fd,"ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,message.c_str());
+       close(old_fd);
+       shutdown (old_fd,2);
+}
+
+bool Server::PseudoToUser(userrec* alive,userrec* zombie,std::string message)
+{
+       zombie->fd = alive->fd;
+       alive->fd = FD_MAGIC_NUMBER;
+       Write(zombie->fd,":%s!%s@%s NICK %s",alive->nick,alive->ident,alive->host,zombie->nick);
+       kill_link(alive,message.c_str());
+        for (int i = 0; i != MAXCHANS; i++)
+        {
+                if (zombie->chans[i].channel != NULL)
+                {
+                        if (zombie->chans[i].channel->name)
+                        {
+                               chanrec* Ptr = zombie->chans[i].channel;
+                               WriteFrom(zombie->fd,zombie,"JOIN %s",Ptr->name);
+                               if (Ptr->topicset)
+                               {
+                                       WriteServ(zombie->fd,"332 %s %s :%s", zombie->nick, Ptr->name, Ptr->topic);
+                                       WriteServ(zombie->fd,"333 %s %s %s %d", zombie->nick, Ptr->name, Ptr->setby, Ptr->topicset);
+                               }
+                               userlist(zombie,Ptr);
+                               WriteServ(zombie->fd,"366 %s %s :End of /NAMES list.", zombie->nick, Ptr->name);
+                               WriteServ(zombie->fd,"324 %s %s +%s",zombie->nick, Ptr->name,chanmodes(Ptr));
+                               WriteServ(zombie->fd,"329 %s %s %d", zombie->nick, Ptr->name, Ptr->created);
+
+                        }
+                }
+        }
+
+}
+
+void Server::AddGLine(long duration, std::string source, std::string reason, std::string hostmask)
+{
+       add_gline(duration, source.c_str(), reason.c_str(), hostmask.c_str());
+}
+
+void Server::AddQLine(long duration, std::string source, std::string reason, std::string nickname)
+{
+       add_qline(duration, source.c_str(), reason.c_str(), nickname.c_str());
+}
+
+void Server::AddZLine(long duration, std::string source, std::string reason, std::string ipaddr)
+{
+       add_zline(duration, source.c_str(), reason.c_str(), ipaddr.c_str());
+}
+
+void Server::AddKLine(long duration, std::string source, std::string reason, std::string hostmask)
+{
+       add_kline(duration, source.c_str(), reason.c_str(), hostmask.c_str());
+}
+
+void Server::AddELine(long duration, std::string source, std::string reason, std::string hostmask)
+{
+       add_eline(duration, source.c_str(), reason.c_str(), hostmask.c_str());
+}
+
+bool Server::DelGLine(std::string hostmask)
+{
+       del_gline(hostmask.c_str());
+}
+
+bool Server::DelQLine(std::string nickname)
+{
+       del_qline(nickname.c_str());
+}
+
+bool Server::DelZLine(std::string ipaddr)
+{
+       del_zline(ipaddr.c_str());
+}
+
+bool Server::DelKLine(std::string hostmask)
+{
+       del_kline(hostmask.c_str());
+}
+
+bool Server::DelELine(std::string hostmask)
+{
+       del_eline(hostmask.c_str());
+}
+
+long Server::CalcDuration(std::string delta)
+{
+       return duration(delta.c_str());
+}
+
+
 ConfigReader::ConfigReader()
 {
        this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out);