X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_customtitle.cpp;h=4cd84c4cce7de06a0309fdf1e7d94705363642ec;hb=12872e3d4b942d10c4dc1ec9e099345b474ac874;hp=aa5749a04a03294eff44e80d0c58ebd347bc8fe2;hpb=069a2ef21425007d092342c8c11ec28da2f410d7;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index aa5749a04..4cd84c4cc 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -1,16 +1,24 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ +/* + * InspIRCd -- Internet Relay Chat Daemon * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits + * Copyright (C) 2009 Daniel De Graaf + * Copyright (C) 2008 Pippijn van Steenhoven + * Copyright (C) 2007 Dennis Friis * - * This program is free but copyrighted software; see - * the file COPYING for details. + * This file is part of InspIRCd. InspIRCd is free software: you can + * redistribute it and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation, version 2. * - * --------------------------------------------------- + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ + #include "inspircd.h" /* $ModDesc: Provides the TITLE command which allows setting of CUSTOM WHOIS TITLE line */ @@ -25,7 +33,6 @@ class CommandTitle : public Command ctitle("ctitle", Creator) { syntax = " "; - TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } bool OneOfMatches(const char* host, const char* ip, const char* hostlist) @@ -48,19 +55,19 @@ class CommandTitle : public Command char TheIP[MAXBUF]; snprintf(TheHost,MAXBUF,"%s@%s",user->ident.c_str(), user->host.c_str()); - snprintf(TheIP, MAXBUF,"%s@%s",user->ident.c_str(), user->GetIPString()); + snprintf(TheIP, MAXBUF,"%s@%s",user->ident.c_str(), user->GetIPString().c_str()); - ConfigReader Conf(ServerInstance); - for (int i=0; iConfig->ConfTags("title"); + for (ConfigIter i = tags.first; i != tags.second; ++i) { - std::string name = Conf.ReadValue("title", "name", "", i); - std::string pass = Conf.ReadValue("title", "password", "", i); - std::string hash = Conf.ReadValue("title", "hash", "", i); - std::string host = Conf.ReadValue("title", "host", "*@*", i); - std::string title = Conf.ReadValue("title", "title", "", i); - std::string vhost = Conf.ReadValue("title", "vhost", "", i); - - if (!strcmp(name.c_str(),parameters[0].c_str()) && !ServerInstance->PassCompare(user, pass.c_str(), parameters[1].c_str(), hash.c_str()) && OneOfMatches(TheHost,TheIP,host.c_str()) && !title.empty()) + std::string Name = i->second->getString("name"); + std::string pass = i->second->getString("password"); + std::string hash = i->second->getString("hash"); + std::string host = i->second->getString("host", "*@*"); + std::string title = i->second->getString("title"); + std::string vhost = i->second->getString("vhost"); + + if (Name == parameters[0] && !ServerInstance->PassCompare(user, pass, parameters[1], hash) && OneOfMatches(TheHost,TheIP,host.c_str()) && !title.empty()) { ctitle.set(user, title); @@ -86,10 +93,14 @@ class ModuleCustomTitle : public Module CommandTitle cmd; public: - ModuleCustomTitle(InspIRCd* Me) : Module(Me), cmd(this) + ModuleCustomTitle() : cmd(this) + { + } + + void init() { - ServerInstance->AddCommand(&cmd); - Extensible::Register(&cmd.ctitle); + ServerInstance->Modules->AddService(cmd); + ServerInstance->Modules->AddService(cmd.ctitle); ServerInstance->Modules->Attach(I_OnWhoisLine, this); } @@ -116,7 +127,7 @@ class ModuleCustomTitle : public Module Version GetVersion() { - return Version("Custom Title for users", VF_COMMON | VF_VENDOR); + return Version("Custom Title for users", VF_OPTCOMMON | VF_VENDOR); } };