mirror of
https://github.com/anope/anope.git
synced 2026-07-09 14:43:13 +02:00
Added in new plaintext databases. Note: This currently has no automatic backup feature. Big thanks to Phil on this for mass scale testing
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2722 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@ services.h: sysconf.h config.h extern.h
|
||||
extern.h: slist.h
|
||||
touch $@
|
||||
|
||||
pseudo.h: commands.h timers.h datafiles.h slist.h
|
||||
pseudo.h: commands.h timers.h slist.h
|
||||
touch $@
|
||||
|
||||
clean:
|
||||
|
||||
+2
-2
@@ -58,8 +58,8 @@ enum NickCoreFlag
|
||||
NI_SUSPENDED,
|
||||
/* Autoop nickname in channels */
|
||||
NI_AUTOOP,
|
||||
/* Nick won't expire */
|
||||
NI_NOEXPIRE,
|
||||
/* This nickcore is forbidden, which means the nickalias for it is aswell */
|
||||
NI_FORBIDDEN,
|
||||
|
||||
NI_END
|
||||
};
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
/* Name of configuration file (in Services directory) */
|
||||
#define SERVICES_CONF "services.conf"
|
||||
|
||||
/* Name of anope datbase */
|
||||
#define DATABASE_FILE "anope.db"
|
||||
|
||||
/* Name of log file (in Services directory) */
|
||||
#define LOG_FILENAME "services.log"
|
||||
|
||||
|
||||
+2
-16
@@ -432,8 +432,6 @@ class ServerConfig
|
||||
/* Global realname */
|
||||
char *desc_GlobalNoticer;
|
||||
|
||||
/* Name of the hostserv database */
|
||||
char *HostDBName;
|
||||
/* HostServ Name */
|
||||
char *s_HostServ;
|
||||
/* HostServ realname */
|
||||
@@ -443,18 +441,6 @@ class ServerConfig
|
||||
char *PIDFilename;
|
||||
/* MOTD filename */
|
||||
char *MOTDFilename;
|
||||
/* NickServ DB name */
|
||||
char *NickDBName;
|
||||
/* DB name for nicks being registered */
|
||||
char *PreNickDBName;
|
||||
/* Channel DB name */
|
||||
char *ChanDBName;
|
||||
/* Botserv DB name */
|
||||
char *BotDBName;
|
||||
/* OperServ db name */
|
||||
char *OperDBName;
|
||||
/* News DB name */
|
||||
char *NewsDBName;
|
||||
|
||||
/* True if its ok to not be able to save backs */
|
||||
bool NoBackupOkay;
|
||||
@@ -695,8 +681,6 @@ class ServerConfig
|
||||
unsigned MaxSessionLimit;
|
||||
/* How long session akills should last */
|
||||
time_t SessionAutoKillExpiry;
|
||||
/* DB name for exceptions */
|
||||
char *ExceptionDBName;
|
||||
/* Reason to use for session kills */
|
||||
char *SessionLimitExceeded;
|
||||
/* Optional second reason */
|
||||
@@ -708,6 +692,8 @@ class ServerConfig
|
||||
std::list<std::string> ModulesAutoLoad;
|
||||
/* Encryption modules */
|
||||
std::list<std::string> EncModuleList;
|
||||
/* Database modules */
|
||||
std::list<std::string> DBModuleList;
|
||||
/* HostServ Core Modules */
|
||||
std::list<std::string> HostServCoreModules;
|
||||
/* MemoServ Core Modules */
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
/* Database file descriptor structure and file handling routine prototypes.
|
||||
*
|
||||
* (C) 2003-2009 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for furhter details.
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DATAFILES_H
|
||||
#define DATAFILES_H
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/param.h>
|
||||
#define DeleteFile unlink
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif /* DATAFILES_H */
|
||||
@@ -393,8 +393,6 @@ E void SetDefaultMLock();
|
||||
|
||||
/**** modules.c ****/
|
||||
E void modules_unload_all(bool unload_proto); /* Read warnings near function source */
|
||||
E void ModuleDatabaseBackup(const char *dbname);
|
||||
E void ModuleRemoveBackups(const char *dbname);
|
||||
|
||||
/**** nickserv.c ****/
|
||||
|
||||
|
||||
+98
-7
@@ -186,7 +186,7 @@ enum CommandReturn
|
||||
const char *ano_moderr();
|
||||
#endif
|
||||
|
||||
typedef enum { CORE,PROTOCOL,THIRD,SUPPORTED,QATESTED,ENCRYPTION } MODType;
|
||||
typedef enum { CORE,PROTOCOL,THIRD,SUPPORTED,QATESTED,ENCRYPTION,DATABASE } MODType;
|
||||
typedef enum { MOD_OP_LOAD, MOD_OP_UNLOAD } ModuleOperation;
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -561,11 +561,15 @@ class CoreExport Module
|
||||
*/
|
||||
virtual void OnPostLoadDatabases() { }
|
||||
|
||||
/** Called when anope saves databases.
|
||||
* NOTE: This event is deprecated pending new database handling.
|
||||
* XXX.
|
||||
/** Called when the databases are saved
|
||||
* @return EVENT_CONTINUE to let other modules continue saving, EVENT_STOP to stop
|
||||
*/
|
||||
virtual void OnSaveDatabase() MARK_DEPRECATED { }
|
||||
virtual EventReturn OnSaveDatabase() { return EVENT_CONTINUE; }
|
||||
|
||||
/** Called when the databases are loaded
|
||||
* @return EVENT_CONTINUE to let other modules continue saving, EVENT_STOP to stop
|
||||
*/
|
||||
virtual EventReturn OnLoadDatabase() { return EVENT_CONTINUE; }
|
||||
|
||||
/** Called when anope backs up databases.
|
||||
* NOTE: This event is deprecated pending new database handling.
|
||||
@@ -684,6 +688,73 @@ class CoreExport Module
|
||||
*/
|
||||
virtual void OnDatabaseExpire() MARK_DEPRECATED { }
|
||||
|
||||
/** Called when the flatfile dbs are being written
|
||||
* @param Write A callback to the function used to insert a line into the database
|
||||
*/
|
||||
virtual void OnDatabaseWrite(void (*Write)(const std::string &)) { }
|
||||
|
||||
/** Called when a line is read from the database
|
||||
* @param params The params from the database
|
||||
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to stop processing
|
||||
*/
|
||||
virtual EventReturn OnDatabaseRead(const std::vector<std::string> ¶ms) { return EVENT_CONTINUE; }
|
||||
|
||||
/** Called when nickcore metadata is read from the database
|
||||
* @param nc The nickcore
|
||||
* @param key The metadata key
|
||||
* @param params The params from the database
|
||||
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to stop processing
|
||||
*/
|
||||
virtual EventReturn OnDatabaseReadMetadata(NickCore *nc, const std::string &key, const std::vector<std::string> ¶ms) { return EVENT_CONTINUE; }
|
||||
|
||||
/** Called when nickcore metadata is read from the database
|
||||
* @param na The nickalias
|
||||
* @param key The metadata key
|
||||
* @param params The params from the database
|
||||
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to stop processing
|
||||
*/
|
||||
virtual EventReturn OnDatabaseReadMetadata(NickAlias *na, const std::string &key, const std::vector<std::string> ¶ms) { return EVENT_CONTINUE; }
|
||||
|
||||
/** Called when botinfo metadata is read from the database
|
||||
* @param bi The botinfo
|
||||
* @param key The metadata key
|
||||
* @param params The params from the database
|
||||
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to stop processing
|
||||
*/
|
||||
virtual EventReturn OnDatabaseReadMetadata(BotInfo *bi, const std::string &key, const std::vector<std::string> ¶ms) { return EVENT_CONTINUE; }
|
||||
|
||||
/** Called when chaninfo metadata is read from the database
|
||||
* @param ci The chaninfo
|
||||
* @param key The metadata key
|
||||
* @param params The params from the database
|
||||
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to stop processing
|
||||
*/
|
||||
virtual EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const std::string &key, const std::vector<std::string> ¶ms) { return EVENT_CONTINUE; }
|
||||
|
||||
/** Called when we are writing metadata for a nickcore
|
||||
* @param WriteMetata A callback function used to insert the metadata
|
||||
* @param nc The nickcore
|
||||
*/
|
||||
virtual void OnDatabaseWriteMetadata(void (*WriteMetadata)(const std::string &, const std::string &), NickCore *nc) { }
|
||||
|
||||
/** Called when we are wrting metadata for a nickalias
|
||||
* @param WriteMetata A callback function used to insert the metadata
|
||||
* @param na The nick alias
|
||||
*/
|
||||
virtual void OnDatabaseWriteMetadata(void (*WriteMetadata)(const std::string &, const std::string &), NickAlias *na) { }
|
||||
|
||||
/** Called when we are writing metadata for a botinfo
|
||||
* @param WriteMetata A callback function used to insert the metadata
|
||||
* @param bi The botinfo
|
||||
*/
|
||||
virtual void OnDatabaseWriteMetadata(void (*WriteMetadata)(const std::string &, const std::string &), BotInfo *bi) { }
|
||||
|
||||
/** Called when are are writing metadata for a channelinfo
|
||||
* @param WriteMetata A callback function used to insert the metadata
|
||||
* @param bi The channelinfo
|
||||
*/
|
||||
virtual void OnDatabaseWriteMetadata(void (*WriteMetadata)(const std::string &, const std::string &), ChannelInfo *ci) { }
|
||||
|
||||
/** Called before services restart
|
||||
*/
|
||||
virtual void OnPreRestart() { }
|
||||
@@ -983,6 +1054,18 @@ class CoreExport Module
|
||||
*/
|
||||
virtual EventReturn OnUnMLock(ChannelModeName Name) { return EVENT_CONTINUE; }
|
||||
|
||||
/** Called after a module is loaded
|
||||
* @param u The user loading the module, can be NULL
|
||||
* @param m The module
|
||||
*/
|
||||
virtual void OnModuleLoad(User *u, Module *m) { }
|
||||
|
||||
/** Called before a module is unloaded
|
||||
* @param u The user, can be NULL
|
||||
* @param m The module
|
||||
*/
|
||||
virtual void OnModuleUnload(User *u, Module *m) { }
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1019,9 +1102,17 @@ enum Implementation
|
||||
/* OperServ */
|
||||
I_OnOperServHelp, I_OnDefconLevel,
|
||||
|
||||
/* Database */
|
||||
I_OnPostLoadDatabases, I_OnSaveDatabase, I_OnLoadDatabase, I_OnBackupDatabase,
|
||||
I_OnDatabaseExpire,
|
||||
I_OnDatabaseWrite, I_OnDatabaseRead, I_OnDatabaseReadMetadata, I_OnDatabaseWriteMetadata,
|
||||
|
||||
/* Modules */
|
||||
I_OnModuleLoad, I_OnModuleUnload,
|
||||
|
||||
/* Other */
|
||||
I_OnReload, I_OnPreServerConnect, I_OnNewServer, I_OnServerConnect, I_OnPreCommandRun, I_OnPreCommand, I_OnPostCommand, I_OnPostLoadDatabases, I_OnSaveDatabase, I_OnBackupDatabase,
|
||||
I_OnPreDatabaseExpire, I_OnDatabaseExpire, I_OnPreRestart, I_OnRestart, I_OnPreShutdown, I_OnShutdown, I_OnSignal,
|
||||
I_OnReload, I_OnPreServerConnect, I_OnNewServer, I_OnServerConnect, I_OnPreCommandRun, I_OnPreCommand, I_OnPostCommand,
|
||||
I_OnPreDatabaseExpire, I_OnPreRestart, I_OnRestart, I_OnPreShutdown, I_OnShutdown, I_OnSignal,
|
||||
I_OnServerQuit, I_OnTopicUpdated,
|
||||
I_OnEncrypt, I_OnEncryptInPlace, I_OnEncryptCheckLen, I_OnDecrypt, I_OnCheckPassword,
|
||||
I_OnChannelModeSet, I_OnChannelModeUnset, I_OnUserModeSet, I_OnUserModeUnset, I_OnChannelModeAdd, I_OnUserModeAdd,
|
||||
|
||||
@@ -15,5 +15,4 @@
|
||||
#include "commands.h"
|
||||
#include "language.h"
|
||||
#include "timers.h"
|
||||
#include "datafiles.h"
|
||||
#include "slist.h"
|
||||
|
||||
Reference in New Issue
Block a user