/* compile a userlist of a channel into a string, each nick seperated by
* spaces and op, voice etc status shown as @ and +, and send it to 'user'
*/
-void chanrec::UserList(userrec *user)
+void chanrec::UserList(userrec *user, CUList *ulist)
{
char list[MAXBUF];
size_t dlen, curlen;
if (!IS_LOCAL(user))
return;
- FOREACH_RESULT(I_OnUserList,OnUserList(user, this));
+ FOREACH_RESULT(I_OnUserList,OnUserList(user, this, ulist));
if (MOD_RESULT == 1)
return;
int numusers = 0;
char* ptr = list + dlen;
- CUList *ulist= this->GetUsers();
+ if (!ulist)
+ ulist= this->GetUsers();
/* Improvement by Brain - this doesnt change in value, so why was it inside
* the loop?
Priority Module::Prioritize() { return PRIORITY_DONTCARE; }
void Module::OnSetAway(userrec* user) { };
void Module::OnCancelAway(userrec* user) { };
-int Module::OnUserList(userrec* user, chanrec* Ptr) { return 0; };
+int Module::OnUserList(userrec* user, chanrec* Ptr, CUList* &userlist) { return 0; };
int Module::OnWhoisLine(userrec* user, userrec* dest, int &numeric, std::string &text) { return 0; };
void Module::OnBuildExemptList(MessageType message_type, chanrec* chan, userrec* sender, char status, CUList &exempt_list) { };
void Module::OnGarbageCollect() { };
{
private:
AuditoriumMode* aum;
+ bool ShowOps;
+ CUList nl;
+ CUList except_list;
public:
ModuleAuditorium(InspIRCd* Me)
: Module::Module(Me)
aum = new AuditoriumMode(ServerInstance);
if (!ServerInstance->AddMode(aum, 'u'))
throw ModuleException("Could not add new modes!");
+ OnRehash(NULL, "");
}
virtual ~ModuleAuditorium()
DELETE(aum);
}
+ virtual void OnRehash(userrec* user, const std::string ¶meter)
+ {
+ ConfigReader conf(ServerInstance);
+ ShowOps = conf.ReadFlag("auditorium", "showops", 0);
+ }
+
Priority Prioritize()
{
/* To ensure that we get priority over namesx for names list generation on +u channels */
void Implements(char* List)
{
- List[I_OnUserJoin] = List[I_OnUserPart] = List[I_OnUserKick] = List[I_OnUserQuit] = List[I_OnUserList] = 1;
+ List[I_OnUserJoin] = List[I_OnUserPart] = List[I_OnUserKick] = List[I_OnUserQuit] = List[I_OnUserList] = List[I_OnRehash] = 1;
}
- virtual int OnUserList(userrec* user, chanrec* Ptr)
+ virtual int OnUserList(userrec* user, chanrec* Ptr, CUList* &nameslist)
{
if (Ptr->IsModeSet('u'))
{
- /* HELLOOO, IS ANYBODY THERE? -- nope, just us. */
- user->WriteServ("353 %s = %s :%s", user->nick, Ptr->name, user->nick);
- user->WriteServ("366 %s %s :End of /NAMES list.", user->nick, Ptr->name);
- return 1;
+ if (ShowOps)
+ {
+ /* Show all the opped users */
+ nl = *(Ptr->GetOppedUsers());
+ nl[user] = user;
+ nameslist = &nl;
+ return 0;
+ }
+ else
+ {
+ /* HELLOOO, IS ANYBODY THERE? -- nope, just us. */
+ user->WriteServ("353 %s = %s :%s", user->nick, Ptr->name, user->nick);
+ user->WriteServ("366 %s %s :End of /NAMES list.", user->nick, Ptr->name);
+ return 1;
+ }
}
return 0;
}
silent = true;
/* Because we silenced the event, make sure it reaches the user whos joining (but only them of course) */
user->WriteFrom(user, "JOIN %s", channel->name);
+ if (ShowOps)
+ channel->WriteAllExcept(user, false, '@', except_list, "JOIN %s", channel->name);
}
}
user->WriteFrom(user, "PART %s%s%s", channel->name,
partmessage.empty() ? "" : " :",
partmessage.empty() ? "" : partmessage.c_str());
+ if (ShowOps)
+ channel->WriteAllExcept(user, false, '@', except_list, "PART %s%s%s", channel->name, partmessage.empty() ? "" : " :",
+ partmessage.empty() ? "" : partmessage.c_str());
}
}
silent = true;
/* Send silenced event only to the user being kicked and the user doing the kick */
source->WriteFrom(source, "KICK %s %s %s", chan->name, user->nick, reason.c_str());
- user->WriteFrom(source, "KICK %s %s %s", chan->name, user->nick, reason.c_str());
+ if (ShowOps)
+ chan->WriteAllExcept(source, false, '@', except_list, "KICK %s %s %s", chan->name, user->nick, reason.c_str());
+ else
+ user->WriteFrom(source, "KICK %s %s %s", chan->name, user->nick, reason.c_str());
}
}