-
Notifications
You must be signed in to change notification settings - Fork 0
/
m_unreal_privdeaf.cpp
43 lines (38 loc) · 1.19 KB
/
m_unreal_privdeaf.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* m_unreal_privdeaf: Add support for umode +D
*
* Copyright (C) 2016 Michael Hazell <michaelhazell@hotmail.com>
*
* You may use this module under the terms of docs/COPYING,
* located in the Anope source directory
*/
#include "module.h"
class ProtoUnrealPrivDeaf : public Module
{
public:
ProtoUnrealPrivDeaf(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, THIRD)
{
this->SetAuthor("Techman");
this->SetVersion("1.0.2");
if ((!ModuleManager::FindModule("unreal") && !ModuleManager::FindModule("unreal4")) || !IRCD)
{
throw ModuleException("This module is only designed to work with UnrealIRCd.");
}
UserMode *um = ModeManager::FindUserModeByChar('D');
if (um)
{
throw ModuleException("An existing user mode '" + um->name + "' already in Anope with character 'D'");
}
ModeManager::AddUserMode(new UserMode("PRIVDEAF", 'D'));
Log(this) << "Added Anope support for Unreal PRIVDEAF (+D).";
}
~ProtoUnrealPrivDeaf()
{
UserMode *um = ModeManager::FindUserModeByName("PRIVDEAF");
if (um)
{
ModeManager::RemoveUserMode(um);
}
Log(this) << "Removed Anope support for Unreal PRIVDEAF (+D).";
}
};
MODULE_INIT(ProtoUnrealPrivDeaf)