SOURCES: inspircd-modesoncreate.patch (NEW) - added

aredridel aredridel at pld-linux.org
Sat May 26 23:53:21 CEST 2007


Author: aredridel                    Date: Sat May 26 21:53:21 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- added

---- Files affected:
SOURCES:
   inspircd-modesoncreate.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/inspircd-modesoncreate.patch
diff -u /dev/null SOURCES/inspircd-modesoncreate.patch:1.1
--- /dev/null	Sat May 26 23:53:21 2007
+++ SOURCES/inspircd-modesoncreate.patch	Sat May 26 23:53:16 2007
@@ -0,0 +1,113 @@
+Index: src/modules/m_modesoncreate.cpp
+===================================================================
+--- src/modules/m_modesoncreate.cpp	(revision 0)
++++ src/modules/m_modesoncreate.cpp	(revision 0)
+@@ -0,0 +1,86 @@
++/*       +------------------------------------+
++ *       | Inspire Internet Relay Chat Daemon |
++ *       +------------------------------------+
++ *
++ *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
++ * See: http://www.inspircd.org/wiki/index.php/Credits
++ *
++ * This program is free but copyrighted software; see
++ *            the file COPYING for details.
++ *
++ * ---------------------------------------------------
++ */
++
++#include "users.h"
++#include "channels.h"
++#include "inspircd.h"
++#include "modules.h"
++
++/* $ModDesc: When a channel is created, this module allows a mode to be set on that channel */
++
++class ModuleModesOnCreate : public Module
++{
++public:
++  ModuleModesOnCreate(InspIRCd *ptrMe) : Module::Module(ptrMe)
++  {
++    OnRehash(NULL, "");
++  }
++  
++  virtual ~ModuleModesOnCreate()
++  {
++  }
++  
++  void Implements(char* List)
++  {
++    List[I_OnUserJoin] = 1;
++    List[I_OnRehash] = 1;
++  }
++  
++  virtual void OnUserJoin(userrec* user, chanrec* channel, bool &silent)
++  {
++    if(channel->GetUserCounter() == 1)
++      {
++	// when channel is created, do stuff in this block
++	userrec *ptrUser = new userrec(ServerInstance);
++	ptrUser->SetFd(FD_MAGIC_NUMBER);
++	const char *par[]= {channel->name, mode.c_str()};
++	ServerInstance->SendMode(par,2,ptrUser);
++ 	delete ptrUser;
++	ptrUser = 0;
++      }
++  }
++  
++  virtual void OnRehash(userrec* user, const std::string &parameter)
++  {
++    ConfigReader *conf = new ConfigReader(ServerInstance);
++    mode = conf->ReadValue("modesoncreate", "modes", 0);
++    DELETE(conf);
++  }
++  
++
++  virtual Version GetVersion()
++  {
++    return Version(1,0,0,0,VF_VENDOR,API_VERSION);
++  }
++private:
++  std::string mode;
++  
++};
++
++class ModuleModesOnCreateFactory : public ModuleFactory
++{
++public:
++  ModuleModesOnCreateFactory()
++  {
++  }
++  
++  virtual Module * CreateModule(InspIRCd *ptrMe)
++  {
++    return new ModuleModesOnCreate(ptrMe);
++  }
++};
++
++extern "C" void *init_module(void)
++{
++  return new ModuleModesOnCreateFactory;
++}
+Index: docs/inspircd.conf.example
+===================================================================
+--- docs/inspircd.conf.example	(revision 6983)
++++ docs/inspircd.conf.example	(working copy)
+@@ -1225,6 +1225,17 @@
+ #<module name="m_chancreate.so">
+ 
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
++# Modes-On-Create module: Set modes on on a new channel when it is created
++# When this module is loaded, you must configure it
++#
++#<module name="m_modesoncreate.so">
++#
++#-#-#-#-#-#-#-#-#-#-# MODESONCREATE Configuration #-#-#-#-#-#-#-#-#-#-#
++# Specify the modes you want new channels to have by setting modes to
++# a modestring
++# <modesoncreate modes="-nt+m">
++
++#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
+ # Channel filter module: Allows channel-op defined message
+ # filtering using simple string matches (channel mode +g)
+ #<module name="m_chanfilter.so">
================================================================


More information about the pld-cvs-commit mailing list