diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-04 15:02:17 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-04 15:02:17 +0000 |
commit | fbb32452c3f4c2ea14ba1ba647369c6f508d916f (patch) | |
tree | 2645df6584460d244c9c37a5d439ef19d0989136 | |
parent | 1b7b2a696d9bf4ee1d93544138aa775d6fa92c74 (diff) |
Check visibility states
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6872 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/cmd_ison.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_watch.cpp | 21 |
2 files changed, 20 insertions, 4 deletions
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<userrec*>::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<userrec*>::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] = ""; } } |