Anope IRC Services  Version 1.8
Macros | Functions | Variables
os_info.c File Reference
#include "module.h"
Include dependency graph for os_info.c:

Go to the source code of this file.

Macros

#define AUTHOR   "Rob"
 
#define VERSION   VERSION_STRING
 
#define DEFAULT_DB_NAME   "os_info.db"
 
#define LANG_NUM_STRINGS   10
 
#define OINFO_SYNTAX   0
 
#define OINFO_ADD_SUCCESS   1
 
#define OINFO_DEL_SUCCESS   2
 
#define OCINFO_SYNTAX   3
 
#define OCINFO_ADD_SUCCESS   4
 
#define OCINFO_DEL_SUCCESS   5
 
#define OINFO_HELP   6
 
#define OCINFO_HELP   7
 
#define OINFO_HELP_CMD   8
 
#define OCINFO_HELP_CMD   9
 

Functions

static int myAddNickInfo (User *u)
 
static int myAddChanInfo (User *u)
 
static int myNickInfo (User *u)
 
static int myChanInfo (User *u)
 
static int mNickHelp (User *u)
 
static int mChanHelp (User *u)
 
static void mMainChanHelp (User *u)
 
static void mMainNickHelp (User *u)
 
static void m_AddLanguages (void)
 
static int mLoadData (void)
 
static int mSaveData (int argc, char **argv)
 
static int mBackupData (int argc, char **argv)
 
static int mLoadConfig ()
 
static int mEventReload (int argc, char **argv)
 
int AnopeInit (int argc, char **argv)
 
void AnopeFini (void)
 

Variables

char * OSInfoDBName = NULL
 

Macro Definition Documentation

#define AUTHOR   "Rob"

Definition at line 21 of file os_info.c.

Referenced by AnopeInit().

#define DEFAULT_DB_NAME   "os_info.db"

Definition at line 25 of file os_info.c.

Referenced by mLoadConfig().

#define LANG_NUM_STRINGS   10

Definition at line 28 of file os_info.c.

Referenced by m_AddLanguages().

#define OCINFO_ADD_SUCCESS   4

Definition at line 34 of file os_info.c.

Referenced by myAddChanInfo().

#define OCINFO_DEL_SUCCESS   5

Definition at line 35 of file os_info.c.

Referenced by myAddChanInfo().

#define OCINFO_HELP   7

Definition at line 37 of file os_info.c.

Referenced by mChanHelp().

#define OCINFO_HELP_CMD   9

Definition at line 39 of file os_info.c.

Referenced by mMainChanHelp().

#define OCINFO_SYNTAX   3

Definition at line 33 of file os_info.c.

Referenced by myAddChanInfo().

#define OINFO_ADD_SUCCESS   1

Definition at line 31 of file os_info.c.

Referenced by myAddNickInfo().

#define OINFO_DEL_SUCCESS   2

Definition at line 32 of file os_info.c.

Referenced by myAddNickInfo().

#define OINFO_HELP   6

Definition at line 36 of file os_info.c.

Referenced by mNickHelp().

#define OINFO_HELP_CMD   8

Definition at line 38 of file os_info.c.

Referenced by mMainNickHelp().

#define OINFO_SYNTAX   0

Definition at line 30 of file os_info.c.

Referenced by myAddNickInfo().

#define VERSION   VERSION_STRING

Definition at line 22 of file os_info.c.

Referenced by AnopeInit().

Function Documentation

void AnopeFini ( void  )

Unload the module

Definition at line 119 of file os_info.c.

References EVENT_START, mSaveData(), OSInfoDBName, and sstrdup().

int AnopeInit ( int  argc,
char **  argv 
)
static void m_AddLanguages ( void  )
static

manages the multilanguage stuff

Definition at line 528 of file os_info.c.

References LANG_DE, LANG_EN_US, LANG_ES, LANG_FR, LANG_IT, LANG_NL, LANG_NUM_STRINGS, LANG_PT, LANG_RU, and moduleInsertLanguage().

Referenced by AnopeInit().

static int mBackupData ( int  argc,
char **  argv 
)
static

Backup our databases using the commands provided by Anope

Returns
MOD_CONT

Definition at line 463 of file os_info.c.

References EVENT_START, MOD_CONT, ModuleDatabaseBackup(), OSInfoDBName, and stricmp().

Referenced by AnopeInit().

static int mChanHelp ( User u)
static

Definition at line 786 of file os_info.c.

References is_oper(), MOD_CONT, moduleNoticeLang(), notice_lang(), OCINFO_HELP, and s_ChanServ.

Referenced by AnopeInit().

static int mEventReload ( int  argc,
char **  argv 
)
static

Manage the RELOAD EVENT

Returns
MOD_CONT

Definition at line 505 of file os_info.c.

References alog(), EVENT_START, mLoadConfig(), MOD_CONT, and stricmp().

Referenced by AnopeInit().

static int mLoadConfig ( void  )
static

Load the configuration directives from Services configuration file.

Returns
0 for success

Definition at line 475 of file os_info.c.

References alog(), DEFAULT_DB_NAME, moduleGetConfigDirective(), OSInfoDBName, PARAM_RELOAD, PARAM_STRING, and sstrdup().

Referenced by AnopeInit(), and mEventReload().

static int mLoadData ( void  )
static

Load data from the db file, and populate our OperInfo lines

Returns
0 for success

Definition at line 353 of file os_info.c.

References alog(), cs_findchan(), findnick(), moduleAddData(), nickcore_::moduleData, chaninfo_::moduleData, myStrGetToken(), myStrGetTokenRemainder(), nickalias_::nc, OSInfoDBName, and stricmp().

Referenced by AnopeInit().

static void mMainChanHelp ( User u)
static

Definition at line 805 of file os_info.c.

References is_oper(), moduleNoticeLang(), OCINFO_HELP_CMD, and s_ChanServ.

Referenced by AnopeInit().

static void mMainNickHelp ( User u)
static

Definition at line 797 of file os_info.c.

References is_oper(), moduleNoticeLang(), OINFO_HELP_CMD, and s_NickServ.

Referenced by AnopeInit().

static int mNickHelp ( User u)
static

Definition at line 776 of file os_info.c.

References is_oper(), MOD_CONT, moduleNoticeLang(), notice_lang(), OINFO_HELP, and s_NickServ.

Referenced by AnopeInit().

static int mSaveData ( int  argc,
char **  argv 
)
static

Save all our data to our db file First walk through the nick CORE list, and any nick core which has oper info attached to it, write to the file. Next do the same again for ChannelInfos

Returns
0 for success

Definition at line 412 of file os_info.c.

References alog(), anope_cmd_global(), chanlists, nickcore_::display, EVENT_START, nickcore_::moduleData, chaninfo_::moduleData, moduleGetData(), chaninfo_::name, nclists, nickcore_::next, chaninfo_::next, OSInfoDBName, s_OperServ, and stricmp().

Referenced by AnopeFini(), and AnopeInit().

static int myAddChanInfo ( User u)
static

Provide the user interface to add/remove/update oper information about a channel. We are going to assume that anyone who gets this far is an oper; the createCommand should have handled this checking for us and its tedious / a waste to do it twice.

Parameters
uThe user who executed this command
Returns
MOD_CONT if we want to process other commands in this command stack, MOD_STOP if we dont

Definition at line 215 of file os_info.c.

References cs_findchan(), MOD_CONT, moduleAddData(), chaninfo_::moduleData, moduleDelData(), moduleGetLastBuffer(), moduleNoticeLang(), myStrGetToken(), myStrGetTokenRemainder(), notice_lang(), OCINFO_ADD_SUCCESS, OCINFO_DEL_SUCCESS, OCINFO_SYNTAX, and s_ChanServ.

Referenced by AnopeInit().

static int myAddNickInfo ( User u)
static

Provide the user interface to add/remove/update oper information about a nick. We are going to assume that anyone who gets this far is an oper; the createCommand should have handled this checking for us and its tedious / a waste to do it twice.

Parameters
uThe user who executed this command
Returns
MOD_CONT if we want to process other commands in this command stack, MOD_STOP if we dont

Definition at line 143 of file os_info.c.

References findnick(), MOD_CONT, moduleAddData(), nickcore_::moduleData, moduleDelData(), moduleGetLastBuffer(), moduleNoticeLang(), myStrGetToken(), myStrGetTokenRemainder(), nickalias_::nc, notice_lang(), OINFO_ADD_SUCCESS, OINFO_DEL_SUCCESS, OINFO_SYNTAX, and s_NickServ.

Referenced by AnopeInit().

static int myChanInfo ( User u)
static

Called after a user does a /msg chanserv info chan

Parameters
uThe user who requested info
Returns
MOD_CONT to continue processing commands or MOD_STOP to stop

Definition at line 319 of file os_info.c.

References cs_findchan(), is_oper(), MOD_CONT, chaninfo_::moduleData, moduleGetData(), moduleGetLastBuffer(), myStrGetToken(), notice_user(), and s_ChanServ.

Referenced by AnopeInit().

static int myNickInfo ( User u)
static

Called after a user does a /msg nickserv info [nick]

Parameters
uThe user who requested info
Returns
MOD_CONT to continue processing commands or MOD_STOP to stop

Definition at line 282 of file os_info.c.

References findnick(), is_oper(), MOD_CONT, nickcore_::moduleData, moduleGetData(), moduleGetLastBuffer(), myStrGetToken(), nickalias_::nc, notice_user(), and s_NickServ.

Referenced by AnopeInit().

Variable Documentation

char* OSInfoDBName = NULL

Definition at line 43 of file os_info.c.

Referenced by AnopeFini(), mBackupData(), mLoadConfig(), mLoadData(), and mSaveData().