+bool Server::AddExtendedListMode(char modechar)
+{
+ bool res = DoAddExtendedMode(modechar,MT_CHANNEL,false,1,1);
+ if (res)
+ ModeMakeList(modechar);
+ return res;
+}
+
+int Server::CountUsers(chanrec* c)
+{
+ return usercount(c);
+}
+
+
+bool Server::UserToPseudo(userrec* user,std::string message)
+{
+ unsigned int old_fd = user->fd;
+ user->fd = FD_MAGIC_NUMBER;
+ user->ClearBuffer();
+ Write(old_fd,"ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,message.c_str());
+#ifdef USE_KQUEUE
+ struct kevent ke;
+ EV_SET(&ke, old_fd, EVFILT_READ, EV_DELETE, 0, 0, NULL);
+ int i = kevent(kq, &ke, 1, 0, 0, NULL);
+ if (i == -1)
+ {
+ log(DEBUG,"kqueue: Failed to remove user from queue!");
+ }
+#endif
+#ifdef USE_EPOLL
+ struct epoll_event ev;
+ ev.events = EPOLLIN | EPOLLET;
+ ev.data.fd = old_fd;
+ int i = epoll_ctl(ep, EPOLL_CTL_DEL, old_fd, &ev);
+ if (i < 0)
+ {
+ log(DEBUG,"epoll: List deletion failure!");
+ }
+#endif
+
+ shutdown(old_fd,2);
+ close(old_fd);
+}
+
+bool Server::PseudoToUser(userrec* alive,userrec* zombie,std::string message)
+{
+ zombie->fd = alive->fd;
+ alive->fd = FD_MAGIC_NUMBER;
+ alive->ClearBuffer();
+ Write(zombie->fd,":%s!%s@%s NICK %s",alive->nick,alive->ident,alive->host,zombie->nick);
+ kill_link(alive,message.c_str());
+ fd_ref_table[zombie->fd] = zombie;
+ 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);
+
+ }
+ }
+ }
+
+}
+
+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());
+}
+
+bool Server::IsValidMask(std::string mask)
+{
+ const char* dest = mask.c_str();
+ if (strchr(dest,'!')==0)
+ return false;
+ if (strchr(dest,'@')==0)
+ return false;
+ for (int i = 0; i < strlen(dest); i++)
+ if (dest[i] < 32)
+ return false;
+ for (int i = 0; i < strlen(dest); i++)
+ if (dest[i] > 126)
+ return false;
+ int c = 0;
+ for (int i = 0; i < strlen(dest); i++)
+ if (dest[i] == '!')
+ c++;
+ if (c>1)
+ return false;
+ c = 0;
+ for (int i = 0; i < strlen(dest); i++)
+ if (dest[i] == '@')
+ c++;
+ if (c>1)
+ return false;
+
+ return true;
+}
+
+void Server::MeshSendAll(std::string text)
+{
+ NetSendToAll((char*)text.c_str());
+}
+
+void Server::MeshSendCommon(userrec* user, std::string text)
+{
+ if (user)
+ NetSendToCommon(user,(char*)text.c_str());
+}
+
+void Server::MeshSendAllAlive(std::string text)
+{
+ NetSendToAllAlive((char*)text.c_str());
+}
+
+void Server::MeshSendUnicast(std::string destination, std::string text)
+{
+ NetSendToOne((char*)destination.c_str(),(char*)text.c_str());
+}
+
+void Server::MeshSendAllExcept(std::string target, std::string text)
+{
+ NetSendToAllExcept(target.c_str(),(char*)text.c_str());
+}
+
+bool Server::MeshCheckChan(chanrec *c,std::string servername)
+{
+ if (c)
+ {
+ return ChanAnyOnThisServer(c,(char*)servername.c_str());
+ }
+ else return false;
+}
+
+bool Server::MeshCheckCommon(userrec* u,std::string servername)
+{
+ if (u)
+ {
+ return CommonOnThisServer(u,(char*)servername.c_str());
+ }
+ else return false;
+}
+
+Module* Server::FindModule(std::string name)
+{
+ for (int i = 0; i <= MODCOUNT; i++)
+ {
+ if (module_names[i] == name)
+ {
+ return modules[i];
+ }
+ }
+ return NULL;
+}