Commit initial: GNUWorld servicii IRC cu README.md complet in limba romana - Analiza arhitecturala completa a proiectului - Documentatie ierarhie clase, bucla de evenimente, protocol P10 - Identificare probleme memorie si recomandari modernizare

This commit is contained in:
Underchat committed 2026-03-02 00:51:45 +02:00
commit fcb24f6de9
870 files changed
+311128

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
Makefile
*.la *.lo
.deps .libs
.arch-ids
+34
View File
@@ -0,0 +1,34 @@
2004-02-13 1.0.5 Jeekay
* Added juping of nicks that have just been autokilled
* Added RELEASE to allow jupes to be removed
* Bumped version to 1.0.5
2002-12-10 1.0.4 Jeekay
* Fixed stupid bug that would cause a crash if a non-authed user entered the
console channel.
* Bumped version to 1.0.4
2002-11-26 1.0.3 Jeekay
* Added MODUSER to allow admins to change the access levels of other users
* Added INVITE to allow admins to invite themselves into the console channel
* Bumped version to 1.0.3
2002-11-25 1.0.2 Jeekay
* Added SET CONSOLELEVEL to alter the level at which the console is logging.
* NickServ will now change the topic of the console channel to show the level.
* Bumped version to 1.0.2
2002-11-25 1.0.1 Jeekay
*** This version requires a database change. It deprecates the 'logging' table.
Please consult Updates for the relevant SQL.
* Modified CService & documentation to reflect that you can now run
NickServ and CService on the same GNUWorld core.
* Added INFO command that will let an admin see the attributes of
a registered user.
* Added SHUTDOWN command to allow admins to shut down NickServ cleanly.
* Allowed SET to take non-boolean arguments for certain properties so that
an admin can now set their logmask.
* Added consoleLevel to the config file to determine what level of events
the console channel should receive.
* Prefixed [level] to log messages to indicate at what level they were sent.
* Bumped version to 1.0.1
+68
View File
@@ -0,0 +1,68 @@
/**
* INFOCommand.cc
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
* Allows an administrator to see what attributes a registered user has.
*/
#include "gnuworld_config.h"
#include "StringTokenizer.h"
#include "levels.h"
#include "nickserv.h"
#include "responses.h"
namespace gnuworld {
namespace ns {
bool INFOCommand::Exec(iClient* theClient, const string& Message)
{
bot->theStats->incStat("NS.CMD.INFO");
sqlUser* theUser = bot->isAuthed(theClient);
if(!theUser || (theUser->getLevel() < level::admin::info)) {
bot->Notice(theClient, responses::noAccess);
return true;
}
StringTokenizer st(Message);
// INFO nick
if(st.size() != 2) {
Usage(theClient);
return true;
}
sqlUser* targetUser = bot->isRegistered(st[1]);
if(!targetUser) {
bot->Notice(theClient, responses::noSuchUser);
return true;
}
bot->Notice(theClient, "Nick: %s", targetUser->getName().c_str());
bot->Notice(theClient, "Level: %u; Flags: %u; LogMask: %u",
targetUser->getLevel(), targetUser->getFlags(), targetUser->getLogMask());
return true;
}
} // namespace ns
} // namespace gnuworld
+74
View File
@@ -0,0 +1,74 @@
/**
* INVITECommand.cc
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
* Invite the user to the console channel.
*/
#include "gnuworld_config.h"
#include "Network.h"
#include "levels.h"
#include "nickserv.h"
#include "responses.h"
namespace gnuworld
{
namespace ns
{
using std::string;
bool INVITECommand::Exec(iClient* theClient, const string& )
{
bot->theStats->incStat("NS.CMD.INVITE");
sqlUser* theUser = bot->isAuthed(theClient);
if(!theUser || (theUser->getLevel() < level::admin::invite)) {
bot->Notice(theClient, responses::noAccess);
return true;
}
Channel* theChannel = Network->findChannel(bot->getConsoleChannel());
if(!theChannel) {
bot->Notice(theClient, "Could not find the console channel on the network.");
return true;
}
ChannelUser* theBot = theChannel->findUser(bot->getInstance());
if(!theBot) {
bot->Notice(theClient, "I am not in the console channel.");
return true;
}
ChannelUser* theChannelUser = theChannel->findUser(theClient);
if(theChannelUser) {
bot->Notice(theClient, "You are already in the console channel!");
return true;
}
bot->Invite(theClient, theChannel);
return true;
} // INVITECommand
} // namespace ns
} // namespace gnuworld
+102
View File
@@ -0,0 +1,102 @@
/**
* Logger.cc
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#include <cstdarg>
#include <cstdio>
#include "gnuworld_config.h"
#include "Logger.h"
namespace gnuworld {
namespace logging {
/** Initialise our static member */
Logger* Logger::theLogger = 0;
/*********************************
** S T A T I C M E T H O D S **
*********************************/
/**
* Implementation of Logger as a singleton.
*/
Logger* Logger::getInstance()
{
if(!theLogger) theLogger = new Logger;
return theLogger;
}
/**
* Allow registration of a new log target
*/
void Logger::addLogger(logTarget* theTarget)
{
logTargets.push_back(theTarget);
}
/**
* Allow a client to log an event type
*/
void Logger::log(const events::eventType& theEvent, const string& theMessage)
{
for(logTargetsType::iterator ptr = logTargets.begin(); ptr != logTargets.end(); ptr++) {
(*ptr)->log(theEvent, theMessage);
}
}
/**
* Allow a client to log an event.
* This is a convenience wrapper around log(events::eventType&, const string&).
*/
void Logger::log(const events::eventType& theEvent, const char* format, ... ) {
char buffer[512];
va_list _list;
va_start(_list, format);
::vsnprintf(buffer, 512, format, _list);
va_end(_list);
log(theEvent, string(buffer));
}
/**
* Empty constructor
*/
Logger::Logger()
{
}
/**
* Destructor
*/
Logger::~Logger()
{
}
} // namespace logging
} // namespace gnuworld
+81
View File
@@ -0,0 +1,81 @@
/**
* Logger.h
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef LOGGER_H
#define LOGGER_H
#include <string>
#include <vector>
#include "logTarget.h"
namespace gnuworld {
namespace logging {
using std::string ;
using std::vector ;
class Logger {
public:
/**
* Implement Logger as a singleton. This method is the only way to get
* a reference to a Logger instance.
*/
static Logger* getInstance();
/**
* Allow registration of a new logTarget
*/
void addLogger(logTarget*);
/**
* Allow logging of messages
*/
void log(const events::eventType&, const string&);
void log(const events::eventType&, const char*, ... );
/**
* Type to contain logTargets
*/
typedef vector< logTarget* > logTargetsType;
/**
* Container for logTargets
*/
logTargetsType logTargets;
protected:
/** Empty constructor */
Logger();
/** Empty destructor */
~Logger();
/** Current instance of Logger */
static Logger* theLogger;
}; // class Logger
} // namespace logging
} // namespace gnuworld
#endif
+105
View File
@@ -0,0 +1,105 @@
/**
* MODUSERCommand.cc
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
* Allow an administrator to alter the level of another user
*/
#include "gnuworld_config.h"
#include "StringTokenizer.h"
#include "levels.h"
#include "nickserv.h"
#include "responses.h"
#include "sqlUser.h"
namespace gnuworld
{
namespace ns
{
using std::string;
bool MODUSERCommand::Exec(iClient* theClient, const string& Message)
{
bot->theStats->incStat("NS.CMD.MODUSER");
sqlUser* theUser = bot->isAuthed(theClient);
if(!theUser || (theUser->getLevel() < level::admin::moduser)) {
bot->Notice(theClient, responses::noAccess);
return true;
}
// MODUSER user ACCESS level
StringTokenizer st(Message);
if(st.size() != 4) {
Usage(theClient);
return true;
}
sqlUser* targetUser = bot->isRegistered(st[1]);
if(!targetUser) {
bot->Notice(theClient, responses::noSuchUser);
return true;
}
if(targetUser == theUser) {
bot->Notice(theClient, "Sorry, you may not modify your own access level.");
return true;
}
string attribute = string_upper(st[2]);
if("ACCESS" == attribute) {
int newLevel = atoi(st[3].c_str());
if(newLevel < 0 || newLevel > 999) {
bot->Notice(theClient, "Sorry, level must be between between 0 and 999, inclusive.");
return true;
}
if(static_cast< unsigned int >( newLevel ) >= theUser->getLevel()) {
bot->Notice(theClient, "You cannot raise another user's level above your own.");
return true;
}
if(targetUser->getLevel() >= theUser->getLevel()) {
bot->Notice(theClient, "You may not modify a user with a higher level than you.");
return true;
}
targetUser->setLevel(newLevel);
targetUser->commit();
bot->Notice(theClient, "Successfully set level of %s to %u",
targetUser->getName().c_str(), newLevel);
return true;
}
bot->Notice(theClient, "Sorry, unknown attribute %s.", attribute.c_str());
return true;
} // MODUSERCommand
} // namespace ns
} // namespace gnuworld
+41
View File
@@ -0,0 +1,41 @@
## Process this file with automake to produce Makefile.in
# "$Id: Makefile.am,v 1.17 2007/08/28 16:10:18 dan_karrels Exp $"
lib_LTLIBRARIES = libnickserv.la
libnickserv_la_LDFLAGS = -module -export-dynamic -L$(top_builddir)/db \
-lgnuworldDB
libnickserv_la_SOURCES = \
INFOCommand.cc \
INVITECommand.cc \
Logger.cc \
MODUSERCommand.cc \
RECOVERCommand.cc \
REGISTERCommand.cc \
RELEASECommand.cc \
SETCommand.cc \
SHUTDOWNCommand.cc \
Stats.cc \
STATSCommand.cc \
WHOAMICommand.cc \
netData.cc \
nickserv.cc \
sqlManager.cc \
sqlUser.cc
libnickserv_la_CXXFLAGS = -I$(top_srcdir)/db \
-I${top_srcdir}/include -I${top_srcdir}/libgnuworld
EXTRA_DIST = levels.h \
Logger.h \
logTarget.h \
netData.h \
nickservCommands.h \
nickserv.h \
responses.h \
sqlManager.h \
sqlUser.h \
Stats.h \
ChangeLog \
Updates \
README
+712
View File
@@ -0,0 +1,712 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# "$Id: Makefile.am,v 1.17 2007/08/28 16:10:18 dan_karrels Exp $"
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = mod.nickserv
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
ChangeLog
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/ac_cxx_namespaces.m4 \
$(top_srcdir)/ax_boost_thread.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/defs.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(libdir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libnickserv_la_LIBADD =
am_libnickserv_la_OBJECTS = libnickserv_la-INFOCommand.lo \
libnickserv_la-INVITECommand.lo libnickserv_la-Logger.lo \
libnickserv_la-MODUSERCommand.lo \
libnickserv_la-RECOVERCommand.lo \
libnickserv_la-REGISTERCommand.lo \
libnickserv_la-RELEASECommand.lo libnickserv_la-SETCommand.lo \
libnickserv_la-SHUTDOWNCommand.lo libnickserv_la-Stats.lo \
libnickserv_la-STATSCommand.lo libnickserv_la-WHOAMICommand.lo \
libnickserv_la-netData.lo libnickserv_la-nickserv.lo \
libnickserv_la-sqlManager.lo libnickserv_la-sqlUser.lo
libnickserv_la_OBJECTS = $(am_libnickserv_la_OBJECTS)
libnickserv_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
$(libnickserv_la_CXXFLAGS) $(CXXFLAGS) \
$(libnickserv_la_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libnickserv_la_SOURCES)
DIST_SOURCES = $(libnickserv_la_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INCLTDL = @INCLTDL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBGNUWORLD = @LIBGNUWORLD@
LIBLTDL = @LIBLTDL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIPO = @LIPO@
LN_S = @LN_S@
LTDLDEPS = @LTDLDEPS@
LTDLINCL = @LTDLINCL@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NEW_MODS = @NEW_MODS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pgsql_includedir = @pgsql_includedir@
pgsql_libdir = @pgsql_libdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
threadLib = @threadLib@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
lib_LTLIBRARIES = libnickserv.la
libnickserv_la_LDFLAGS = -module -export-dynamic -L$(top_builddir)/db \
-lgnuworldDB
libnickserv_la_SOURCES = \
INFOCommand.cc \
INVITECommand.cc \
Logger.cc \
MODUSERCommand.cc \
RECOVERCommand.cc \
REGISTERCommand.cc \
RELEASECommand.cc \
SETCommand.cc \
SHUTDOWNCommand.cc \
Stats.cc \
STATSCommand.cc \
WHOAMICommand.cc \
netData.cc \
nickserv.cc \
sqlManager.cc \
sqlUser.cc
libnickserv_la_CXXFLAGS = -I$(top_srcdir)/db \
-I${top_srcdir}/include -I${top_srcdir}/libgnuworld
EXTRA_DIST = levels.h \
Logger.h \
logTarget.h \
netData.h \
nickservCommands.h \
nickserv.h \
responses.h \
sqlManager.h \
sqlUser.h \
Stats.h \
ChangeLog \
Updates \
README
all: all-am
.SUFFIXES:
.SUFFIXES: .cc .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mod.nickserv/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu mod.nickserv/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libnickserv.la: $(libnickserv_la_OBJECTS) $(libnickserv_la_DEPENDENCIES)
$(libnickserv_la_LINK) -rpath $(libdir) $(libnickserv_la_OBJECTS) $(libnickserv_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnickserv_la-INFOCommand.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnickserv_la-INVITECommand.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnickserv_la-Logger.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnickserv_la-MODUSERCommand.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnickserv_la-RECOVERCommand.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnickserv_la-REGISTERCommand.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnickserv_la-RELEASECommand.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnickserv_la-SETCommand.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnickserv_la-SHUTDOWNCommand.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnickserv_la-STATSCommand.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnickserv_la-Stats.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnickserv_la-WHOAMICommand.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnickserv_la-netData.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnickserv_la-nickserv.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnickserv_la-sqlManager.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnickserv_la-sqlUser.Plo@am__quote@
.cc.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cc.obj:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cc.lo:
@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
libnickserv_la-INFOCommand.lo: INFOCommand.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -MT libnickserv_la-INFOCommand.lo -MD -MP -MF $(DEPDIR)/libnickserv_la-INFOCommand.Tpo -c -o libnickserv_la-INFOCommand.lo `test -f 'INFOCommand.cc' || echo '$(srcdir)/'`INFOCommand.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libnickserv_la-INFOCommand.Tpo $(DEPDIR)/libnickserv_la-INFOCommand.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='INFOCommand.cc' object='libnickserv_la-INFOCommand.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -c -o libnickserv_la-INFOCommand.lo `test -f 'INFOCommand.cc' || echo '$(srcdir)/'`INFOCommand.cc
libnickserv_la-INVITECommand.lo: INVITECommand.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -MT libnickserv_la-INVITECommand.lo -MD -MP -MF $(DEPDIR)/libnickserv_la-INVITECommand.Tpo -c -o libnickserv_la-INVITECommand.lo `test -f 'INVITECommand.cc' || echo '$(srcdir)/'`INVITECommand.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libnickserv_la-INVITECommand.Tpo $(DEPDIR)/libnickserv_la-INVITECommand.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='INVITECommand.cc' object='libnickserv_la-INVITECommand.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -c -o libnickserv_la-INVITECommand.lo `test -f 'INVITECommand.cc' || echo '$(srcdir)/'`INVITECommand.cc
libnickserv_la-Logger.lo: Logger.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -MT libnickserv_la-Logger.lo -MD -MP -MF $(DEPDIR)/libnickserv_la-Logger.Tpo -c -o libnickserv_la-Logger.lo `test -f 'Logger.cc' || echo '$(srcdir)/'`Logger.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libnickserv_la-Logger.Tpo $(DEPDIR)/libnickserv_la-Logger.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Logger.cc' object='libnickserv_la-Logger.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -c -o libnickserv_la-Logger.lo `test -f 'Logger.cc' || echo '$(srcdir)/'`Logger.cc
libnickserv_la-MODUSERCommand.lo: MODUSERCommand.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -MT libnickserv_la-MODUSERCommand.lo -MD -MP -MF $(DEPDIR)/libnickserv_la-MODUSERCommand.Tpo -c -o libnickserv_la-MODUSERCommand.lo `test -f 'MODUSERCommand.cc' || echo '$(srcdir)/'`MODUSERCommand.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libnickserv_la-MODUSERCommand.Tpo $(DEPDIR)/libnickserv_la-MODUSERCommand.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='MODUSERCommand.cc' object='libnickserv_la-MODUSERCommand.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -c -o libnickserv_la-MODUSERCommand.lo `test -f 'MODUSERCommand.cc' || echo '$(srcdir)/'`MODUSERCommand.cc
libnickserv_la-RECOVERCommand.lo: RECOVERCommand.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -MT libnickserv_la-RECOVERCommand.lo -MD -MP -MF $(DEPDIR)/libnickserv_la-RECOVERCommand.Tpo -c -o libnickserv_la-RECOVERCommand.lo `test -f 'RECOVERCommand.cc' || echo '$(srcdir)/'`RECOVERCommand.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libnickserv_la-RECOVERCommand.Tpo $(DEPDIR)/libnickserv_la-RECOVERCommand.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='RECOVERCommand.cc' object='libnickserv_la-RECOVERCommand.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -c -o libnickserv_la-RECOVERCommand.lo `test -f 'RECOVERCommand.cc' || echo '$(srcdir)/'`RECOVERCommand.cc
libnickserv_la-REGISTERCommand.lo: REGISTERCommand.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -MT libnickserv_la-REGISTERCommand.lo -MD -MP -MF $(DEPDIR)/libnickserv_la-REGISTERCommand.Tpo -c -o libnickserv_la-REGISTERCommand.lo `test -f 'REGISTERCommand.cc' || echo '$(srcdir)/'`REGISTERCommand.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libnickserv_la-REGISTERCommand.Tpo $(DEPDIR)/libnickserv_la-REGISTERCommand.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='REGISTERCommand.cc' object='libnickserv_la-REGISTERCommand.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -c -o libnickserv_la-REGISTERCommand.lo `test -f 'REGISTERCommand.cc' || echo '$(srcdir)/'`REGISTERCommand.cc
libnickserv_la-RELEASECommand.lo: RELEASECommand.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -MT libnickserv_la-RELEASECommand.lo -MD -MP -MF $(DEPDIR)/libnickserv_la-RELEASECommand.Tpo -c -o libnickserv_la-RELEASECommand.lo `test -f 'RELEASECommand.cc' || echo '$(srcdir)/'`RELEASECommand.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libnickserv_la-RELEASECommand.Tpo $(DEPDIR)/libnickserv_la-RELEASECommand.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='RELEASECommand.cc' object='libnickserv_la-RELEASECommand.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -c -o libnickserv_la-RELEASECommand.lo `test -f 'RELEASECommand.cc' || echo '$(srcdir)/'`RELEASECommand.cc
libnickserv_la-SETCommand.lo: SETCommand.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -MT libnickserv_la-SETCommand.lo -MD -MP -MF $(DEPDIR)/libnickserv_la-SETCommand.Tpo -c -o libnickserv_la-SETCommand.lo `test -f 'SETCommand.cc' || echo '$(srcdir)/'`SETCommand.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libnickserv_la-SETCommand.Tpo $(DEPDIR)/libnickserv_la-SETCommand.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SETCommand.cc' object='libnickserv_la-SETCommand.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -c -o libnickserv_la-SETCommand.lo `test -f 'SETCommand.cc' || echo '$(srcdir)/'`SETCommand.cc
libnickserv_la-SHUTDOWNCommand.lo: SHUTDOWNCommand.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -MT libnickserv_la-SHUTDOWNCommand.lo -MD -MP -MF $(DEPDIR)/libnickserv_la-SHUTDOWNCommand.Tpo -c -o libnickserv_la-SHUTDOWNCommand.lo `test -f 'SHUTDOWNCommand.cc' || echo '$(srcdir)/'`SHUTDOWNCommand.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libnickserv_la-SHUTDOWNCommand.Tpo $(DEPDIR)/libnickserv_la-SHUTDOWNCommand.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SHUTDOWNCommand.cc' object='libnickserv_la-SHUTDOWNCommand.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -c -o libnickserv_la-SHUTDOWNCommand.lo `test -f 'SHUTDOWNCommand.cc' || echo '$(srcdir)/'`SHUTDOWNCommand.cc
libnickserv_la-Stats.lo: Stats.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -MT libnickserv_la-Stats.lo -MD -MP -MF $(DEPDIR)/libnickserv_la-Stats.Tpo -c -o libnickserv_la-Stats.lo `test -f 'Stats.cc' || echo '$(srcdir)/'`Stats.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libnickserv_la-Stats.Tpo $(DEPDIR)/libnickserv_la-Stats.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Stats.cc' object='libnickserv_la-Stats.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -c -o libnickserv_la-Stats.lo `test -f 'Stats.cc' || echo '$(srcdir)/'`Stats.cc
libnickserv_la-STATSCommand.lo: STATSCommand.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -MT libnickserv_la-STATSCommand.lo -MD -MP -MF $(DEPDIR)/libnickserv_la-STATSCommand.Tpo -c -o libnickserv_la-STATSCommand.lo `test -f 'STATSCommand.cc' || echo '$(srcdir)/'`STATSCommand.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libnickserv_la-STATSCommand.Tpo $(DEPDIR)/libnickserv_la-STATSCommand.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='STATSCommand.cc' object='libnickserv_la-STATSCommand.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -c -o libnickserv_la-STATSCommand.lo `test -f 'STATSCommand.cc' || echo '$(srcdir)/'`STATSCommand.cc
libnickserv_la-WHOAMICommand.lo: WHOAMICommand.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -MT libnickserv_la-WHOAMICommand.lo -MD -MP -MF $(DEPDIR)/libnickserv_la-WHOAMICommand.Tpo -c -o libnickserv_la-WHOAMICommand.lo `test -f 'WHOAMICommand.cc' || echo '$(srcdir)/'`WHOAMICommand.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libnickserv_la-WHOAMICommand.Tpo $(DEPDIR)/libnickserv_la-WHOAMICommand.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='WHOAMICommand.cc' object='libnickserv_la-WHOAMICommand.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -c -o libnickserv_la-WHOAMICommand.lo `test -f 'WHOAMICommand.cc' || echo '$(srcdir)/'`WHOAMICommand.cc
libnickserv_la-netData.lo: netData.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -MT libnickserv_la-netData.lo -MD -MP -MF $(DEPDIR)/libnickserv_la-netData.Tpo -c -o libnickserv_la-netData.lo `test -f 'netData.cc' || echo '$(srcdir)/'`netData.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libnickserv_la-netData.Tpo $(DEPDIR)/libnickserv_la-netData.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='netData.cc' object='libnickserv_la-netData.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -c -o libnickserv_la-netData.lo `test -f 'netData.cc' || echo '$(srcdir)/'`netData.cc
libnickserv_la-nickserv.lo: nickserv.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -MT libnickserv_la-nickserv.lo -MD -MP -MF $(DEPDIR)/libnickserv_la-nickserv.Tpo -c -o libnickserv_la-nickserv.lo `test -f 'nickserv.cc' || echo '$(srcdir)/'`nickserv.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libnickserv_la-nickserv.Tpo $(DEPDIR)/libnickserv_la-nickserv.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='nickserv.cc' object='libnickserv_la-nickserv.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -c -o libnickserv_la-nickserv.lo `test -f 'nickserv.cc' || echo '$(srcdir)/'`nickserv.cc
libnickserv_la-sqlManager.lo: sqlManager.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -MT libnickserv_la-sqlManager.lo -MD -MP -MF $(DEPDIR)/libnickserv_la-sqlManager.Tpo -c -o libnickserv_la-sqlManager.lo `test -f 'sqlManager.cc' || echo '$(srcdir)/'`sqlManager.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libnickserv_la-sqlManager.Tpo $(DEPDIR)/libnickserv_la-sqlManager.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sqlManager.cc' object='libnickserv_la-sqlManager.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -c -o libnickserv_la-sqlManager.lo `test -f 'sqlManager.cc' || echo '$(srcdir)/'`sqlManager.cc
libnickserv_la-sqlUser.lo: sqlUser.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -MT libnickserv_la-sqlUser.lo -MD -MP -MF $(DEPDIR)/libnickserv_la-sqlUser.Tpo -c -o libnickserv_la-sqlUser.lo `test -f 'sqlUser.cc' || echo '$(srcdir)/'`sqlUser.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libnickserv_la-sqlUser.Tpo $(DEPDIR)/libnickserv_la-sqlUser.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sqlUser.cc' object='libnickserv_la-sqlUser.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnickserv_la_CXXFLAGS) $(CXXFLAGS) -c -o libnickserv_la-sqlUser.lo `test -f 'sqlUser.cc' || echo '$(srcdir)/'`sqlUser.cc
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
for dir in "$(DESTDIR)$(libdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-libLTLIBRARIES
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-libLTLIBRARIES
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am \
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-libLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
+6
View File
@@ -0,0 +1,6 @@
This module current DOES NOT WORK. It is UNDER CONSTRUCTION.
If you wanna play with it, by all means go ahead. But consider it
pre-alpha code with no guarantee that it will do anything other than eat
your mother and chat up your harddrive.
+70
View File
@@ -0,0 +1,70 @@
/**
* RECOVERCommand.cc
*
* Allows a user to kill off another user that is
* using their registered nickname.
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#include "gnuworld_config.h"
#include "Network.h"
#include "nickserv.h"
namespace gnuworld
{
namespace ns
{
using std::string;
bool RECOVERCommand::Exec(iClient* theClient, const string& )
{
bot->theStats->incStat("NS.CMD.RECOVER");
string authedNick = theClient->getAccount();
iClient* targetClient = Network->findNick(authedNick);
if(!targetClient) {
bot->Notice(theClient, "Unable to find the nick %s.",
authedNick.c_str());
return true;
}
if(theClient == targetClient) {
bot->Notice(theClient, "Recovering yourself is a bad idea.");
return true;
}
sqlUser* theUser = bot->isRegistered(authedNick);
if(theUser && !theUser->hasFlag(sqlUser::F_RECOVER)) {
bot->Notice(theClient, "This user has disabled use of the RECOVER command.");
return true;
}
bot->Kill(targetClient, "Nick recovered by " + theClient->getNickName());
bot->Notice(theClient, "Nick successfully recovered.");
return true;
}
} // namespace ns
} // namespace gnuworld
+78
View File
@@ -0,0 +1,78 @@
/**
* REGISTERCommand.cc
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
* This command allows a user to register their AC nick
*/
#include <ctime>
#include "gnuworld_config.h"
#include "netData.h"
#include "nickserv.h"
namespace gnuworld
{
namespace ns
{
using std::string;
bool REGISTERCommand::Exec(iClient* theClient, const string& )
{
bot->theStats->incStat("NS.CMD.REGISTER");
/* Is this nick already registered? */
sqlUser* theUser = bot->isRegistered(theClient->getAccount());
if(theUser) {
bot->Notice(theClient, "The nickname %s has already been registered.",
theUser->getName().c_str());
return true;
}
/* This nick is not currently registered. First, create a sqlUser for them */
/* TODO: The sqlManager instance should not be a public variable */
theUser = new sqlUser(bot->theManager);
theUser->setName(theClient->getAccount());
/* Enable AUTOKILL and RECOVER by default */
theUser->setFlag(sqlUser::F_AUTOKILL | sqlUser::F_RECOVER);
theUser->setLastSeenTS(time(NULL));
theUser->setRegisteredTS(time(NULL));
theUser->insertUser();
/* Assign the new user to the iClient */
netData* theData = static_cast< netData* >( theClient->getCustomData(bot) );
theData->authedUser = theUser;
/* Insert the new user into the cache */
bot->addUserToCache(theUser->getName(), theUser);
bot->Notice(theClient, "Your nickname, %s, has been successfully registered.",
theClient->getAccount().c_str());
bot->Notice(theClient, "Note: AUTOKILL and RECOVER are enabled by default.");
return true;
}
} // namespace ns
} // namespace gnuworld
+70
View File
@@ -0,0 +1,70 @@
/**
* RELEASECommand.cc
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
* This command allows a user to release their nick if it has been juped.
*/
#include <ctime>
#include "Network.h"
#include "nickserv.h"
namespace gnuworld
{
namespace ns
{
using std::string;
bool RELEASECommand::Exec(iClient* theClient, const string& )
{
bot->theStats->incStat("NS.CMD.RELEASE");
string account = theClient->getAccount();
if(account.empty()) {
bot->Notice(theClient, "You have not authenticated. Please login before"
" trying to use RELEASE.");
return false;
}
iClient *fakeClient = Network->findNick(account);
if(fakeClient == 0 || ! fakeClient->isFake()) {
bot->Notice(theClient, "No jupe exists for %s.",
account.c_str()
);
return false;
}
/* The fakeClient now points to the juped client */
bot->getUplink()->DetachClient(fakeClient, "Jupe released.");
delete fakeClient;
bot->Notice(theClient, "%s successfully released.",
account.c_str()
);
return true;
} // RELEASECommand::Exec(iClient*, const string&)
} // namespace ns
} // namespace gnuworld
+140
View File
@@ -0,0 +1,140 @@
/**
* SETCommand.cc
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
* Allow a user to set various flags on themselves
*/
#include "gnuworld_config.h"
#include "StringTokenizer.h"
#include "levels.h"
#include "nickserv.h"
namespace gnuworld
{
namespace ns
{
using std::string;
bool SETCommand::Exec(iClient* theClient, const string& Message)
{
bot->theStats->incStat("NS.CMD.SET");
/* Is this user logged in? */
sqlUser* theUser = bot->isAuthed(theClient);
if(!theUser) {
bot->Notice(theClient, "You must log in and register before attempting to use commands.");
return true;
}
StringTokenizer st(Message);
/* Format:
* SET property status
* 0 1 2
*/
if(st.size() != 3) {
Usage(theClient);
return true;
}
/* Extract our strings from the tokenized message */
string property = string_upper(st[1]);
string status = string_upper(st[2]);
/* First check if it is a non-true/false variable */
if("CONSOLELEVEL" == property) {
if(theUser->getLevel() < level::admin::consolelevel) {
bot->Notice(theClient, "Sorry, you do not have access to this command.");
return true;
}
logging::events::eventType newMask = atoi(status.c_str());
if(newMask < logging::events::E_MIN || newMask > logging::events::E_MAX) {
bot->Notice(theClient, "LogMask must be between %u and %u.",
logging::events::E_MIN, logging::events::E_MAX);
return true;
}
bot->setConsoleLevel(newMask);
bot->Notice(theClient, "Set console level to %u.", newMask);
bot->Notice(theClient, "REMINDER: This is only effective until the next restart.");
return true;
} else if("LOGMASK" == property) {
if(theUser->getLevel() < level::set::logmask) {
bot->Notice(theClient, "Sorry, you do not have access to this command.");
return true;
}
logging::events::eventType newMask = atoi(status.c_str());
if(newMask < logging::events::E_MIN || newMask > logging::events::E_MAX) {
bot->Notice(theClient, "LogMask must be between %u and %u.",
logging::events::E_MIN, logging::events::E_MAX);
return true;
}
theUser->setLogMask(newMask);
theUser->commit();
bot->Notice(theClient, "LogMask set to %u.", newMask);
return true;
}
/* Make some sense out of what we've been given for a status */
bool bStatus;
if("ON" == status) {
bStatus = true;
} else if("OFF" == status) {
bStatus = false;
} else {
bot->Notice(theClient, "The value of STATUS must be ON or OFF.");
return true;
}
/* Find out what flag we are trying to alter */
sqlUser::flagType theFlag = 0;
if("AUTOKILL" == property) theFlag = sqlUser::F_AUTOKILL;
if("RECOVER" == property) theFlag = sqlUser::F_RECOVER;
if(0 == theFlag) {
bot->Notice(theClient, "Unknown property %s.", property.c_str());
return true;
}
if(bStatus) {
theUser->setFlag(theFlag);
} else {
theUser->removeFlag(theFlag);
}
theUser->commit();
bot->Notice(theClient, "%s set to %s", property.c_str(), status.c_str());
return true;
} // bool SETCommand::Exec
} // namespace ns
} // namespace gnuworld
+75
View File
@@ -0,0 +1,75 @@
/**
* SHUTDOWNCommand.cc
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
* Allows an administrator to shut down NickServ cleanly.
*/
#include <sstream>
#include "gnuworld_config.h"
#include "StringTokenizer.h"
#include "levels.h"
#include "logTarget.h"
#include "nickserv.h"
#include "sqlUser.h"
namespace gnuworld {
namespace ns {
bool SHUTDOWNCommand::Exec(iClient* theClient, const string& Message)
{
StringTokenizer st(Message);
if(st.size() < 2) {
Usage(theClient);
return true;
}
sqlUser* theUser = bot->isAuthed(theClient);
if(!theUser || (theUser->getLevel() < level::admin::shutdown)) {
bot->Notice(theClient, "Sorry, you do not have access to this command.");
return true;
}
bot->theLogger->log(logging::events::E_ERROR, "%s (%s) is asking me to shutdown: %s",
theClient->getNickName().c_str(), theUser->getName().c_str(),
st.assemble(1).c_str());
std::stringstream toSQuit;
toSQuit << server->getCharYY() << " SQ "
<< server->getName() << " 0 :("
<< theUser->getName() << ") "
<< st.assemble(1);
std::stringstream toQuit;
toQuit << bot->getCharYYXXX() << " Q :"
<< st.assemble(1);
bot->Write(toQuit);
bot->Write(toSQuit);
return true;
} // SHUTDOWNCommand::Exec(iClient*, const string&)
} // namespace ns
} // namespace gnuworld
+61
View File
@@ -0,0 +1,61 @@
/**
* STATSCommand.cc
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
* Give the user various statistics
*/
#include "gnuworld_config.h"
#include "levels.h"
#include "nickserv.h"
#include "responses.h"
#include "Stats.h"
namespace gnuworld
{
namespace ns
{
using std::string;
bool STATSCommand::Exec(iClient* theClient, const string& )
{
bot->theStats->incStat("NS.CMD.STATS");
sqlUser* theUser = bot->isAuthed(theClient);
if(!theUser || (theUser->getLevel() < level::admin::stats)) {
bot->Notice(theClient, responses::noAccess);
return true;
}
Stats::statsMapType::const_iterator statsBegin = bot->theStats->getStatsMapBegin();
Stats::statsMapType::const_iterator statsEnd = bot->theStats->getStatsMapEnd();
for(Stats::statsMapType::const_iterator ptr = statsBegin; ptr != statsEnd; ptr++) {
string stat = ptr->first;
unsigned int amount = ptr->second;
bot->Notice(theClient, "%s: %u", stat.c_str(), amount);
}
return true;
} // STATSCommand
} // namespace ns
} // namespace gnuworld
+98
View File
@@ -0,0 +1,98 @@
/**
* Stats.cc
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#include <new>
#include "gnuworld_config.h"
#include "Stats.h"
namespace gnuworld {
/* Initialise our static data members */
Stats* Stats::theStats = 0;
/*********************************
** S T A T I C M E T H O D S **
*********************************/
/**
* Implementation of singleton. This is the only way to get a reference to a
* Stats object.
*/
Stats* Stats::getInstance()
{
if(!theStats) theStats = new Stats();
return theStats;
}
/*********************************
** C O N / D E S T R U C T O R **
*********************************/
/**
* Empty constructor
*/
Stats::Stats()
{
}
/**
* Empty destructor
*/
Stats::~Stats()
{
}
/*******************************
** S T A T S C O N T R O L **
*******************************/
/**
* This function allows incrementing of stats
*/
void Stats::incStat(const string& theStat, unsigned int amount)
{
statsMapType::iterator ptr = statsMap.find(theStat);
if(ptr == statsMap.end()) {
statsMap.insert(statsMapType::value_type(theStat, amount));
} else {
ptr->second += amount;
}
}
/**
* This function allows access to a single stats count
*/
unsigned int Stats::getStat(const string& theStat)
{
statsMapType::const_iterator ptr = statsMap.find(theStat);
if(ptr == statsMap.end()) {
return 0;
} else {
return ptr->second;
}
}
} // namespace gnuworld
+87
View File
@@ -0,0 +1,87 @@
/**
* Stats.h
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef STATS_H
#define STATS_H
#include <map>
#include <string>
namespace gnuworld {
using std::map ;
using std::string ;
class Stats {
public:
/**
* Implement Stats as a singleton
* Only way to get a reference to the manager is through this method
*/
static Stats* getInstance();
/*********************
** T Y P E D E F S **
*********************/
typedef map< string, int > statsMapType;
/*******************************
** S T A T S C O N T R O L **
*******************************/
/** Increment a given statistic */
void incStat(const string&, unsigned int = 1);
/** Get given stat value */
unsigned int getStat(const string&);
/** Accessor for statsMap.begin() */
inline const statsMapType::const_iterator getStatsMapBegin() const
{ return statsMap.begin(); }
/** Accessor for statsMap.end() */
inline const statsMapType::const_iterator getStatsMapEnd() const
{ return statsMap.end(); }
protected:
/**
* Disable the default constructor so that instances can only be gotten
* through getInstance()
* @see #getInstance
*/
Stats();
/**
* Disable the default destructor so that other objects cannot destruct
* the instance they have a reference to.
*/
~Stats();
/** The current instance of Stats */
static Stats* theStats;
/** The stats map */
statsMapType statsMap;
}; // class Stats
} // namespace gnuworld
#endif
+27
View File
@@ -0,0 +1,27 @@
***** 2002-11-25 1.0.1 Jeekay
SELECT id,name,lastseen_ts,registered_ts,flags,level
INTO users_tmp
FROM users;
DROP TABLE users;
CREATE TABLE "users" (
"id" integer DEFAULT nextval('"users_id_seq"'::text) NOT NULL,
"name" character varying(40) NOT NULL,
"lastseen_ts" integer DEFAULT 0 NOT NULL,
"registered_ts" integer DEFAULT 0 NOT NULL,
"flags" integer DEFAULT 0 NOT NULL,
"level" smallint DEFAULT 0 NOT NULL,
"logmask" smallint DEFAULT 0 NOT NULL,
Constraint "users_pkey" Primary Key ("id")
);
CREATE INDEX id_users_key ON users USING btree (id);
INSERT INTO users (id,name,lastseen_ts,registered_ts,flags,level)
SELECT id,name,lastseen_ts,registered_ts,flags,level
FROM users_tmp;
DROP TABLE users_tmp;
+62
View File
@@ -0,0 +1,62 @@
/**
* WHOAMICommand.cc
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#include <sstream>
#include "gnuworld_config.h"
#include "nickserv.h"
using std::stringstream ;
using std::ends ;
namespace gnuworld
{
namespace ns
{
using std::string;
bool WHOAMICommand::Exec(iClient* theClient, const string&)
{
bot->theStats->incStat("NS.CMD.WHOAMI");
sqlUser* theUser = bot->isAuthed(theClient);
stringstream theResponse;
theResponse << "Nick: " << theClient->getNickName()
<< "; Account: " << theClient->getAccount();
if(theUser) {
theResponse << "; Level: " << theUser->getLevel()
<< "; Flags: " << theUser->getFlags()
<< "; LogMask: " << theUser->getLogMask()
;
}
theResponse << ends;
bot->Notice(theClient, theResponse.str());
return true;
}
} // namespace ns
} // namespace gnuworld
+58
View File
@@ -0,0 +1,58 @@
/**
* levels.h
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
* This file contains the various levels required to do various
* interesting things.
* Excuse the number of namespaces.
*/
#ifndef LEVELS_H
#define LEVELS_H
namespace gnuworld {
namespace ns {
namespace level {
namespace admin {
const unsigned int stats = 1;
const unsigned int info = 100;
const unsigned int invite = 100;
const unsigned int remove = 500;
const unsigned int consolelevel = 800;
const unsigned int moduser = 850;
const unsigned int shutdown = 900;
} // namespace admin
namespace set {
const unsigned int logmask = 100;
} // namespace set
} // namespace level
} // namespace ns
} // namespace gnuworld
#endif
+78
View File
@@ -0,0 +1,78 @@
/**
* logTarget.h
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef LOGTARGET_H
#define LOGTARGET_H
/*
* logTarget.h
*
* Declaration of abstract base class logTarget
*
* Any classes wishing to be a target for logging must
* inherit this.
*/
#include <string>
namespace gnuworld {
namespace logging {
using std::string ;
namespace events {
typedef int eventType;
static const eventType E_MIN = 0x0000;
static const eventType E_MAX = 0x003F;
/* Make sure any new additions here are also added to logTarget::getIdent */
static const eventType E_PROTOCOL = 0x0001;
static const eventType E_SQL = 0x0002;
static const eventType E_DEBUG = 0x0004;
static const eventType E_INFO = 0x0008;
static const eventType E_WARNING = 0x0010;
static const eventType E_ERROR = 0x0020;
} // namespace events
class logTarget {
public:
inline static string getIdent(const events::eventType& theEvent) {
string temp;
if(theEvent & events::E_ERROR) temp += 'E';
if(theEvent & events::E_WARNING) temp += 'W';
if(theEvent & events::E_INFO) temp += 'I';
if(theEvent & events::E_DEBUG) temp += 'D';
if(theEvent & events::E_SQL) temp += 'S';
if(theEvent & events::E_PROTOCOL) temp += 'P';
return temp;
}
virtual ~logTarget() {}
virtual void log(const events::eventType&, const string&) = 0;
}; // class logTarget
} // namespace logging
} // namespace gnuworld
#endif
+44
View File
@@ -0,0 +1,44 @@
/**
* netData.cc
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
* This class stores information about a given iClient.
* It is used as a quick reference to logged in users and for checking warnings
*/
#include "gnuworld_config.h"
#include "netData.h"
namespace gnuworld
{
namespace ns
{
netData::netData() :
authedUser(0),
warned(0)
{
}
netData::~netData()
{
}
} // namespace ns
} // namespace gnuworld
+57
View File
@@ -0,0 +1,57 @@
/**
* netData.h
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef NETDATA_H
#define NETDATA_H
#include "sqlUser.h"
#include "logTarget.h"
namespace gnuworld
{
namespace ns
{
class netData
{
public:
/** Empty Constructor */
netData();
/** Empty Destructor */
~netData();
/** Pointer to sqlUser if authed */
sqlUser* authedUser;
/** Has this user been warned? */
bool warned;
/** This users logging status */
logging::events::eventType logMask;
}; // class netData
} // namespace ns
} // namespace gnuworld
#endif
+707
View File
@@ -0,0 +1,707 @@
/**
* nickserv.cc
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#include <sstream>
#include <iostream>
#include <cstdarg>
#include "gnuworld_config.h"
#include "Network.h"
#include "StringTokenizer.h"
#include "netData.h"
#include "nickserv.h"
namespace gnuworld
{
namespace ns
{
/*
* Exported function used by moduleLoader to gain an
* instance of this module.
*/
extern "C"
{
xClient* _gnuwinit(const string& args)
{
return new nickserv( args );
}
}
/**
* This constructor calls the base class constructor. The xClient
* constructor will open the configuration file given and retrieve
* basic client info (nick/user/host/etc).
* Any additional processing must be done here.
*/
nickserv::nickserv( const string& configFileName )
: xClient( configFileName )
{
/* Load the config file */
nickservConfig = new (std::nothrow) EConfig(configFileName);
assert(nickservConfig != 0);
/* Load in the values we need from the config file */
consoleChannel = nickservConfig->Require("consoleChannel")->second;
/* Load in the processing queue variables */
checkFreq = atoi(nickservConfig->Require("checkFreq")->second.c_str());
startDelay = atoi(nickservConfig->Require("startDelay")->second.c_str());
/* Load debugging variables */
consoleLevel = atoi(nickservConfig->Require("consoleLevel")->second.c_str());
/* Load the DB variables */
string dbHost = nickservConfig->Require("dbHost")->second;
string dbPort = nickservConfig->Require("dbPort")->second;
string dbDb = nickservConfig->Require("dbDb")->second;
string dbUser = nickservConfig->Require("dbUser")->second;
string dbPass = nickservConfig->Require("dbPass")->second;
commitFreq = atoi(nickservConfig->Require("commitFreq")->second.c_str());
int commitCount = atoi(nickservConfig->Require("commitCount")->second.c_str());
string dbString = "host=" + dbHost + " port=" + dbPort + " dbname=" + dbDb
+ " user="+dbUser + " password=" + dbPass;
theManager = sqlManager::getInstance(dbString, commitCount);
/* Precache the users */
precacheUsers();
/* Register the commands we want to use */
RegisterCommand(new INFOCommand(this, "INFO", "<nick>"));
RegisterCommand(new INVITECommand(this, "INVITE", ""));
RegisterCommand(new MODUSERCommand(this, "MODUSER", "<nick> [ACCESS] <level>"));
RegisterCommand(new RECOVERCommand(this, "RECOVER", ""));
RegisterCommand(new REGISTERCommand(this, "REGISTER", ""));
RegisterCommand(new RELEASECommand(this, "RELEASE", ""));
RegisterCommand(new SETCommand(this, "SET", "<property> <value>"));
RegisterCommand(new SHUTDOWNCommand(this, "SHUTDOWN", "<reason>"));
RegisterCommand(new STATSCommand(this, "STATS", "<stat>"));
RegisterCommand(new WHOAMICommand(this, "WHOAMI", ""));
/* Get our Stats instance */
theStats = Stats::getInstance();
/* Get our logger instance */
theLogger = logging::Logger::getInstance();
/* Register ourselves as a logTarget */
theLogger->addLogger(this);
}
nickserv::~nickserv()
{
delete nickservConfig;
}
/**
* This is the catcher for log messages. It compares the event type to the
* cached log event receivers. If it matches, send a notice off to that
* target.
*/
void nickserv::log(const eventType& theEvent, const string& _theMessage)
{
iClient* theClient;
sqlUser* theUser;
string theMessage = "[" + logging::logTarget::getIdent(theEvent) + "] ";
theMessage += _theMessage;
for(logUsersType::iterator ptr = logUsers.begin(); ptr != logUsers.end(); ) {
theClient = *ptr;
theUser = isAuthed(theClient);
if(!theUser) {
// Something very odd is going on
elog << "*** [nickserv::log] User in queue but not logged in: "
<< theClient->getNickName() << std::endl;
}
if(theUser->getLogMask() & theEvent) {
Notice(theClient, theMessage);
}
ptr++;
}
if(consoleLevel & theEvent) {
logAdminMessage("%s", theMessage.c_str());
}
}
/**
* Here we decide what channels our xClient needs to burst in to.
* The only channel of any interest to us is our console channel, which is
* loaded from the configuration file.
*/
void nickserv::BurstChannels()
{
MyUplink->JoinChannel(this, consoleChannel, nickservConfig->Require("consoleChannelModes")->second);
MyUplink->RegisterChannelEvent(consoleChannel, this);
std::stringstream setTopic;
setTopic << getCharYYXXX() << " T "
<< consoleChannel << " :"
<< "Current NickServ console level: ["
<< logging::logTarget::getIdent(consoleLevel)
<< "] (" << consoleLevel << ")";
Write(setTopic);
return xClient::BurstChannels() ;
}
/**
* Here we set up the various bits and pieces that we need an xServer
* reference to be able to do.
*/
void nickserv::OnAttach()
{
for(commandMapType::iterator ptr = commandMap.begin(); ptr != commandMap.end(); ++ptr) {
ptr->second->setServer(MyUplink);
}
/* Register for all the events we want to see */
MyUplink->RegisterEvent(EVT_ACCOUNT, this);
MyUplink->RegisterEvent(EVT_CHNICK, this);
MyUplink->RegisterEvent(EVT_KILL, this);
MyUplink->RegisterEvent(EVT_NICK, this);
MyUplink->RegisterEvent(EVT_QUIT, this);
/* Register timerID's to process queues */
/* The timer to kick off the processing of the queue
* Note: We add startDelay here to allow for a longer delay before checking
* when we first link to the net
*/
time_t theTime = time(NULL) + startDelay;
processQueue_timerID = MyUplink->RegisterTimer(theTime, this, NULL);
xClient::OnAttach() ;
}
/**
* Here we deal with any channel events we want to listen to.
*/
void nickserv::OnChannelEvent(const channelEventType& theEvent,
Channel* theChannel,
void* data1, void*, void*, void*)
{
iClient* theClient = 0;
switch (theEvent) {
case EVT_JOIN: {
if(theChannel->getName() != consoleChannel) {
theLogger->log(logging::events::E_WARNING, "Received a JOIN for channel: %s.",
theChannel->getName().c_str());
return ;
}
theClient = static_cast< iClient* > ( data1 );
sqlUser* theUser = isAuthed(theClient);
if(theUser && theUser->getLevel() > 0) Op(theChannel, theClient);
break;
} // case EVT_JOIN
} // switch (theEvent)
}
/**
* Here we deal with the various CTCP messages that can get thrown at us.
*/
void nickserv::OnCTCP( iClient* theClient, const string& CTCP,
const string& Message, bool Secure)
{
StringTokenizer st(CTCP);
if(st.empty()) return ;
string Command = string_upper(st[0]);
if("DCC" == Command) {
DoCTCP(theClient, CTCP, "REJECT");
} else if("PING" == Command) {
DoCTCP(theClient, CTCP, Message);
} else if("VERSION" == Command) {
DoCTCP(theClient, CTCP, "GNUWorld NickServ v1.0.5");
}
xClient::OnCTCP(theClient, CTCP, Message, Secure);
}
/**
* Here we deal with any network events that we have asked to listen for.
* The main jobs done are:
* EVT_ACCOUNT : If the account is the same as the nick, we remove it from
the warnQueue should it be there.
* EVT_NICK : Instantiate a netData object and assign it to the iClient.
* Add the iClient to the process queue.
* EVT_CHNICK : If the new nick is the current account, do nothing.
* If the iClient isnt in the process queue, readd it.
* We do NOT zero the warning count. This is to prevent someone
* jumping between registered nicks to avoid getting killed.
* EVT_KILL : Delete the netData instance
* Remove the iClient from the process queue
* EVT_QUIT : Delete the netData instance
* Remove the iClient from the process queue
*/
void nickserv::OnEvent( const eventType& event,
void* Data1, void* Data2, void* Data3, void* Data4)
{
/* The target user of the event */
iClient* theClient = static_cast< iClient* >( Data1 );
switch( event ) {
case EVT_KILL: theClient = static_cast< iClient* >( Data2 );
case EVT_QUIT: {
netData* theData = static_cast< netData* >( theClient->removeCustomData(this) );
delete theData;
removeFromQueue(theClient);
logUsersType::iterator ptr = find(logUsers.begin(), logUsers.end(), theClient);
if(ptr != logUsers.end()) { logUsers.erase(ptr); }
return ;
break;
} // case EVT_KILL/QUIT
case EVT_NICK: {
netData* theData = new netData();
theClient->setCustomData(this, theData);
/* If this user has umode +r */
if(theClient->isModeR()) {
/* Find the sqlUser for their +r and assign it to this iClient */
theData->authedUser = isRegistered(theClient->getAccount());
if(theData->authedUser) {
if(theData->authedUser->getLogMask()) { logUsers.push_back(theClient); }
theData->authedUser->commitLastSeen();
}
}
addToQueue(theClient);
return ;
break;
} // case EVT_NICK
case EVT_CHNICK: {
addToQueue(theClient);
return ;
break;
} // case EVT_CHNICK
case EVT_ACCOUNT: {
netData* theData = static_cast< netData* > (theClient->getCustomData(this));
theData->authedUser = isRegistered(theClient->getAccount());
if(theData->authedUser) {
if(theData->authedUser->getLogMask()) { logUsers.push_back(theClient); }
theData->authedUser->commitLastSeen();
}
return ;
break;
} // case EVT_ACCOUNT
} // switch( event )
xClient::OnEvent( event, Data1, Data2, Data3, Data4 ) ;
}
/**
* Here we deal with incoming communications from network clients.
*/
void nickserv::OnPrivateMessage( iClient* theClient,
const string& Message, bool )
{
if(!theClient->isModeR()) {
Notice(theClient, "You must be logged in before attempting to use any commands.");
return ;
}
StringTokenizer st(Message);
if(st.empty()) {
Notice(theClient, "Incomplete command");
return ;
}
string Command = string_upper(st[0]);
commandMapType::iterator commHandler = commandMap.find(Command);
if(commHandler == commandMap.end()) {
return ;
}
commHandler->second->Exec(theClient, Message);
}
/**
* When a timer expires, this function is called. It allows for periodic
* processing of data.
*/
void nickserv::OnTimer(const xServer::timerID& theTimer, void* )
{
if(theTimer == processQueue_timerID) {
processQueue();
time_t theTime = time(NULL) + checkFreq;
processQueue_timerID = MyUplink->RegisterTimer(theTime, this, NULL);
} // if(theTimer == processQueue_timerID)
} // nickserv::OnTimer(xServer::timerID, void*)
/**
* This is where we register a command so that users can interact
* with the module.
*/
bool nickserv::RegisterCommand( Command* theCommand )
{
return commandMap.insert( commandPairType(theCommand->getName(), theCommand)).second;
}
/**
* This function empties the current user cache and reloads all information from
* the database. It is only called at startup, as the cache is authoritative.
*/
void nickserv::precacheUsers()
{
elog << "*** [NickServ:precacheUsers] Precaching users." << std::endl;
/* Get a connection instance to our backend */
dbHandle* cacheCon = theManager->getConnection();
/* Retrieve the list of registered users */
std::stringstream cacheQuery;
cacheQuery << "SELECT id,name,flags,level,lastseen_ts,registered_ts,logmask"
<< " FROM users";
if(cacheCon->Exec(cacheQuery,true)) {
for(unsigned int i = 0; i < cacheCon->Tuples(); i++) {
sqlUser* tmpUser = new sqlUser(theManager);
assert(tmpUser != 0);
tmpUser->setAllMembers(cacheCon, i);
sqlUserCache.insert(sqlUserHashType::value_type(tmpUser->getName(), tmpUser));
}
} else {
elog << "*** [NickServ:precacheUsers] Error executing query: "
<< cacheCon->ErrorMessage()
<< std::endl;
::exit(0);
}
elog << "*** [NickServ:precacheUsers] Done. Loaded a total of "
<< sqlUserCache.size() << " user records."
<< std::endl;
/* Dispose of our connection instance */
theManager->removeConnection(cacheCon);
}
/**
* This function simply takes a name/sqlUser* pair and adds them to the cache
*/
void nickserv::addUserToCache(string username, sqlUser* theUser)
{
sqlUserCache.insert(sqlUserHashType::value_type(username, theUser));
}
/**
* This function attempts to add a given iClient to the processing queue.
* It will return 1 if the client did not already exist in the queue, else 0.
* It is safe to ignore the return value.
*/
int nickserv::addToQueue(iClient* theClient)
{
QueueType::iterator queuePos =
find(warnQueue.begin(), warnQueue.end(), theClient);
if(queuePos != warnQueue.end()) {
return 0;
} else {
warnQueue.push_back(theClient);
return 1;
}
} // nickserv::addToQueue(iClient*)
/**
* This function attempts to remove a given iClient from the processing queue.
* It will 1 if the client was actually found, else 0.
* It is safe to ignore the return value.
*/
int nickserv::removeFromQueue(iClient* theClient)
{
QueueType::iterator queuePos =
find(warnQueue.begin(), warnQueue.end(), theClient);
if(queuePos != warnQueue.end()) {
warnQueue.erase(queuePos);
return 1;
} else {
return 0;
}
} // nickserv::removeFromQueue(iClient*)
/**
* This function iterates through the processing queue and takes any
* action as appropriate.
*/
void nickserv::processQueue()
{
theStats->incStat("NS.PROCESS");
theLogger->log(logging::events::E_DEBUG, "Processing queue - %u entr%s.",
warnQueue.size(), (warnQueue.size() == 1) ? ("y") : ("ies"));
/* A number of things can happen here.
* Firstly, the warnQueue can be empty. If this is the case, return immediately.
*/
if(warnQueue.size() == 0) { return; }
QueueType killQueue;
vector<string> jupeQueue;
/* Now we start to process the queue. The rules are as follows for a given nick:
* Is the cached user record set to autokill?
* No - remove entry from warnQueue, continue processing next element
* Has the user already been warned?
* Yes - add user to killQueue, remove from warnQueue
* No - warn user, increment warnings
*
* NOTE: The for() does NOT automatically increment queuePos so we must take care
* to do it manually when required. This is to enable us to delete from the
* warnQueue while we are iterating over it.
*/
for(QueueType::iterator queuePos = warnQueue.begin(); queuePos != warnQueue.end(); ) {
iClient* theClient = *queuePos;
netData* theData = static_cast< netData* >( theClient->getCustomData(this) );
/* Is this a juped nick? */
/* TODO: There should be an iClient call for this */
if(theClient->isFake()) {
/* This is a juped nick. Let's not try to kill it eh. */
queuePos = warnQueue.erase(queuePos);
continue;
}
/* Is this nick registered? */
sqlUser* regUser = isRegistered(theClient->getNickName());
if(!regUser) {
theData->warned = 0;
queuePos = warnQueue.erase(queuePos);
continue;
}
/* Does the regUser have autokill set? */
if(!regUser->hasFlag(sqlUser::F_AUTOKILL)) {
theData->warned = 0;
queuePos = warnQueue.erase(queuePos);
continue;
}
/* User is registered and record has autokill set.
* See if this iClient and the sqlUser match */
if(isAccountMatch(theClient, regUser)) {
theData->warned = 0;
queuePos = warnQueue.erase(queuePos);
continue;
}
/* We now know that the user is NOT logged in as the user, and the user
* has AUTOKILL set. Warn them. */
if(theData->warned) {
killQueue.push_back(theClient);
queuePos = warnQueue.erase(queuePos);
continue;
} else {
Notice(theClient, "You are using a registered nickname. Please login or you will be disconnected.");
theData->warned++;
theStats->incStat("NS.WARN");
theLogger->log(logging::events::E_INFO, "Warned: (" +
theClient->getCharYYXXX() + ") " + theClient->getNickName());
queuePos++;
continue;
} // if(theData->warned)
} // iterate over warnQueue
if(killQueue.empty()) { return; }
for(QueueType::iterator queuePos = killQueue.begin(); queuePos != killQueue.end(); queuePos++) {
iClient* theClient = *queuePos;
/* Add the nickname to the juping queue */
jupeQueue.push_back(theClient->getNickName());
netData* theData = static_cast<netData*>(theClient->removeCustomData(this));
delete(theData);
theStats->incStat("NS.KILL");
theLogger->log(logging::events::E_INFO, "Killed: (" +
theClient->getCharYYXXX() + ") " + theClient->getNickName());
Kill(theClient, "[NickServ] AutoKill");
} // iterate over killQueue
/* Iterate over jupeQueue and do appropriate things */
string fakenumeric(MyUplink->getCharYY() + "]]]");
for( vector<string>::iterator itr = jupeQueue.begin();
itr != jupeQueue.end() ;
++itr ) {
string theNick = *itr;
theLogger->log( logging::events::E_DEBUG, "Juping " +
theNick
);
/* Set up a fake iClient to represent the new jupe.
* TODO: The connect time should probably be less so that we win any
* collision races resulting from a lagging network.
*/
iClient *fakeClient = new iClient(
MyUplink->getIntYY(),
fakenumeric,
theNick,
"juped",
"AAAAAA",
"nick.name",
"nick.name",
"+ikd",
string(),
0,
"Juped Nick",
::time( 0 )
);
assert( fakeClient != 0 );
if( ! MyUplink->AttachClient( fakeClient, this ) ) {
theLogger->log(logging::events::E_INFO, "Unable to jupe: " + theNick);
}
}
} // nickserv::processQueue()
/**
* This function simply writes a given message to the console channel.
*/
void nickserv::logAdminMessage(const char* format, ... )
{
char buf[1024] = {0};
va_list _list;
va_start(_list, format);
vsnprintf(buf, 1024, format, _list);
va_end(_list);
Channel* logChannel = Network->findChannel(consoleChannel);
if(!logChannel) return;
Message(logChannel, buf);
return;
}
/**
* This allows a command to modify the console level
*/
void nickserv::setConsoleLevel(logging::events::eventType& newMask) {
if(newMask < logging::events::E_MIN || newMask > logging::events::E_MAX) {
theLogger->log(logging::events::E_WARNING, "An attempt was made to set the"
" console level to %u.", newMask);
return;
}
consoleLevel = newMask;
Write("%s T %s :Current NickServ console level: %u",
getCharYYXXX().c_str(), consoleChannel.c_str(), newMask);
}
/**
* This function compares an iClient and a sqlUser and returns true if they
* match, ie iClient->getNickName() == sqlUser->getName()
*/
bool nickserv::isAccountMatch(iClient* theClient, sqlUser* theUser)
{
string lowerNickName = string_lower(theClient->getAccount());
string lowerName = string_lower(theUser->getName());
if(lowerNickName == lowerName) return true;
return false;
}
/**
* This function simply returns iClient->netData->authedUser.
* It is purely a convenience method.
*/
sqlUser* nickserv::isAuthed(iClient* theClient)
{
netData* theData = static_cast< netData* >( theClient->getCustomData(this) );
return (theData ? theData->authedUser : 0) ;
}
/**
* This function simply checks if a given nick is registered, and if so then returns
* the associated sqlUser* from the cache.
*/
sqlUser* nickserv::isRegistered(string theNick)
{
sqlUserHashType::iterator cachedUser = sqlUserCache.find(theNick);
if(cachedUser == sqlUserCache.end()) return 0;
return cachedUser->second;
}
void Command::Usage(iClient* theClient)
{
bot->Notice(theClient, string("SYNTAX: ") + getInfo());
}
} // namespace ns
} // namespace gnuworld
+221
View File
@@ -0,0 +1,221 @@
/**
* nickserv.h
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef NICKSERV_H
#define NICKSERV_H "$Id: nickserv.h,v 1.18 2007/08/28 16:10:19 dan_karrels Exp $"
#include "client.h"
#include "EConfig.h"
#include "server.h"
#include "Logger.h"
#include "logTarget.h"
#include "nickservCommands.h"
#include "sqlManager.h"
#include "sqlUser.h"
#include "Stats.h"
namespace gnuworld {
namespace ns {
class nickserv : public xClient, public logging::logTarget {
public:
/***********************************************************
** O V E R R I D E N L O G T A R G E T M E T H O D S **
***********************************************************/
/** Receive a message for logging */
virtual void log(const logging::events::eventType&, const string&);
/*******************************************************
** O V E R R I D E N X C L I E N T M E T H O D S **
*******************************************************/
/** Constructor receives a configuration file name */
nickserv( const string& ) ;
/** Destructor to remove anything interesting we've done */
virtual ~nickserv() ;
/** This method is called after server connection */
virtual void BurstChannels() ;
/** This is called when we have attached to the xServer */
virtual void OnAttach() ;
/** This is called when a channel event we are listening for happens */
virtual void OnChannelEvent( const channelEventType&, Channel*, void*,
void*, void*, void* ) ;
/** This is called when we receive a CTCP */
virtual void OnCTCP( iClient*, const string&, const string&, bool ) ;
/** This is called when a network event happens */
virtual void OnEvent( const eventType&, void* , void*, void*, void* ) ;
/** This method is called when the bot gets a PRIVMSG */
virtual void OnPrivateMessage( iClient*, const string&, bool secure ) ;
/** This method is called when a timer expires */
virtual void OnTimer(const gnuworld::xServer::timerID&, void*) ;
/*********************************
** N I C K S E R V T Y P E S **
*********************************/
typedef map< string, Command*, noCaseCompare > commandMapType;
typedef commandMapType::value_type commandPairType;
typedef vector< iClient* > QueueType;
typedef map< string, sqlUser*, noCaseCompare > sqlUserHashType;
typedef vector< iClient* > logUsersType;
/*************************************
** N I C K S E R V M E T H O D S **
*************************************/
/** Insert a nick/sqlUser* pair into the cache */
void addUserToCache(string, sqlUser*);
/* Accessor for consoleChannel */
inline const string getConsoleChannel() const
{ return consoleChannel; }
/** Log a message to the console channel */
void logAdminMessage(const char*, ... );
/** Load all users into the user cache */
void precacheUsers();
/** Register a command */
virtual bool RegisterCommand(Command*);
/** Change the console level */
void setConsoleLevel(logging::events::eventType&);
/***********************************
* Q U E U E P R O C E S S I N G *
***********************************/
/** Add an iClient to the processing queue */
int addToQueue(iClient*);
/** Process the queue */
void processQueue();
/** Remove an iClient from the processing queue */
int removeFromQueue(iClient*);
/*********************************
** U S E R R E S O U R C E S **
*********************************/
/** Check if a given iClient matches a given sqlUser */
bool isAccountMatch(iClient*, sqlUser*);
/** Returns a sqlUser if the user is registered */
sqlUser* isAuthed(iClient*);
/** Returns a sqlUser for a given user name */
sqlUser* isRegistered(string);
/*******************************
** M I S C E L L A N E O U S **
*******************************/
/** Holds a reference to our Stats collector */
Stats::Stats* theStats;
/** Holds a reference to our Logger instance */
logging::Logger* theLogger;
/*****************************************
** N I C K S E R V V A R I A B L E S **
*****************************************/
/** Our sqlManager instance for DB communication */
sqlManager* theManager;
protected:
/*********************************************
** I N T E R N A L M A I N T E N A N C E **
*********************************************/
commandMapType commandMap;
/*************************************
** C O N F I G V A R I A B L E S **
*************************************/
/** The frequency with which we process the queue */
int checkFreq;
/** Store the console channel name */
string consoleChannel;
/** Store the config file pointer */
EConfig* nickservConfig;
/** How long to wait after linking before processing */
int startDelay;
/** How frequently to commit to the database */
int commitFreq;
/** What messages should be sent to the console channel */
logging::events::eventType consoleLevel;
/*****************
** Q U E U E S **
*****************/
/** List of iClient's that currently need verifying */
QueueType warnQueue;
/** The cached list of registered users */
sqlUserHashType sqlUserCache;
/** The list of log users */
logUsersType logUsers;
/***********************
** T I M E R I D S **
***********************/
/** TimerID for processing the queue */
gnuworld::xServer::timerID processQueue_timerID;
}; // class nickserv
} // namespace ns
} // namespace gnuworld
#endif
+107
View File
@@ -0,0 +1,107 @@
/**
* nickservCommands.h
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef NICKSERVCOMMANDS_H
#define NICKSERVCOMMANDS_H
#include <string>
/**
* All this code is stolen straight from mod.cservice, which possibly had
* stolen it from somewhere else. I'm increasingly convinced that only
* ripper knows how any of this works.
*/
namespace gnuworld
{
class iClient;
class xServer;
namespace ns
{
class nickserv;
class Command {
public:
Command(nickserv* _bot,
const std::string& _commName,
const std::string& _help) :
bot(_bot), server(0), commName(_commName), help(_help)
{}
virtual ~Command() {}
virtual bool Exec(iClient*, const std::string&) = 0;
void setServer(xServer* _server)
{ server = _server; }
virtual std::string getInfo() const
{ return commName + ' ' + help; }
virtual void Usage(iClient*);
inline const std::string& getName() const
{ return commName; }
inline const std::string& getHelp() const
{ return help; }
protected:
nickserv* bot;
xServer* server;
std::string commName;
std::string help;
}; // class Command
/* Big nasty #define time! */
#define DECLARE_COMMAND(commName) \
class commName##Command : public Command \
{ \
public: \
commName##Command(nickserv* _bot, \
const std::string& _commName, \
const std::string& _help) : \
Command(_bot, _commName, _help) {} \
virtual ~commName##Command() {} \
virtual bool Exec(iClient*, const std::string&); \
};
/* Level 0 Commands */
DECLARE_COMMAND( RECOVER )
DECLARE_COMMAND( REGISTER )
DECLARE_COMMAND( RELEASE )
DECLARE_COMMAND( SET )
DECLARE_COMMAND( WHOAMI )
/* Admin commands */
DECLARE_COMMAND( INFO )
DECLARE_COMMAND( INVITE )
DECLARE_COMMAND( MODUSER )
DECLARE_COMMAND( SHUTDOWN )
DECLARE_COMMAND( STATS )
} // namespace ns
} // namespace gnuworld
#endif
+42
View File
@@ -0,0 +1,42 @@
/**
* responses.h
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
* This file statically defines the various messages used globally
* in the module.
*/
#ifndef RESPONSES_H
#define RESPONSES_H
namespace gnuworld {
namespace ns {
namespace responses {
const string noAccess("Sorry, you do not have access to this command.");
const string noSuchUser("Sorry, that user name does not exist.");
} // namespace responses
} // namespace ns
} // namespace gnuworld
#endif
+184
View File
@@ -0,0 +1,184 @@
/**
* sqlManager.cc
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#include <new>
#include <iostream>
#include <cassert>
#include "gnuworld_config.h"
#include "ELog.h"
#include "sqlManager.h"
#include "dbHandle.h"
#include <cstdlib>
using std::endl ;
namespace gnuworld {
namespace ns {
/* Initialise our static data members */
sqlManager* sqlManager::theManager = 0;
/*********************************
** S T A T I C M E T H O D S **
*********************************/
/**
* Implementation of singleton - this is the only way to get a reference to
* the sqlManager instance, and it does not allow modification.
* initialise must be called prior to attempted to obtain an instance.
* This method is static.
*/
sqlManager* sqlManager::getInstance(const string& _dbString, int _commitQueueMax)
{
if(theManager) return theManager;
/* There is currently no sqlManager instance */
return new sqlManager(_dbString, _commitQueueMax);
} // static sqlManager* sqlManager::getInstance(const string&)
/*********************************
** P U B L I C M E T H O D S **
*********************************/
/**
* This method creates and returns a connection to the database.
* It will use the stored dbString to create the connection.
*/
dbHandle* sqlManager::getConnection()
{
elog << "*** [sqlManager:getConnection] Attempting DB connection to: "
<< dbString << endl;
dbHandle* tempCon = new (std::nothrow) dbHandle(dbString.c_str());
assert(tempCon != 0);
if(tempCon->ConnectionBad()) {
elog << "*** [sqlManager:getConnection] Unable to connect to DB: "
<< tempCon->ErrorMessage() << endl;
::exit(0);
} else {
elog << "*** [sqlManager:getConnection] Connection established to DB."
<< endl;
}
return tempCon;
}
/**
* This method will disconnect and destroy a database connection.
* This method should never be passed a null pointer.
*/
void sqlManager::removeConnection(dbHandle* tempCon)
{
assert(tempCon != 0);
elog << "*** [sqlManager:removeConnection] Removing DB connection." << endl;
delete tempCon;
}
/**
* This method simply processes all statements in the queue, executing
* them against the database.
* TODO: Should this be inside a transaction?
*/
void sqlManager::flush()
{
theStats->incStat("SM.FLUSH");
for(CommitQueueItr ptr = commitQueue.begin(); ptr != commitQueue.end(); ++ptr) {
string statement = *ptr;
theStats->incStat("SM.EXEC");
#ifdef LOG_SQL
elog << "*** [sqlManager:flush] Executing: " << statement << endl;
#endif
theLogger->log(logging::events::E_SQL, "Executing: " + statement);
if(!SQLDb->Exec(statement)) {
theStats->incStat("SM.ERROR");
string error = string(SQLDb->ErrorMessage());
#ifndef LOG_SQL
/* Make sure people without LOG_SQL still see what statement failed */
elog << "*** [sqlManager:flush] Executing: " << statement << endl;
#endif
elog << "*** [sqlManager:flush] Error: " << error << endl;
theLogger->log(logging::events::E_ERROR, "Executing: " + statement);
theLogger->log(logging::events::E_ERROR, "Error : " + error);
// TODO: Log error
}
}
commitQueue.clear();
}
/**
* This method allows a caller to add a statement to the commit queue.
* The statement will be executed against the database when the next commit
* interval occurs.
*/
void sqlManager::queueCommit(const string& theStatement)
{
commitQueue.push_back(theStatement);
if(commitQueue.size() >= commitQueueMax) {
flush();
}
}
/*****************************************************
** C O N S T R U C T O R & D E S T R U C T O R **
*****************************************************/
/**
* This is our constructor that initialises DB communications
* and any of the queues that will be used
* It is only ever called from initialise()
*/
sqlManager::sqlManager(const string& _dbString, int _commitQueueMax)
{
/* Construct our DB object and initialise queues */
dbString = _dbString;
SQLDb = getConnection();
commitQueueMax = _commitQueueMax;
theStats = Stats::getInstance();
theLogger = logging::Logger::getInstance();
} // sqlManager::sqlManager
/**
* This is our constructor that ensures the proper teardown of
* our DB link and clears out any memory currently in use by
* queues or objects
*/
sqlManager::~sqlManager()
{
/* Destruct our DB object and any queues */
elog << "*** [sqlManager] Shutting down DB communications." << endl;
removeConnection(SQLDb);
} // sqlManager::~sqlManager()
} // namespace ns
} // namespace gnuworld
+104
View File
@@ -0,0 +1,104 @@
/**
* sqlManager.h
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef SQLMANAGER_H
#define SQLMANAGER_H
#include <string>
#include <vector>
#include "dbHandle.h"
#include "Logger.h"
#include "Stats.h"
namespace gnuworld {
namespace ns {
using std::string ;
using std::vector ;
class sqlManager {
public:
/**
* Implement sqlManager as a singleton
* Only way to get a reference to the manager is through this method
*/
static sqlManager* getInstance(const string&, int);
/** Allow checking out of database connections */
dbHandle* getConnection();
/** Allow checking in of database connections */
void removeConnection(dbHandle*);
/** Flush the current commit queue to the database */
void flush();
/** Add a statement to the commit queue */
void queueCommit(const string&);
protected:
/**
* Disable the default constructor so that instances can only be gotten
* through getInstance()
* @see #getInstance
*/
sqlManager(const string&, int);
/**
* Disable the default destructor so that other objects cannot destruct
* the instance they have a reference to.
*/
~sqlManager();
/** The string storing our DB connection path */
string dbString;
/** Our PgDatabase instance */
dbHandle* SQLDb;
/** The type used for the commit queue */
typedef vector< string > commitQueueType;
/** Allow iteration over the commit queue */
typedef commitQueueType::iterator CommitQueueItr;
/** Our commit queue */
commitQueueType commitQueue;
/** Max commit queue size before autocommit */
unsigned long int commitQueueMax;
/** The current instance of sqlManager */
static sqlManager* theManager;
/** A Stats instance for stats collecting */
Stats* theStats;
/** A Logger instance for logging */
logging::Logger* theLogger;
}; // class sqlManager
} // namespace ns
} // namespace gnuworld
#endif
+150
View File
@@ -0,0 +1,150 @@
/**
* sqlUser.cc
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
* Stores a database user
*/
#include <ctime>
#include <sstream>
#include "gnuworld_config.h"
#include "sqlManager.h"
#include "sqlUser.h"
#include "misc.h"
namespace gnuworld {
namespace ns {
using std::stringstream ;
const sqlUser::flagType sqlUser::F_SUSPEND = 0x0001;
const sqlUser::flagType sqlUser::F_AUTOKILL = 0x0002;
const sqlUser::flagType sqlUser::F_RECOVER = 0x0004;
unsigned long int sqlUser::maxUserId = 0;
/**
* Default constructor.
* This simply creates an empty, zeroed sqlUser
*/
sqlUser::sqlUser(sqlManager* _myManager) :
id(0),
name(""),
flags(0),
level(0),
lastseen_ts(0),
registered_ts(0),
logmask(0)
{
myManager = _myManager;
}
/**
* Default destructor.
* This does nothing as we have no heap space allocated
*/
sqlUser::~sqlUser()
{
}
/**
* This function commits the current state of the sqlUser back to
* the backend DB
*/
void sqlUser::commit()
{
/* Use reference to sqlManager to queue a commit request */
stringstream userCommit;
userCommit << "UPDATE users SET"
<< " name = '" << name << "'"
<< ", flags = " << flags
<< ", level = " << level
<< ", lastseen_ts = " << lastseen_ts
<< ", registered_ts = " << registered_ts
<< ", logmask = " << logmask
<< " WHERE id = " << id;
myManager->queueCommit(userCommit.str());
}
/**
* This function updates this users lastseen back to the DB
*/
void sqlUser::commitLastSeen()
{
lastseen_ts = time(NULL);
commit();
}
/**
* This function simply deletes this users entry from the DB.
* It is possible to call insertUser() on a sqlUser that has
* just been deleteUser()'d
*/
void sqlUser::deleteUser()
{
/* Construct our delete statement */
stringstream commitStatement;
commitStatement << "DELETE FROM users WHERE"
<< " id = " << id;
myManager->queueCommit(commitStatement.str());
}
/**
* This function inserts a brand new user into the DB.
* It is a slight fudge, in that it first creates a blank record then
* calls commit() to update the data fields for that record. This is done
* so that any new fields added will automatically be dealt with in commit()
* instead of in 50 different functions.
*/
void sqlUser::insertUser()
{
/* Grab the next available user id */
id = ++maxUserId;
/* Construct our insert statement */
stringstream commitStatement;
commitStatement << "INSERT INTO users (id,name) VALUES ("
<< id
<< ", '" << name << "'"
<< ")";
myManager->queueCommit(commitStatement.str());
commit();
}
/**
* This function loads in data from a DB handle,
* to initialise the object properly
*/
void sqlUser::setAllMembers(dbHandle* theDB, int row)
{
/* Grab the data, set the members */
id = atoi(theDB->GetValue(row, 0));
name = theDB->GetValue(row, 1);
flags = atoi(theDB->GetValue(row, 2));
level = atoi(theDB->GetValue(row, 3));
lastseen_ts = atoi(theDB->GetValue(row, 4));
registered_ts = atoi(theDB->GetValue(row, 5));
logmask = atoi(theDB->GetValue(row, 6));
if(id > maxUserId) maxUserId = id;
}
} // namespace ns
} // namespace gnuworld
+160
View File
@@ -0,0 +1,160 @@
/**
* sqlUser.h
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef SQLUSER_H
#define SQLUSER_H
#include <string>
#include "dbHandle.h"
#include "logTarget.h"
namespace gnuworld
{
namespace ns
{
using std::string ;
class sqlManager;
class sqlUser
{
public:
typedef unsigned short int flagType;
static const flagType F_SUSPEND;
static const flagType F_AUTOKILL;
static const flagType F_RECOVER;
/** Default constructor makes an empty user */
sqlUser(sqlManager*);
/** Default destructor deletes user */
~sqlUser();
/* ACCESSOR METHODS */
/** Accessor for id */
inline const unsigned int& getID() const
{ return id; }
/** Accessor for name */
inline const string& getName() const
{ return name; }
/** Check whether a user has a given flag set */
inline bool hasFlag(const flagType& whichFlag) const
{ return (flags & whichFlag); }
/** Get all the flags */
inline unsigned short int getFlags() const
{ return flags; }
/** Get the user level */
inline unsigned int getLevel() const
{ return level; }
/** Get the user lastseen */
inline unsigned int getLastSeenTS() const
{ return lastseen_ts; }
/** Get the registered ts */
inline unsigned int getRegisteredTS() const
{ return registered_ts; }
/** Get the log mask */
inline logging::events::eventType getLogMask() const
{ return logmask; }
/* MUTATOR METHODS */
/** Mutator for name */
inline void setName(const string& _name)
{ name = _name; }
/** Remove a flag from the user record */
inline void removeFlag(const flagType& whichFlag)
{ flags &= ~whichFlag; }
/** Set a flag on the user record */
inline void setFlag(const flagType& whichFlag)
{ flags |= whichFlag; }
/** Set all flags */
inline void setFlags(const flagType& whichFlags)
{ flags = whichFlags; }
/** Set the user level */
inline void setLevel(const unsigned int _level)
{ level = _level; }
/** Set the lastseen */
inline void setLastSeenTS(const unsigned int _lastseen)
{ lastseen_ts = _lastseen; }
/** Set the registered ts */
inline void setRegisteredTS(const unsigned int _registered)
{ registered_ts = _registered; }
/** Set the log mask */
inline void setLogMask(const logging::events::eventType _logmask)
{ logmask = _logmask; }
/* MISCELLANEOUS METHODS */
/** Commit this user back to the database */
void commit();
/** Update this users lastseen */
void commitLastSeen();
/** Delete this user from the database */
void deleteUser();
/** Insert a brand new sqlUser into the database */
void insertUser();
/** Load data for this user from a given DB handle */
void setAllMembers(dbHandle*, int);
/** Static member for keeping track of max user id */
static unsigned long int maxUserId;
protected:
unsigned int id;
string name;
flagType flags;
unsigned int level;
unsigned int lastseen_ts;
unsigned int registered_ts;
logging::events::eventType logmask;
sqlManager* myManager;
}; // class sqlUser
} // namespace ns
} // namespace gnuworld
#endif