X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_auditorium.cpp;h=4be1feb5c222eb0c139b882a785a4b8c765e3bd2;hb=f5c631ef8641db6455bed23c02e5a39f63f7d6d0;hp=0e5c9231028e7bf4606cf0357cad5e8b018ad06a;hpb=dc0f193e9514e7ae6e9c6a05c4208f1dbd3aa4bc;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index 0e5c92310..4be1feb5c 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -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&, 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)