summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-10 20:27:51 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-10 20:27:51 +0000
commit23a4885701cba4a87a5ae027257fb4207c917572 (patch)
treecdd4aa7e4260135e444b28182448a14adb4e9a57
parent51924df0a878f66f83ea5639dcb7a761cfa65772 (diff)
Move tons more stuff into class InspIRCd*, make signal handler functions static members
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4855 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/helperfuncs.h5
-rw-r--r--include/inspircd.h14
-rw-r--r--include/users.h10
-rw-r--r--src/cmd_die.cpp2
-rw-r--r--src/cmd_join.cpp4
-rw-r--r--src/cmd_motd.cpp2
-rw-r--r--src/cmd_rules.cpp2
-rw-r--r--src/configreader.cpp6
-rw-r--r--src/helperfuncs.cpp91
-rw-r--r--src/inspircd.cpp22
-rw-r--r--src/modules.cpp2
-rw-r--r--src/modules/m_cban.cpp2
-rw-r--r--src/modules/m_redirect.cpp2
-rw-r--r--src/modules/m_sajoin.cpp2
-rw-r--r--src/socketengine_epoll.cpp2
-rw-r--r--src/socketengine_kqueue.cpp2
-rw-r--r--src/users.cpp104
17 files changed, 136 insertions, 138 deletions
diff --git a/include/helperfuncs.h b/include/helperfuncs.h
index 40df4c93c..bae7f8326 100644
--- a/include/helperfuncs.h
+++ b/include/helperfuncs.h
@@ -48,9 +48,4 @@ enum DebugLevel
#define STRINGIFY(x) STRINGIFY2(x)
#define log(l, x, args...) InspIRCd::Log(l, __FILE__ ":" STRINGIFY(__LINE__) ": " x, ##args)
-void Error(int status);
-void ShowMOTD(userrec *user);
-void ShowRULES(userrec *user);
-bool IsValidChannelName(const char *);
-
#endif
diff --git a/include/inspircd.h b/include/inspircd.h
index 59dc7eab0..63e8c8ce5 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -135,6 +135,11 @@ class InspIRCd : public classbase
chanrec* FindChan(const std::string &chan);
chanrec* FindChan(const char* chan);
+ void LoadAllModules();
+ void CheckDie();
+ void CheckRoot();
+ void OpenLog(char** argv, int argc);
+
bool UserToPseudo(userrec* user, const std::string &message);
bool PseudoToUser(userrec* alive, userrec* zombie, const std::string &message);
@@ -142,6 +147,12 @@ class InspIRCd : public classbase
void ServerPrivmsgAll(char* text, ...);
void WriteMode(const char* modes, int flags, const char* text, ...);
+ bool IsChannel(const char *chname);
+
+ static void Error(int status);
+ static void Rehash(int status);
+ static void Exit(int status);
+
int usercnt();
int registered_usercount();
int usercount_invisible();
@@ -227,7 +238,4 @@ class InspIRCd : public classbase
int Run();
};
-/* Miscellaneous stuff here, moved from inspircd_io.h */
-void Exit(int status);
-
#endif
diff --git a/include/users.h b/include/users.h
index 165b74aa4..cd12ceec6 100644
--- a/include/users.h
+++ b/include/users.h
@@ -251,9 +251,9 @@ class userrec : public connection
*/
char oper[NICKMAX];
- /** True when DNS lookups are completed.
- */
- bool dns_done;
+ /** True when DNS lookups are completed.
+ */
+ bool dns_done;
/** Number of seconds between PINGs for this user (set from &lt;connect:allow&gt; tag
*/
@@ -654,6 +654,10 @@ class userrec : public connection
ConnectClass& GetClass();
+ void ShowMOTD();
+
+ void ShowRULES();
+
/** Default destructor
*/
virtual ~userrec();
diff --git a/src/cmd_die.cpp b/src/cmd_die.cpp
index 366173758..b0a826b6d 100644
--- a/src/cmd_die.cpp
+++ b/src/cmd_die.cpp
@@ -48,7 +48,7 @@ void cmd_die::Handle (const char** parameters, int pcnt, userrec *user)
}
sleep(ServerInstance->Config->DieDelay);
- Exit(ERROR);
+ InspIRCd::Exit(ERROR);
}
else
{
diff --git a/src/cmd_join.cpp b/src/cmd_join.cpp
index 99a8b36e0..d62b0a911 100644
--- a/src/cmd_join.cpp
+++ b/src/cmd_join.cpp
@@ -29,7 +29,7 @@ void cmd_join::Handle (const char** parameters, int pcnt, userrec *user)
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0, 1))
return;
- if (IsValidChannelName(parameters[0]))
+ if (ServerInstance->IsChannel(parameters[0]))
{
chanrec::JoinUser(ServerInstance, user, parameters[0], false, parameters[1]);
return;
@@ -40,7 +40,7 @@ void cmd_join::Handle (const char** parameters, int pcnt, userrec *user)
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
return;
- if (IsValidChannelName(parameters[0]))
+ if (ServerInstance->IsChannel(parameters[0]))
{
chanrec::JoinUser(ServerInstance, user, parameters[0], false);
return;
diff --git a/src/cmd_motd.cpp b/src/cmd_motd.cpp
index a8cee2727..ab89bfd19 100644
--- a/src/cmd_motd.cpp
+++ b/src/cmd_motd.cpp
@@ -21,5 +21,5 @@
void cmd_motd::Handle (const char** parameters, int pcnt, userrec *user)
{
- ShowMOTD(user);
+ user->ShowMOTD();
}
diff --git a/src/cmd_rules.cpp b/src/cmd_rules.cpp
index 85e2eadf1..4ba1a0ded 100644
--- a/src/cmd_rules.cpp
+++ b/src/cmd_rules.cpp
@@ -21,5 +21,5 @@
void cmd_rules::Handle (const char** parameters, int pcnt, userrec *user)
{
- ShowRULES(user);
+ user->ShowRULES();
}
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 85745c63e..f60885c2e 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -103,7 +103,7 @@ bool ServerConfig::CheckOnce(char* tag, bool bail, userrec* user)
if (bail)
{
printf("There were errors in your configuration:\nYou have more than one <%s> tag, this is not permitted.\n",tag);
- Exit(0);
+ InspIRCd::Exit(ERROR);
}
else
{
@@ -125,7 +125,7 @@ bool ServerConfig::CheckOnce(char* tag, bool bail, userrec* user)
if (bail)
{
printf("There were errors in your configuration:\nYou have not defined a <%s> tag, this is required.\n",tag);
- Exit(0);
+ InspIRCd::Exit(ERROR);
}
else
{
@@ -668,7 +668,7 @@ void ServerConfig::Read(bool bail, userrec* user)
{
/* Unneeded because of the log() aboive? */
printf("There were errors in your configuration:\n%s",errstr.str().c_str());
- Exit(0);
+ InspIRCd::Exit(ERROR);
}
else
{
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 2c045c3ce..a6c4f1f5e 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -45,7 +45,7 @@
extern int MODCOUNT;
extern ModuleList modules;
-extern InspIRCd* ServerInstance;
+
extern time_t TIME;
extern char lowermap[255];
extern std::vector<userrec*> all_opers;
@@ -73,6 +73,8 @@ void InspIRCd::Log(int level, const char* text, ...)
void InspIRCd::Log(int level, const std::string &text)
{
+ extern InspIRCd* ServerInstance;
+
if (!ServerInstance || !ServerInstance->Config)
return;
@@ -105,7 +107,7 @@ std::string InspIRCd::GetServerDescription(const char* servername)
{
std::string description = "";
- FOREACH_MOD(I_OnGetServerDescription,OnGetServerDescription(servername,description));
+ FOREACH_MOD_I(this,I_OnGetServerDescription,OnGetServerDescription(servername,description));
if (description != "")
{
@@ -162,7 +164,7 @@ void InspIRCd::ServerNoticeAll(char* text, ...)
vsnprintf(textbuffer, MAXBUF, text, argsPtr);
va_end(argsPtr);
- snprintf(formatbuffer,MAXBUF,"NOTICE $%s :%s",ServerInstance->Config->ServerName,textbuffer);
+ snprintf(formatbuffer,MAXBUF,"NOTICE $%s :%s",Config->ServerName,textbuffer);
for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
{
@@ -183,7 +185,7 @@ void InspIRCd::ServerPrivmsgAll(char* text, ...)
vsnprintf(textbuffer, MAXBUF, text, argsPtr);
va_end(argsPtr);
- snprintf(formatbuffer,MAXBUF,"PRIVMSG $%s :%s",ServerInstance->Config->ServerName,textbuffer);
+ snprintf(formatbuffer,MAXBUF,"PRIVMSG $%s :%s",Config->ServerName,textbuffer);
for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
{
@@ -327,7 +329,7 @@ void InspIRCd::SendError(const char *s)
}
}
-void Error(int status)
+void InspIRCd::Error(int status)
{
void *array[300];
size_t size;
@@ -349,11 +351,9 @@ void Error(int status)
log(DEFAULT,"[%d] %s", i, strings[i]);
}
free(strings);
- ServerInstance->WriteOpers("*** SIGSEGV: Please see the ircd.log for backtrace and report the error to http://www.inspircd.org/bugtrack/");
#else
log(DEFAULT,"You do not have execinfo.h so i could not backtrace -- on FreeBSD, please install the libexecinfo port.");
#endif
- ServerInstance->SendError("Somebody screwed up... Whoops. IRC Server terminating.");
signal(SIGSEGV, SIG_DFL);
if (raise(SIGSEGV) == -1)
{
@@ -438,37 +438,7 @@ long InspIRCd::local_count()
return c;
}
-void ShowMOTD(userrec *user)
-{
- if (!ServerInstance->Config->MOTD.size())
- {
- user->WriteServ("422 %s :Message of the day file is missing.",user->nick);
- return;
- }
- user->WriteServ("375 %s :%s message of the day", user->nick, ServerInstance->Config->ServerName);
-
- for (unsigned int i = 0; i < ServerInstance->Config->MOTD.size(); i++)
- user->WriteServ("372 %s :- %s",user->nick,ServerInstance->Config->MOTD[i].c_str());
-
- user->WriteServ("376 %s :End of message of the day.", user->nick);
-}
-
-void ShowRULES(userrec *user)
-{
- if (!ServerInstance->Config->RULES.size())
- {
- user->WriteServ("NOTICE %s :Rules file is missing.",user->nick);
- return;
- }
- user->WriteServ("NOTICE %s :%s rules",user->nick,ServerInstance->Config->ServerName);
-
- for (unsigned int i = 0; i < ServerInstance->Config->RULES.size(); i++)
- user->WriteServ("NOTICE %s :%s",user->nick,ServerInstance->Config->RULES[i].c_str());
-
- user->WriteServ("NOTICE %s :End of %s rules.",user->nick,ServerInstance->Config->ServerName);
-}
-
-bool IsValidChannelName(const char *chname)
+bool InspIRCd::IsChannel(const char *chname)
{
char *c;
@@ -501,38 +471,37 @@ bool IsValidChannelName(const char *chname)
return true;
}
-void OpenLog(char** argv, int argc)
+void InspIRCd::OpenLog(char** argv, int argc)
{
if (!*LOG_FILE)
{
- if (ServerInstance->Config->logpath == "")
+ if (Config->logpath == "")
{
- ServerInstance->Config->logpath = ServerConfig::GetFullProgDir(argv,argc) + "/ircd.log";
+ Config->logpath = ServerConfig::GetFullProgDir(argv,argc) + "/ircd.log";
}
}
else
{
- ServerInstance->Config->log_file = fopen(LOG_FILE,"a+");
+ Config->log_file = fopen(LOG_FILE,"a+");
- if (!ServerInstance->Config->log_file)
+ if (!Config->log_file)
{
- printf("ERROR: Could not write to logfile %s, bailing!\n\n",ServerInstance->Config->logpath.c_str());
+ printf("ERROR: Could not write to logfile %s, bailing!\n\n",Config->logpath.c_str());
Exit(ERROR);
}
-
return;
}
- ServerInstance->Config->log_file = fopen(ServerInstance->Config->logpath.c_str(),"a+");
+ Config->log_file = fopen(Config->logpath.c_str(),"a+");
- if (!ServerInstance->Config->log_file)
+ if (!Config->log_file)
{
- printf("ERROR: Could not write to logfile %s, bailing!\n\n",ServerInstance->Config->logpath.c_str());
+ printf("ERROR: Could not write to logfile %s, bailing!\n\n",Config->logpath.c_str());
Exit(ERROR);
}
}
-void CheckRoot()
+void InspIRCd::CheckRoot()
{
if (geteuid() == 0)
{
@@ -542,35 +511,35 @@ void CheckRoot()
}
}
-void CheckDie()
+void InspIRCd::CheckDie()
{
- if (*ServerInstance->Config->DieValue)
+ if (*Config->DieValue)
{
- printf("WARNING: %s\n\n",ServerInstance->Config->DieValue);
- log(DEFAULT,"Uh-Oh, somebody didn't read their config file: '%s'",ServerInstance->Config->DieValue);
+ printf("WARNING: %s\n\n",Config->DieValue);
+ log(DEFAULT,"Uh-Oh, somebody didn't read their config file: '%s'",Config->DieValue);
Exit(ERROR);
}
}
/* We must load the modules AFTER initializing the socket engine, now */
-void LoadAllModules(InspIRCd* ServerInstance)
+void InspIRCd::LoadAllModules()
{
char configToken[MAXBUF];
- ServerInstance->Config->module_names.clear();
+ Config->module_names.clear();
MODCOUNT = -1;
- for (int count = 0; count < ServerInstance->Config->ConfValueEnum(ServerInstance->Config->config_data, "module"); count++)
+ for (int count = 0; count < Config->ConfValueEnum(Config->config_data, "module"); count++)
{
- ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "module","name",count,configToken,MAXBUF);
+ Config->ConfValue(Config->config_data, "module","name",count,configToken,MAXBUF);
printf("[\033[1;32m*\033[0m] Loading module:\t\033[1;32m%s\033[0m\n",configToken);
- if (!ServerInstance->LoadModule(configToken))
+ if (!this->LoadModule(configToken))
{
log(DEFAULT,"Exiting due to a module loader error.");
- printf("\nThere was an error loading a module: %s\n\n",ServerInstance->ModuleError());
- Exit(0);
+ printf("\nThere was an error loading a module: %s\n\n",this->ModuleError());
+ Exit(ERROR);
}
}
-
log(DEFAULT,"Total loaded modules: %lu",(unsigned long)MODCOUNT+1);
}
+
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 758dd4757..dfebb00d7 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -114,7 +114,7 @@ bool InspIRCd::FindServerName(const std::string &servername)
return (find(servernames.begin(), servernames.end(), servername) != servernames.end());
}
-void Exit(int status)
+void InspIRCd::Exit(int status)
{
if (ServerInstance->Config->log_file)
fclose(ServerInstance->Config->log_file);
@@ -131,19 +131,11 @@ void InspIRCd::Start()
printf("Name concept:\t\t\033[1;32mLord_Zathras\033[0m\n\n");
}
-void Killed(int status)
-{
- if (ServerInstance->Config->log_file)
- fclose(ServerInstance->Config->log_file);
- ServerInstance->SendError("Server terminated.");
- exit(status);
-}
-
-void Rehash(int status)
+void InspIRCd::Rehash(int status)
{
ServerInstance->WriteOpers("Rehashing config file %s due to SIGHUP",ServerConfig::CleanFilename(CONFIG_FILE));
fclose(ServerInstance->Config->log_file);
- OpenLog(NULL,0);
+ ServerInstance->OpenLog(NULL,0);
ServerInstance->Config->Read(false,NULL);
FOREACH_MOD(I_OnRehash,OnRehash(""));
}
@@ -151,11 +143,11 @@ void Rehash(int status)
void InspIRCd::SetSignals(bool SEGVHandler)
{
signal (SIGALRM, SIG_IGN);
- signal (SIGHUP, Rehash);
+ signal (SIGHUP, InspIRCd::Rehash);
signal (SIGPIPE, SIG_IGN);
- signal (SIGTERM, Exit);
+ signal (SIGTERM, InspIRCd::Exit);
if (SEGVHandler)
- signal (SIGSEGV, Error);
+ signal (SIGSEGV, InspIRCd::Error);
}
bool InspIRCd::DaemonSeed()
@@ -939,7 +931,7 @@ int InspIRCd::Run()
log(DEBUG,"RES: %08x",this->Res);
- LoadAllModules(this);
+ this->LoadAllModules();
/* Just in case no modules were loaded - fix for bug #101 */
this->BuildISupport();
diff --git a/src/modules.cpp b/src/modules.cpp
index 918e2b6f6..f3219df76 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -685,7 +685,7 @@ void ConfigReader::DumpErrors(bool bail, userrec* user)
if (bail)
{
printf("There were errors in your configuration:\n%s", this->errorlog->str().c_str());
- Exit(0);
+ InspIRCd::Exit(ERROR);
}
else
{
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index 480d0b9e5..539932be4 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -97,7 +97,7 @@ class cmd_cban : public command_t
else if (pcnt >= 2)
{
/* full form to add a CBAN */
- if (IsValidChannelName(parameters[0]))
+ if (ServerInstance->IsChannel(parameters[0]))
{
// parameters[0] = #channel
// parameters[1] = 1h3m2s
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index 643d972d1..8a917e4ba 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -53,7 +53,7 @@ class Redirect : public ModeHandler
{
chanrec* c = NULL;
- if (!IsValidChannelName(parameter.c_str()))
+ if (!ServerInstance->IsChannel(parameter.c_str()))
{
source->WriteServ("403 %s %s :Invalid channel name",source->nick, parameter.c_str());
parameter = "";
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp
index 65babdfa4..8851a54ef 100644
--- a/src/modules/m_sajoin.cpp
+++ b/src/modules/m_sajoin.cpp
@@ -48,7 +48,7 @@ class cmd_sajoin : public command_t
user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
return;
}
- if (!IsValidChannelName(parameters[1]))
+ if (!ServerInstance->IsChannel(parameters[1]))
{
/* we didn't need to check this for each character ;) */
user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
diff --git a/src/socketengine_epoll.cpp b/src/socketengine_epoll.cpp
index 4afee1374..05513290b 100644
--- a/src/socketengine_epoll.cpp
+++ b/src/socketengine_epoll.cpp
@@ -33,7 +33,7 @@ EPollEngine::EPollEngine()
log(SPARSE,"ERROR: this is a fatal error, exiting now.");
printf("ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.");
printf("ERROR: this is a fatal error, exiting now.");
- Exit(0);
+ InspIRCd::Exit(ERROR);
}
CurrentSetSize = 0;
}
diff --git a/src/socketengine_kqueue.cpp b/src/socketengine_kqueue.cpp
index 656c68224..3287ea780 100644
--- a/src/socketengine_kqueue.cpp
+++ b/src/socketengine_kqueue.cpp
@@ -34,7 +34,7 @@ KQueueEngine::KQueueEngine()
log(SPARSE,"ERROR: this is a fatal error, exiting now.");
printf("ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.");
printf("ERROR: this is a fatal error, exiting now.");
- Exit(0);
+ InspIRCd::Exit(ERROR);
}
CurrentSetSize = 0;
}
diff --git a/src/users.cpp b/src/users.cpp
index 8273acc88..7c1409a33 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1051,7 +1051,7 @@ void userrec::FullConnect(CullList* Goners)
}
}
- ShowMOTD(this);
+ this->ShowMOTD();
/*
* fix 3 by brain, move registered = 7 below these so that spurious modes and host
@@ -1719,46 +1719,76 @@ void userrec::SplitChanList(userrec* dest, const std::string &cl)
*/
ConnectClass& userrec::GetClass()
{
- for (ClassVector::iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); i++)
- {
- if ((match(this->GetIPString(),i->host.c_str(),true)) || (match(this->host,i->host.c_str())))
- return *i;
- }
+ for (ClassVector::iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); i++)
+ {
+ if ((match(this->GetIPString(),i->host.c_str(),true)) || (match(this->host,i->host.c_str())))
+ return *i;
+ }
- return *(ServerInstance->Config->Classes.begin());
+ return *(ServerInstance->Config->Classes.begin());
}
void userrec::PurgeEmptyChannels()
{
- std::vector<chanrec*> to_delete;
-
- // firstly decrement the count on each channel
- for (std::vector<ucrec*>::iterator f = this->chans.begin(); f != this->chans.end(); f++)
- {
- ucrec* uc = *f;
- if (uc->channel)
- {
- if (uc->channel->DelUser(this) == 0)
- {
- /* No users left in here, mark it for deletion */
- to_delete.push_back(uc->channel);
- uc->channel = NULL;
- }
- }
- }
-
- for (std::vector<chanrec*>::iterator n = to_delete.begin(); n != to_delete.end(); n++)
- {
- chanrec* thischan = *n;
- chan_hash::iterator i2 = ServerInstance->chanlist.find(thischan->name);
- if (i2 != ServerInstance->chanlist.end())
- {
- FOREACH_MOD(I_OnChannelDelete,OnChannelDelete(i2->second));
- DELETE(i2->second);
- ServerInstance->chanlist.erase(i2);
- }
- }
-
- this->UnOper();
+ std::vector<chanrec*> to_delete;
+
+ // firstly decrement the count on each channel
+ for (std::vector<ucrec*>::iterator f = this->chans.begin(); f != this->chans.end(); f++)
+ {
+ ucrec* uc = *f;
+ if (uc->channel)
+ {
+ if (uc->channel->DelUser(this) == 0)
+ {
+ /* No users left in here, mark it for deletion */
+ to_delete.push_back(uc->channel);
+ uc->channel = NULL;
+ }
+ }
+ }
+
+ for (std::vector<chanrec*>::iterator n = to_delete.begin(); n != to_delete.end(); n++)
+ {
+ chanrec* thischan = *n;
+ chan_hash::iterator i2 = ServerInstance->chanlist.find(thischan->name);
+ if (i2 != ServerInstance->chanlist.end())
+ {
+ FOREACH_MOD(I_OnChannelDelete,OnChannelDelete(i2->second));
+ DELETE(i2->second);
+ ServerInstance->chanlist.erase(i2);
+ }
+ }
+
+ this->UnOper();
+}
+
+void userrec::ShowMOTD()
+{
+ if (!ServerInstance->Config->MOTD.size())
+ {
+ this->WriteServ("422 %s :Message of the day file is missing.",this->nick);
+ return;
+ }
+ this->WriteServ("375 %s :%s message of the day", this->nick, ServerInstance->Config->ServerName);
+
+ for (unsigned int i = 0; i < ServerInstance->Config->MOTD.size(); i++)
+ this->WriteServ("372 %s :- %s",this->nick,ServerInstance->Config->MOTD[i].c_str());
+
+ this->WriteServ("376 %s :End of message of the day.", this->nick);
+}
+
+void userrec::ShowRULES()
+{
+ if (!ServerInstance->Config->RULES.size())
+ {
+ this->WriteServ("NOTICE %s :Rules file is missing.",this->nick);
+ return;
+ }
+ this->WriteServ("NOTICE %s :%s rules",this->nick,ServerInstance->Config->ServerName);
+
+ for (unsigned int i = 0; i < ServerInstance->Config->RULES.size(); i++)
+ this->WriteServ("NOTICE %s :%s",this->nick,ServerInstance->Config->RULES[i].c_str());
+
+ this->WriteServ("NOTICE %s :End of %s rules.",this->nick,ServerInstance->Config->ServerName);
}