From 94a601fb3b67e72e075af28174094117cd09f5f2 Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 2 Sep 2009 00:50:43 +0000 Subject: Rip out VisData in preparation for replacing it with more flexible hooks git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11640 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/channels.cpp | 3 --- src/commands/cmd_ison.cpp | 6 ------ src/commands/cmd_who.cpp | 4 ---- src/commands/cmd_whois.cpp | 7 ------- src/mode.cpp | 6 ------ src/modules/m_delayjoin.cpp | 4 ---- src/modules/m_invisible.cpp | 27 --------------------------- src/modules/m_watch.cpp | 22 +++++----------------- src/users.cpp | 15 --------------- 9 files changed, 5 insertions(+), 89 deletions(-) (limited to 'src') diff --git a/src/channels.cpp b/src/channels.cpp index 15c2c56b1..76e2f0a68 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -911,9 +911,6 @@ void Channel::UserList(User *user, CUList *ulist) continue; } - if (i->first->Visibility && !i->first->Visibility->VisibleTo(user)) - continue; - std::string prefixlist = this->GetPrefixChar(i->first); std::string nick = i->first->nick; diff --git a/src/commands/cmd_ison.cpp b/src/commands/cmd_ison.cpp index 423535da3..52fbcde4b 100644 --- a/src/commands/cmd_ison.cpp +++ b/src/commands/cmd_ison.cpp @@ -35,9 +35,6 @@ CmdResult CommandIson::Handle (const std::vector& parameters, User if (u) { - if (u->Visibility && !u->Visibility->VisibleTo(user)) - continue; - reply.append(u->nick).append(" "); if (reply.length() > 450) { @@ -63,9 +60,6 @@ CmdResult CommandIson::Handle (const std::vector& parameters, User if (u) { - if (u->Visibility && !u->Visibility->VisibleTo(user)) - continue; - reply.append(u->nick).append(" "); if (reply.length() > 450) { diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp index 9e14ecb45..489c668c0 100644 --- a/src/commands/cmd_who.cpp +++ b/src/commands/cmd_who.cpp @@ -147,10 +147,6 @@ bool CommandWho::CanView(Channel* chan, User* user) void CommandWho::SendWhoLine(User* user, const std::string &initial, Channel* ch, User* u, std::vector &whoresults) { - /* Not visible to this user */ - if (u->Visibility && !u->Visibility->VisibleTo(user)) - return; - const std::string& lcn = get_first_visible_channel(u); Channel* chlast = ServerInstance->FindChan(lcn); diff --git a/src/commands/cmd_whois.cpp b/src/commands/cmd_whois.cpp index c58f88f80..b2f322351 100644 --- a/src/commands/cmd_whois.cpp +++ b/src/commands/cmd_whois.cpp @@ -17,13 +17,6 @@ void do_whois(InspIRCd* ServerInstance, User* user, User* dest,unsigned long signon, unsigned long idle, const char* nick) { - if ((dest->Visibility && !dest->Visibility->VisibleTo(user)) || dest->registered != REG_ALL) - { - ServerInstance->SendWhoisLine(user, dest, 401, "%s %s :No such nick/channel",user->nick.c_str(), *nick ? nick : "*"); - ServerInstance->SendWhoisLine(user, dest, 318, "%s %s :End of /WHOIS list.",user->nick.c_str(), *nick ? nick : "*"); - return; - } - ServerInstance->SendWhoisLine(user, dest, 311, "%s %s %s %s * :%s",user->nick.c_str(), dest->nick.c_str(), dest->ident.c_str(), dest->dhost.c_str(), dest->fullname.c_str()); if (user == dest || user->HasPrivPermission("users/auspex")) { diff --git a/src/mode.cpp b/src/mode.cpp index 38f7835fc..22b1e261f 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -319,12 +319,6 @@ void ModeParser::DisplayCurrentModes(User *user, User* targetuser, Channel* targ } else { - if (targetuser->Visibility && !targetuser->Visibility->VisibleTo(user)) - { - user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel",user->nick.c_str(), text); - return; - } - if (targetuser == user || user->HasPrivPermission("users/auspex")) { /* Display user's current mode string */ diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 9463457f7..9ccb89167 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -229,10 +229,6 @@ void ModuleDelayJoin::WriteCommonFrom(User *user, Channel* channel, const char* if (user == i->first) continue; - /* Users with a visibility state that hides them dont appear */ - if (user->Visibility && !user->Visibility->VisibleTo(i->first)) - continue; - i->first->Write(std::string(tb)); } } diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp index 5c879aea6..1d8c8a385 100644 --- a/src/modules/m_invisible.cpp +++ b/src/modules/m_invisible.cpp @@ -18,39 +18,15 @@ static ConfigReader* conf; -class QuietOper : public VisData -{ - public: - QuietOper() - { - } - - virtual ~QuietOper() - { - } - - virtual bool VisibleTo(User* user) - { - return IS_OPER(user); - } -}; - - class InvisibleMode : public ModeHandler { - QuietOper* qo; public: InvisibleMode(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'Q', 0, 0, false, MODETYPE_USER, true) { - qo = new QuietOper(); } ~InvisibleMode() { - for (user_hash::iterator i = ServerInstance->Users->clientlist->begin(); i != ServerInstance->Users->clientlist->end(); i++) - if (i->second->Visibility == qo) - i->second->Visibility = NULL; - delete qo; } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) @@ -66,9 +42,6 @@ class InvisibleMode : public ModeHandler if (m && adding) m->OnUserQuit(dest, "Connection closed", "Connection closed"); - /* Set visibility handler object */ - dest->Visibility = adding ? qo : NULL; - /* This has to come after setting/unsetting the handler */ if (m && !adding) m->OnPostConnect(dest); diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index c78bfa638..1cda4484f 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -226,13 +226,6 @@ class CommandWatch : public Command User* target = ServerInstance->FindNick(nick); if (target) { - if (target->Visibility && !target->Visibility->VisibleTo(user)) - { - (*wl)[nick] = ""; - user->WriteNumeric(605, "%s %s * * 0 :is offline",user->nick.c_str(), nick); - return CMD_FAILURE; - } - (*wl)[nick] = std::string(target->ident).append(" ").append(target->dhost).append(" ").append(ConvToStr(target->age)); user->WriteNumeric(604, "%s %s %s :is online",user->nick.c_str(), nick, (*wl)[nick].c_str()); if (IS_AWAY(target)) @@ -410,8 +403,7 @@ class Modulewatch : public Module { for (std::deque::iterator n = x->second.begin(); n != x->second.end(); n++) { - if (!user->Visibility || user->Visibility->VisibleTo(user)) - (*n)->WriteNumeric(inum, numeric); + (*n)->WriteNumeric(inum, numeric); } } @@ -425,8 +417,7 @@ class Modulewatch : public Module { for (std::deque::iterator n = x->second.begin(); n != x->second.end(); n++) { - if (!user->Visibility || user->Visibility->VisibleTo(*n)) - (*n)->WriteNumeric(601, "%s %s %s %s %lu :went offline", (*n)->nick.c_str() ,user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) ServerInstance->Time()); + (*n)->WriteNumeric(601, "%s %s %s %s %lu :went offline", (*n)->nick.c_str() ,user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) ServerInstance->Time()); watchlist* wl; if ((*n)->GetExt("watchlist", wl)) @@ -496,8 +487,7 @@ class Modulewatch : public Module { for (std::deque::iterator n = x->second.begin(); n != x->second.end(); n++) { - if (!user->Visibility || user->Visibility->VisibleTo(*n)) - (*n)->WriteNumeric(600, "%s %s %s %s %lu :arrived online", (*n)->nick.c_str(), user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) user->age); + (*n)->WriteNumeric(600, "%s %s %s %s %lu :arrived online", (*n)->nick.c_str(), user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) user->age); watchlist* wl; if ((*n)->GetExt("watchlist", wl)) @@ -519,8 +509,7 @@ class Modulewatch : public Module watchlist* wl; if ((*n)->GetExt("watchlist", wl)) { - if (!user->Visibility || user->Visibility->VisibleTo(*n)) - (*n)->WriteNumeric(601, "%s %s %s %s %lu :went offline", (*n)->nick.c_str(), oldnick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) user->age); + (*n)->WriteNumeric(601, "%s %s %s %s %lu :went offline", (*n)->nick.c_str(), oldnick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) user->age); (*wl)[oldnick.c_str()] = ""; } } @@ -534,8 +523,7 @@ class Modulewatch : public Module if ((*n)->GetExt("watchlist", wl)) { (*wl)[user->nick.c_str()] = std::string(user->ident).append(" ").append(user->dhost).append(" ").append(ConvToStr(user->age)); - if (!user->Visibility || user->Visibility->VisibleTo(*n)) - (*n)->WriteNumeric(600, "%s %s %s :arrived online", (*n)->nick.c_str(), user->nick.c_str(), (*wl)[user->nick.c_str()].c_str()); + (*n)->WriteNumeric(600, "%s %s %s :arrived online", (*n)->nick.c_str(), user->nick.c_str(), (*wl)[user->nick.c_str()].c_str()); } } } diff --git a/src/users.cpp b/src/users.cpp index dfff7f034..8f67278e8 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -217,7 +217,6 @@ User::User(InspIRCd* Instance, const std::string &uid) : ServerInstance(Instance client_sa.sa.sa_family = AF_UNSPEC; recvq.clear(); sendq.clear(); - Visibility = NULL; MyClass = NULL; AllowedPrivs = AllowedOperCommands = NULL; chans.clear(); @@ -1956,20 +1955,6 @@ const std::string FakeUser::GetFullRealHost() return nick; } -VisData::VisData() -{ -} - -VisData::~VisData() -{ -} - -bool VisData::VisibleTo(User* user) -{ - return true; -} - - ConnectClass::ConnectClass(char t, const std::string& mask) : type(t), name("unnamed"), registration_timeout(0), host(mask), pingtime(0), pass(""), hash(""), sendqmax(0), recvqmax(0), maxlocal(0), maxglobal(0), maxchans(0), port(0), limit(0), RefCount(1) { -- cgit v1.2.3