From fbb32452c3f4c2ea14ba1ba647369c6f508d916f Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 4 May 2007 15:02:17 +0000 Subject: Check visibility states git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6872 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/cmd_ison.cpp | 3 +++ src/modules/m_watch.cpp | 21 +++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/cmd_ison.cpp b/src/cmd_ison.cpp index 1f177d230..fde8666ff 100644 --- a/src/cmd_ison.cpp +++ b/src/cmd_ison.cpp @@ -60,6 +60,9 @@ CmdResult cmd_ison::Handle (const char** parameters, int pcnt, userrec *user) if (u) { + if (u->Visibility && !u->Visibility->VisibleTo(user)) + continue; + reply.append(u->nick).append(" "); if (reply.length() > 450) { diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index 28c809d5b..170585737 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -168,6 +168,13 @@ class cmd_watch : public command_t userrec* target = ServerInstance->FindNick(nick); if (target) { + if (target->Visibility && !target->Visibility->VisibleTo(user)) + { + (*wl)[nick] = ""; + user->WriteServ("605 %s %s * * 0 :is offline",user->nick, nick); + return CMD_FAILURE; + } + (*wl)[nick] = std::string(target->ident).append(" ").append(target->dhost).append(" ").append(ConvToStr(target->age)); user->WriteServ("604 %s %s %s :is online",user->nick, nick, (*wl)[nick].c_str()); } @@ -313,7 +320,9 @@ class Modulewatch : public Module { for (std::deque::iterator n = x->second.begin(); n != x->second.end(); n++) { - (*n)->WriteServ("601 %s %s %s %s %lu :went offline", (*n)->nick ,user->nick, user->ident, user->dhost, ServerInstance->Time()); + if (!user->Visibility || user->Visibility->VisibleTo(user)) + (*n)->WriteServ("601 %s %s %s %s %lu :went offline", (*n)->nick ,user->nick, user->ident, user->dhost, ServerInstance->Time()); + watchlist* wl; if ((*n)->GetExt("watchlist", wl)) /* We were on somebody's notify list, set ourselves offline */ @@ -380,7 +389,9 @@ class Modulewatch : public Module { for (std::deque::iterator n = x->second.begin(); n != x->second.end(); n++) { - (*n)->WriteServ("600 %s %s %s %s %lu :arrived online", (*n)->nick, user->nick, user->ident, user->dhost, user->age); + if (!user->Visibility || user->Visibility->VisibleTo(user)) + (*n)->WriteServ("600 %s %s %s %s %lu :arrived online", (*n)->nick, user->nick, user->ident, user->dhost, user->age); + watchlist* wl; if ((*n)->GetExt("watchlist", wl)) /* We were on somebody's notify list, set ourselves online */ @@ -402,7 +413,8 @@ class Modulewatch : public Module if ((*n)->GetExt("watchlist", wl)) { (*wl)[user->nick] = std::string(user->ident).append(" ").append(user->dhost).append(" ").append(ConvToStr(user->age)); - (*n)->WriteServ("600 %s %s %s :arrived online", (*n)->nick, user->nick, (*wl)[user->nick].c_str()); + if (!user->Visibility || user->Visibility->VisibleTo(user)) + (*n)->WriteServ("600 %s %s %s :arrived online", (*n)->nick, user->nick, (*wl)[user->nick].c_str()); } } } @@ -414,7 +426,8 @@ class Modulewatch : public Module watchlist* wl; if ((*n)->GetExt("watchlist", wl)) { - (*n)->WriteServ("601 %s %s %s %s %lu :went offline", (*n)->nick, oldnick.c_str(), user->ident, user->dhost, user->age); + if (!user->Visibility || user->Visibility->VisibleTo(user)) + (*n)->WriteServ("601 %s %s %s %s %lu :went offline", (*n)->nick, oldnick.c_str(), user->ident, user->dhost, user->age); (*wl)[user->nick] = ""; } } -- cgit v1.2.3