-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathos_generateuid.cpp
More file actions
executable file
·64 lines (57 loc) · 1.9 KB
/
os_generateuid.cpp
File metadata and controls
executable file
·64 lines (57 loc) · 1.9 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* os_generateuid: Generate an XLine ID manually
*
* 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
*
* module { name = "os_generateuid"; lowercase = no; }
* command { name = "GENERATEUID"; service = "OperServ"; command = "operserv/generateuid"; }
*
* If you want to use shorthand, like /os genuid or /os genid, make another command {} block
* with the name changed to what you want. Don't change the actual command = "" area.
*/
#include "module.h"
class CommandOSGenerateUID : public Command
{
bool lowercase;
public:
CommandOSGenerateUID(Module *creator, const Anope::string &sname = "operserv/generateuid") : Command(creator, sname, 0, 0)
{
this->SetDesc(_("Manually generate an AKILL ID"));
this->SetSyntax(_(" "));
}
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
{
lowercase = Config->GetModule(this->owner)->Get<bool>("lowercase");
Anope::string id = XLineManager::GenerateUID();
if (lowercase == true)
source.Reply(_("Generated ID: " + id.lower()));
else
source.Reply(_("Generated ID: " + id));
}
bool OnHelp (CommandSource &source, const Anope::string &subcommand) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Manually generate an AKILL ID"));
return true;
}
};
class OSGenerateUID : public Module
{
CommandOSGenerateUID commandosgenerateuid;
bool lowercase;
public:
OSGenerateUID(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, THIRD), commandosgenerateuid(this)
{
this->SetAuthor("Techman");
this->SetVersion("1.0.0");
}
void OnReload(Configuration::Conf *conf) anope_override
{
Configuration::Block *block = conf->GetModule(this);
lowercase = block->Get<bool>("lowercase", "false");
}
};
MODULE_INIT(OSGenerateUID)