summaryrefslogtreecommitdiff
path: root/src/messages.c
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-11-28 23:02:07 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-11-28 23:02:07 +0000
commita08b3ec5924c946308ac086cd3ee7d701610d3be (patch)
tree84da442a85ffeccd6425cc7c85db9eda6e881753 /src/messages.c
parentf6b823ade85160f94544d1ad1de4d8fbc42b2712 (diff)
Massive move of all of the Config variables out of global scope to the Config class
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2674 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/messages.c')
-rw-r--r--src/messages.c132
1 files changed, 66 insertions, 66 deletions
diff --git a/src/messages.c b/src/messages.c
index 67377a0da..2e00a03f0 100644
--- a/src/messages.c
+++ b/src/messages.c
@@ -44,7 +44,7 @@ int m_kill(const char *nick, const char *msg)
BotInfo *bi;
/* Recover if someone kills us. */
- if (s_BotServ && (bi = findbot(nick)))
+ if (Config.s_BotServ && (bi = findbot(nick)))
{
introduce_user(nick);
bi->RejoinAll();
@@ -70,7 +70,7 @@ int m_time(const char *source, int ac, const char **av)
time(&t);
tm = localtime(&t);
strftime(buf, sizeof(buf), "%a %b %d %H:%M:%S %Y %Z", tm);
- ircdproto->SendNumeric(ServerName, 391, source, "%s :%s", ServerName, buf);
+ ircdproto->SendNumeric(Config.ServerName, 391, source, "%s :%s", Config.ServerName, buf);
return MOD_CONT;
}
@@ -85,17 +85,17 @@ int m_motd(const char *source)
return MOD_CONT;
}
- f = fopen(MOTDFilename, "r");
+ f = fopen(Config.MOTDFilename, "r");
if (f) {
- ircdproto->SendNumeric(ServerName, 375, source, ":- %s Message of the Day", ServerName);
+ ircdproto->SendNumeric(Config.ServerName, 375, source, ":- %s Message of the Day", Config.ServerName);
while (fgets(buf, sizeof(buf), f)) {
buf[strlen(buf) - 1] = 0;
- ircdproto->SendNumeric(ServerName, 372, source, ":- %s", buf);
+ ircdproto->SendNumeric(Config.ServerName, 372, source, ":- %s", buf);
}
fclose(f);
- ircdproto->SendNumeric(ServerName, 376, source, ":End of /MOTD command.");
+ ircdproto->SendNumeric(Config.ServerName, 376, source, ":End of /MOTD command.");
} else {
- ircdproto->SendNumeric(ServerName, 422, source, ":- MOTD file not found! Please contact your IRC administrator.");
+ ircdproto->SendNumeric(Config.ServerName, 422, source, ":- MOTD file not found! Please contact your IRC administrator.");
}
return MOD_CONT;
}
@@ -128,7 +128,7 @@ int m_privmsg(const char *source, const char *receiver, const char *msg)
}
if (*receiver == '#') {
- if (s_BotServ && (ci = cs_findchan(receiver))) {
+ if (Config.s_BotServ && (ci = cs_findchan(receiver))) {
/* Some paranoia checks */
if (!ci->HasFlag(CI_FORBIDDEN) && ci->c && ci->bi) {
botchanmsgs(u, ci, const_cast<char *>(msg)); // XXX Unsafe cast, this needs reviewing -- CyberBotX
@@ -151,14 +151,14 @@ int m_privmsg(const char *source, const char *receiver, const char *msg)
s = const_cast<char *>(strchr(receiver, '@'));
if (s) {
*s++ = 0;
- if (stricmp(s, ServerName) != 0)
+ if (stricmp(s, Config.ServerName) != 0)
return MOD_CONT;
- } else if (UseStrictPrivMsg) {
+ } else if (Config.UseStrictPrivMsg) {
if (debug) {
alog("Ignored PRIVMSG without @ from %s", source);
}
notice_lang(receiver, u, INVALID_TARGET, receiver, receiver,
- ServerName, receiver);
+ Config.ServerName, receiver);
return MOD_CONT;
}
@@ -168,33 +168,33 @@ int m_privmsg(const char *source, const char *receiver, const char *msg)
if (bi)
{
- if (!stricmp(bi->nick, s_OperServ))
+ if (!stricmp(bi->nick, Config.s_OperServ))
{
- if (!is_oper(u) && OSOpersOnly)
+ if (!is_oper(u) && Config.OSOpersOnly)
{
- notice_lang(s_OperServ, u, ACCESS_DENIED);
- if (WallBadOS)
- ircdproto->SendGlobops(s_OperServ, "Denied access to %s from %s!%s@%s (non-oper)", s_OperServ, u->nick, u->GetIdent().c_str(), u->host);
+ notice_lang(Config.s_OperServ, u, ACCESS_DENIED);
+ if (Config.WallBadOS)
+ ircdproto->SendGlobops(Config.s_OperServ, "Denied access to %s from %s!%s@%s (non-oper)", Config.s_OperServ, u->nick, u->GetIdent().c_str(), u->host);
}
else
operserv(u, const_cast<char *>(msg)); // XXX Unsafe cast, this needs reviewing -- CyberBotX
}
- else if (!stricmp(bi->nick, s_NickServ))
+ else if (!stricmp(bi->nick, Config.s_NickServ))
nickserv(u, const_cast<char *>(msg)); // XXX Unsafe cast, this needs reviewing -- CyberBotX
- else if (!stricmp(bi->nick, s_ChanServ))
+ else if (!stricmp(bi->nick, Config.s_ChanServ))
{
- if (!is_oper(u) && CSOpersOnly)
- notice_lang(s_ChanServ, u, ACCESS_DENIED);
+ if (!is_oper(u) && Config.CSOpersOnly)
+ notice_lang(Config.s_ChanServ, u, ACCESS_DENIED);
else
chanserv(u, const_cast<char *>(msg)); // XXX Unsafe cast, this needs reviewing -- CyberBotX
}
- else if (!stricmp(bi->nick, s_MemoServ))
+ else if (!stricmp(bi->nick, Config.s_MemoServ))
memoserv(u, const_cast<char *>(msg)); // XXX Unsafe cast, this needs reviewing -- CyberBotX
- else if (s_HostServ && !stricmp(bi->nick, s_HostServ))
+ else if (Config.s_HostServ && !stricmp(bi->nick, Config.s_HostServ))
hostserv(u, const_cast<char *>(msg)); // XXX Unsafe cast, this needs reviewing -- CyberBotX
- else if (s_BotServ)
+ else if (Config.s_BotServ)
{
- if (!stricmp(bi->nick, s_BotServ))
+ if (!stricmp(bi->nick, Config.s_BotServ))
botserv(u, const_cast<char *>(msg)); // XXX Unsafe cast, this needs reviewing -- CyberBotX
else
botmsgs(u, bi, const_cast<char *>(msg)); // XXX Unsafe cast, this needs reviewing -- CyberBotX
@@ -227,46 +227,46 @@ int m_stats(const char *source, int ac, const char **av)
if (u && is_oper(u)) {
- ircdproto->SendNumeric(ServerName, 211, source, "Server SendBuf SentBytes SentMsgs RecvBuf RecvBytes RecvMsgs ConnTime");
- ircdproto->SendNumeric(ServerName, 211, source, "%s %d %d %d %d %d %d %ld", uplink_server->host, write_buffer_len(), total_written, -1, read_buffer_len(),
+ ircdproto->SendNumeric(Config.ServerName, 211, source, "Server SendBuf SentBytes SentMsgs RecvBuf RecvBytes RecvMsgs ConnTime");
+ ircdproto->SendNumeric(Config.ServerName, 211, source, "%s %d %d %d %d %d %d %ld", uplink_server->host, write_buffer_len(), total_written, -1, read_buffer_len(),
total_read, -1, time(NULL) - start_time);
}
- ircdproto->SendNumeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*');
+ ircdproto->SendNumeric(Config.ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*');
break;
case 'o':
case 'O':
/* Check whether the user is an operator */
u = finduser(source);
- if (u && !is_oper(u) && HideStatsO) {
- ircdproto->SendNumeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*');
+ if (u && !is_oper(u) && Config.HideStatsO) {
+ ircdproto->SendNumeric(Config.ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*');
} else {
std::list<std::pair<std::string, std::string> >::iterator it;
- for (it = svsopers_in_config.begin(); it != svsopers_in_config.end(); ++it)
+ for (it = Config.Opers.begin(); it != Config.Opers.end(); ++it)
{
std::string nick = it->first, type = it->second;
if ((nc = findcore(nick.c_str())))
- ircdproto->SendNumeric(ServerName, 243, source, "O * * %s %s 0", nick.c_str(), type.c_str());
+ ircdproto->SendNumeric(Config.ServerName, 243, source, "O * * %s %s 0", nick.c_str(), type.c_str());
}
- ircdproto->SendNumeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*');
+ ircdproto->SendNumeric(Config.ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*');
}
break;
case 'u':{
int uptime = time(NULL) - start_time;
- ircdproto->SendNumeric(ServerName, 242, source, ":Services up %d day%s, %02d:%02d:%02d", uptime / 86400, uptime / 86400 == 1 ? "" : "s",
+ ircdproto->SendNumeric(Config.ServerName, 242, source, ":Services up %d day%s, %02d:%02d:%02d", uptime / 86400, uptime / 86400 == 1 ? "" : "s",
(uptime / 3600) % 24, (uptime / 60) % 60, uptime % 60);
- ircdproto->SendNumeric(ServerName, 250, source, ":Current users: %d (%d ops); maximum %d", usercnt, opcnt, maxusercnt);
- ircdproto->SendNumeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*');
+ ircdproto->SendNumeric(Config.ServerName, 250, source, ":Current users: %d (%d ops); maximum %d", usercnt, opcnt, maxusercnt);
+ ircdproto->SendNumeric(Config.ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*');
break;
} /* case 'u' */
default:
- ircdproto->SendNumeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*');
+ ircdproto->SendNumeric(Config.ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*');
break;
}
return MOD_CONT;
@@ -276,8 +276,8 @@ int m_stats(const char *source, int ac, const char **av)
int m_version(const char *source, int ac, const char **av)
{
- if (source) ircdproto->SendNumeric(ServerName, 351, source, "Anope-%s %s :%s - %s (%s) -- %s", version_number, ServerName, ircd->name, version_flags,
- EncModuleList.begin()->c_str(), version_build);
+ if (source) ircdproto->SendNumeric(Config.ServerName, 351, source, "Anope-%s %s :%s - %s (%s) -- %s", version_number, Config.ServerName, ircd->name, version_flags,
+ Config.EncModuleList.begin()->c_str(), version_build);
return MOD_CONT;
}
@@ -291,45 +291,45 @@ int m_whois(const char *source, const char *who)
const char *clientdesc;
if (source && who) {
- if (stricmp(who, s_NickServ) == 0)
- clientdesc = desc_NickServ;
- else if (stricmp(who, s_ChanServ) == 0)
- clientdesc = desc_ChanServ;
- else if (stricmp(who, s_MemoServ) == 0)
- clientdesc = desc_MemoServ;
- else if (s_BotServ && stricmp(who, s_BotServ) == 0)
- clientdesc = desc_BotServ;
- else if (s_HostServ && stricmp(who, s_HostServ) == 0)
- clientdesc = desc_HostServ;
- else if (stricmp(who, s_OperServ) == 0)
- clientdesc = desc_OperServ;
- else if (stricmp(who, s_GlobalNoticer) == 0)
- clientdesc = desc_GlobalNoticer;
- else if (s_BotServ && (bi = findbot(who))) {
+ if (stricmp(who, Config.s_NickServ) == 0)
+ clientdesc = Config.desc_NickServ;
+ else if (stricmp(who, Config.s_ChanServ) == 0)
+ clientdesc = Config.desc_ChanServ;
+ else if (stricmp(who, Config.s_MemoServ) == 0)
+ clientdesc = Config.desc_MemoServ;
+ else if (Config.s_BotServ && stricmp(who, Config.s_BotServ) == 0)
+ clientdesc = Config.desc_BotServ;
+ else if (Config.s_HostServ && stricmp(who, Config.s_HostServ) == 0)
+ clientdesc = Config.desc_HostServ;
+ else if (stricmp(who, Config.s_OperServ) == 0)
+ clientdesc = Config.desc_OperServ;
+ else if (stricmp(who, Config.s_GlobalNoticer) == 0)
+ clientdesc = Config.desc_GlobalNoticer;
+ else if (Config.s_BotServ && (bi = findbot(who))) {
/* Bots are handled separately */
- ircdproto->SendNumeric(ServerName, 311, source, "%s %s %s * :%s", bi->nick, bi->user, bi->host, bi->real);
- ircdproto->SendNumeric(ServerName, 307, source, "%s :is a registered nick", bi->nick);
- ircdproto->SendNumeric(ServerName, 312, source, "%s %s :%s", bi->nick, ServerName, ServerDesc);
- ircdproto->SendNumeric(ServerName, 317, source, "%s %ld %ld :seconds idle, signon time", bi->nick, time(NULL) - bi->lastmsg, start_time);
- ircdproto->SendNumeric(ServerName, 318, source, "%s :End of /WHOIS list.", who);
+ ircdproto->SendNumeric(Config.ServerName, 311, source, "%s %s %s * :%s", bi->nick, bi->user, bi->host, bi->real);
+ ircdproto->SendNumeric(Config.ServerName, 307, source, "%s :is a registered nick", bi->nick);
+ ircdproto->SendNumeric(Config.ServerName, 312, source, "%s %s :%s", bi->nick, Config.ServerName, Config.ServerDesc);
+ ircdproto->SendNumeric(Config.ServerName, 317, source, "%s %ld %ld :seconds idle, signon time", bi->nick, time(NULL) - bi->lastmsg, start_time);
+ ircdproto->SendNumeric(Config.ServerName, 318, source, "%s :End of /WHOIS list.", who);
return MOD_CONT;
} else if (!ircd->svshold && (na = findnick(who)) && na->HasFlag(NS_KILL_HELD)) {
/* We have a nick enforcer client here that we need to respond to.
* We can't just say it doesn't exist here, even tho it does for
* other servers :) -GD
*/
- ircdproto->SendNumeric(ServerName, 311, source, "%s %s %s * :Services Enforcer", na->nick, NSEnforcerUser, NSEnforcerHost);
- ircdproto->SendNumeric(ServerName, 312, source, "%s %s :%s", na->nick, ServerName, ServerDesc);
- ircdproto->SendNumeric(ServerName, 318, source, "%s :End of /WHOIS list.", who);
+ ircdproto->SendNumeric(Config.ServerName, 311, source, "%s %s %s * :Services Enforcer", na->nick, Config.NSEnforcerUser, Config.NSEnforcerHost);
+ ircdproto->SendNumeric(Config.ServerName, 312, source, "%s %s :%s", na->nick, Config.ServerName, Config.ServerDesc);
+ ircdproto->SendNumeric(Config.ServerName, 318, source, "%s :End of /WHOIS list.", who);
return MOD_CONT;
} else {
- ircdproto->SendNumeric(ServerName, 401, source, "%s :No such service.", who);
+ ircdproto->SendNumeric(Config.ServerName, 401, source, "%s :No such service.", who);
return MOD_CONT;
}
- ircdproto->SendNumeric(ServerName, 311, source, "%s %s %s * :%s", who, ServiceUser, ServiceHost, clientdesc);
- ircdproto->SendNumeric(ServerName, 312, source, "%s %s :%s", who, ServerName, ServerDesc);
- ircdproto->SendNumeric(ServerName, 317, source, "%s %ld %ld :seconds idle, signon time", who, time(NULL) - start_time, start_time);
- ircdproto->SendNumeric(ServerName, 318, source, "%s :End of /WHOIS list.", who);
+ ircdproto->SendNumeric(Config.ServerName, 311, source, "%s %s %s * :%s", who, Config.ServiceUser, Config.ServiceHost, clientdesc);
+ ircdproto->SendNumeric(Config.ServerName, 312, source, "%s %s :%s", who, Config.ServerName, Config.ServerDesc);
+ ircdproto->SendNumeric(Config.ServerName, 317, source, "%s %ld %ld :seconds idle, signon time", who, time(NULL) - start_time, start_time);
+ ircdproto->SendNumeric(Config.ServerName, 318, source, "%s :End of /WHOIS list.", who);
}
return MOD_CONT;
}