]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_auditorium.cpp
Convert more modules
[user/henk/code/inspircd.git] / src / modules / m_auditorium.cpp
index d08ef1060d7fe8bc490f6d2446402b98e970c8d2..20168aff51b6ca981dbc115102a1b40f88e52784 100644 (file)
  * ---------------------------------------------------
  */
 
+#include "inspircd.h"
 #include "users.h"
 #include "channels.h"
 #include "modules.h"
-#include "inspircd.h"
 
 /* $ModDesc: Allows for auditorium channels (+u) where nobody can see others joining and parting or the nick list */
 
@@ -54,7 +54,7 @@ class ModuleAuditorium : public Module
        CUList except_list;
  public:
        ModuleAuditorium(InspIRCd* Me)
-               : Module::Module(Me)
+               : Module(Me)
        {
                aum = new AuditoriumMode(ServerInstance);
                if (!ServerInstance->AddMode(aum, 'u'))
@@ -107,7 +107,7 @@ class ModuleAuditorium : public Module
 
                                /* Show all the opped users */
                                nl = *(Ptr->GetOppedUsers());
-                               nl[user] = user;
+                               nl[user] = user->nick;
                                nameslist = &nl;
                                return 0;
                        }
@@ -130,7 +130,7 @@ class ModuleAuditorium : public Module
                        /* 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);
+                               channel->WriteAllExcept(user, false, channel->GetStatus(user) >= STATUS_OP ? 0 : '@', except_list, "JOIN %s", channel->name);
                }
        }
 
@@ -144,8 +144,10 @@ class ModuleAuditorium : public Module
                                        partmessage.empty() ? "" : " :",
                                        partmessage.empty() ? "" : partmessage.c_str());
                        if (ShowOps)
-                               channel->WriteAllExcept(user, false, '@', except_list, "PART %s%s%s", channel->name, partmessage.empty() ? "" : " :",
+                       {
+                               channel->WriteAllExcept(user, false, channel->GetStatus(user) >= STATUS_OP ? 0 : '@', except_list, "PART %s%s%s", channel->name, partmessage.empty() ? "" : " :",
                                                partmessage.empty() ? "" : partmessage.c_str());
+                       }
                }
        }
 
@@ -157,7 +159,7 @@ class ModuleAuditorium : public Module
                        /* 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());
                        if (ShowOps)
-                               chan->WriteAllExcept(source, false, '@', except_list, "KICK %s %s %s", chan->name, user->nick, reason.c_str());
+                               chan->WriteAllExcept(source, false, chan->GetStatus(source) >= STATUS_OP ? 0 : '@', 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());
                }
@@ -186,26 +188,4 @@ class ModuleAuditorium : public Module
        }
 };
 
-class ModuleAuditoriumFactory : public ModuleFactory
-{
- public:
-       ModuleAuditoriumFactory()
-       {
-       }
-       
-       ~ModuleAuditoriumFactory()
-       {
-       }
-       
-       virtual Module * CreateModule(InspIRCd* Me)
-       {
-               return new ModuleAuditorium(Me);
-       }
-       
-};
-
-extern "C" void * init_module( void )
-{
-       return new ModuleAuditoriumFactory;
-}
-
+MODULE_INIT(ModuleAuditorium);