Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #8 from Shawn-Smith/insp20+m_joinpartsno

Backported m_joinpartsno from 2.1 to 2.0
  • Loading branch information...
commit fe4854c57732014948fececdbc47d37ff813af7e 2 parents 6bdddbd + a678264
Attila Molnar authored

Showing 1 changed file with 59 additions and 0 deletions. Show diff stats Hide diff stats

  1. 59  2.0/m_joinpartsno.cpp
59  2.0/m_joinpartsno.cpp
... ...
@@ -0,0 +1,59 @@
  1
+/*
  2
+ * InspIRCd -- Internet Relay Chat Daemon
  3
+ *
  4
+ *   Copyright (C) 2012 Shawn Smith <ShawnSmith0828@gmail.com>
  5
+ *
  6
+ * This file is part of InspIRCd.  InspIRCd is free software: you can
  7
+ * redistribute it and/or modify it under the terms of the GNU General Public
  8
+ * License as published by the Free Software Foundation, version 2.
  9
+ *
  10
+ * This program is distributed in the hope that it will be useful, but WITHOUT
  11
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  12
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  13
+ * details.
  14
+ *
  15
+ * You should have received a copy of the GNU General Public License
  16
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17
+ */
  18
+ 
  19
+#include "inspircd.h"
  20
+ 
  21
+ /* $ModAuthor: Shawn Smith */
  22
+ /* $ModDesc: Sends server notices when a user joins/parts a channel. */
  23
+ /* $ModDepends: core 2.0-2.1 */
  24
+ 
  25
+class ModuleJoinPartSNO : public Module
  26
+{
  27
+	public:
  28
+		void init()
  29
+		{
  30
+			ServerInstance->SNO->EnableSnomask('e', "JOIN");
  31
+			ServerInstance->SNO->EnableSnomask('p', "PART");
  32
+			Implementation eventlist[] = { I_OnUserJoin, I_OnUserPart };
  33
+			ServerInstance->Modules->Attach(eventlist, this, 2);
  34
+		}
  35
+		
  36
+		Version GetVersion()
  37
+		{
  38
+			return Version("Creates SNOMask for user joins/parts", VF_VENDOR);
  39
+		}
  40
+		
  41
+		void OnUserJoin(Membership* memb, bool sync, bool created, CUList& except)
  42
+		{
  43
+			/* If it's a local user do e, else E. */
  44
+			if (IS_LOCAL(memb->user))
  45
+				ServerInstance->SNO->WriteToSnoMask('e', "User %s!%s@%s joined %s", memb->user->nick.c_str(), memb->user->ident.c_str(), memb->user->host.c_str(), memb->chan->name.c_str());
  46
+			else
  47
+				ServerInstance->SNO->WriteGlobalSno('E', "User %s!%s@%s joined %s", memb->user->nick.c_str(), memb->user->ident.c_str(), memb->user->host.c_str(), memb->chan->name.c_str());
  48
+		}
  49
+
  50
+		void OnUserPart(Membership* memb, std::string &partmessage, CUList &except)
  51
+		{
  52
+			if (IS_LOCAL(memb->user))
  53
+				ServerInstance->SNO->WriteToSnoMask('p', "User %s!%s@%s parted %s", memb->user->nick.c_str(), memb->user->ident.c_str(), memb->user->host.c_str(), memb->chan->name.c_str());
  54
+			else
  55
+				ServerInstance->SNO->WriteGlobalSno('P', "User %s!%s@%s parted %s", memb->user->nick.c_str(), memb->user->ident.c_str(), memb->user->host.c_str(), memb->chan->name.c_str());
  56
+		}
  57
+};
  58
+
  59
+MODULE_INIT(ModuleJoinPartSNO)

0 notes on commit fe4854c

Please sign in to comment.
Something went wrong with that request. Please try again.