2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2013, 2020 Sadie Powell <sadie@witchery.services>
5 * Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
6 * Copyright (C) 2010 Daniel De Graaf <danieldg@inspircd.org>
7 * Copyright (C) 2009 Uli Schlachter <psychon@inspircd.org>
8 * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
9 * Copyright (C) 2006-2008, 2010 Craig Edwards <brain@inspircd.org>
11 * This file is part of InspIRCd. InspIRCd is free software: you can
12 * redistribute it and/or modify it under the terms of the GNU General Public
13 * License as published by the Free Software Foundation, version 2.
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
27 class ModuleRandQuote : public Module
32 std::vector<std::string> quotes;
35 void init() CXX11_OVERRIDE
37 ConfigTag* conf = ServerInstance->Config->ConfValue("randquote");
38 prefix = conf->getString("prefix");
39 suffix = conf->getString("suffix");
40 FileReader reader(conf->getString("file", "quotes", 1));
41 quotes = reader.GetVector();
44 void OnUserConnect(LocalUser* user) CXX11_OVERRIDE
48 unsigned long random = ServerInstance->GenRandomInt(quotes.size());
49 user->WriteNotice(prefix + quotes[random] + suffix);
53 Version GetVersion() CXX11_OVERRIDE
55 return Version("Allows random quotes to be sent to users when they connect to the server.", VF_VENDOR);
59 MODULE_INIT(ModuleRandQuote)