]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_auditorium.cpp
Add RAWIO log level which is more verbose than DEBUG
[user/henk/code/inspircd.git] / src / modules / m_auditorium.cpp
index 0e5c9231028e7bf4606cf0357cad5e8b018ad06a..4be1feb5c222eb0c139b882a785a4b8c765e3bd2 100644 (file)
@@ -50,8 +50,11 @@ class ModuleAuditorium : public Module
 
                OnRehash(NULL);
 
-               Implementation eventlist[] = { I_OnUserJoin, I_OnUserPart, I_OnUserKick, I_OnBuildNeighborList, I_OnNamesListItem, I_OnRehash };
-               ServerInstance->Modules->Attach(eventlist, this, 6);
+               Implementation eventlist[] = {
+                       I_OnUserJoin, I_OnUserPart, I_OnUserKick,
+                       I_OnBuildNeighborList, I_OnNamesListItem, I_OnSendWhoLine,
+                       I_OnRehash };
+               ServerInstance->Modules->Attach(eventlist, this, 7);
        }
 
        ~ModuleAuditorium()
@@ -150,13 +153,32 @@ class ModuleAuditorium : public Module
                while (i != include.end())
                {
                        Channel* c = *i++;
-                       Membership* memb = c->GetUser(source); // will be non-null
-                       if (IsVisible(memb))
+                       Membership* memb = c->GetUser(source);
+                       if (!memb || IsVisible(memb))
                                continue;
-                       // TODO this doesn't take can-see into account
+                       // this channel should not be considered when listing my neighbors
                        include.erase(c);
+                       // however, that might hide me from ops that can see me...
+                       const UserMembList* users = c->GetUsers();
+                       for(UserMembCIter j = users->begin(); j != users->end(); j++)
+                       {
+                               if (IS_LOCAL(j->first) && CanSee(j->first, memb))
+                                       exception[j->first] = true;
+                       }
                }
        }
+
+       void OnSendWhoLine(User* source, const std::vector<std::string>&, User* user, Channel* channel, std::string& line)
+       {
+               if (!channel)
+                       return;
+               Membership* memb = channel->GetUser(user);
+               if (IsVisible(memb))
+                       return;
+               if (CanSee(source, memb))
+                       return;
+               line.clear();
+       }
 };
 
 MODULE_INIT(ModuleAuditorium)