summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-08-27 20:56:28 -0400
committerAdam <Adam@anope.org>2010-08-27 20:56:28 -0400
commitc2ddecc2b1dbc9d055166bdf296da2e4536f74f6 (patch)
tree9b98582630a2debab628e23d4d796885f50ada74 /modules
parent73fb94c55344b6ad788c925bf13325236402891f (diff)
Added a new logging system
Diffstat (limited to 'modules')
-rw-r--r--modules/core/bs_act.cpp6
-rw-r--r--modules/core/bs_assign.cpp3
-rw-r--r--modules/core/bs_badwords.cpp19
-rw-r--r--modules/core/bs_bot.cpp6
-rw-r--r--modules/core/bs_kick.cpp21
-rw-r--r--modules/core/bs_say.cpp6
-rw-r--r--modules/core/bs_set.cpp3
-rw-r--r--modules/core/bs_unassign.cpp3
-rw-r--r--modules/core/cs_access.cpp38
-rw-r--r--modules/core/cs_akick.cpp32
-rw-r--r--modules/core/cs_ban.cpp5
-rw-r--r--modules/core/cs_clear.cpp6
-rw-r--r--modules/core/cs_drop.cpp13
-rw-r--r--modules/core/cs_forbid.cpp11
-rw-r--r--modules/core/cs_getkey.cpp3
-rw-r--r--modules/core/cs_invite.cpp5
-rw-r--r--modules/core/cs_kick.cpp3
-rw-r--r--modules/core/cs_modes.cpp38
-rw-r--r--modules/core/cs_register.cpp10
-rw-r--r--modules/core/cs_saset.cpp4
-rw-r--r--modules/core/cs_set.cpp3
-rw-r--r--modules/core/cs_set_founder.cpp2
-rw-r--r--modules/core/cs_set_successor.cpp2
-rw-r--r--modules/core/cs_set_xop.cpp4
-rw-r--r--modules/core/cs_suspend.cpp11
-rw-r--r--modules/core/cs_topic.cpp14
-rw-r--r--modules/core/cs_xop.cpp22
-rw-r--r--modules/core/db_plain.cpp33
-rw-r--r--modules/core/enc_md5.cpp2
-rw-r--r--modules/core/enc_none.cpp2
-rw-r--r--modules/core/enc_old.cpp2
-rw-r--r--modules/core/enc_sha1.cpp2
-rw-r--r--modules/core/enc_sha256.cpp2
-rw-r--r--modules/core/hs_del.cpp2
-rw-r--r--modules/core/hs_delall.cpp2
-rw-r--r--modules/core/hs_off.cpp1
-rw-r--r--modules/core/hs_on.cpp1
-rw-r--r--modules/core/hs_set.cpp3
-rw-r--r--modules/core/hs_setall.cpp2
-rw-r--r--modules/core/ms_rsend.cpp2
-rw-r--r--modules/core/ns_drop.cpp4
-rw-r--r--modules/core/ns_forbid.cpp5
-rw-r--r--modules/core/ns_getemail.cpp2
-rw-r--r--modules/core/ns_getpass.cpp4
-rw-r--r--modules/core/ns_ghost.cpp4
-rw-r--r--modules/core/ns_group.cpp12
-rw-r--r--modules/core/ns_identify.cpp6
-rw-r--r--modules/core/ns_logout.cpp2
-rw-r--r--modules/core/ns_recover.cpp2
-rw-r--r--modules/core/ns_register.cpp18
-rw-r--r--modules/core/ns_release.cpp4
-rw-r--r--modules/core/ns_resetpass.cpp6
-rw-r--r--modules/core/ns_saset.cpp6
-rw-r--r--modules/core/ns_sendpass.cpp2
-rw-r--r--modules/core/ns_set.cpp4
-rw-r--r--modules/core/ns_set_email.cpp2
-rw-r--r--modules/core/ns_suspend.cpp4
-rw-r--r--modules/core/os_defcon.cpp18
-rw-r--r--modules/core/os_ignore.cpp2
-rw-r--r--modules/core/os_modunload.cpp2
-rw-r--r--modules/core/os_news.cpp10
-rw-r--r--modules/core/os_reload.cpp2
-rw-r--r--modules/core/os_set.cpp76
-rw-r--r--modules/core/ss_main.cpp4
-rw-r--r--modules/extra/cs_appendtopic.cpp2
-rw-r--r--modules/extra/cs_enforce.cpp6
-rw-r--r--modules/extra/cs_set_misc.cpp2
-rw-r--r--modules/extra/db_mysql.cpp38
-rw-r--r--modules/extra/hs_request.cpp16
-rw-r--r--modules/extra/m_mysql.cpp10
-rw-r--r--modules/extra/m_ssl.cpp8
-rw-r--r--modules/extra/ns_maxemail.cpp2
-rw-r--r--modules/extra/ns_set_misc.cpp2
-rw-r--r--modules/protocol/bahamut.cpp8
-rw-r--r--modules/protocol/inspircd11.cpp20
-rw-r--r--modules/protocol/inspircd12.cpp22
-rw-r--r--modules/protocol/inspircd20.cpp26
-rw-r--r--modules/protocol/ratbox.cpp12
-rw-r--r--modules/protocol/unreal32.cpp20
-rw-r--r--modules/socketengines/m_socketengine_epoll.cpp14
-rw-r--r--modules/socketengines/m_socketengine_select.cpp2
81 files changed, 400 insertions, 360 deletions
diff --git a/modules/core/bs_act.cpp b/modules/core/bs_act.cpp
index 34251cbb2..d52dbdb78 100644
--- a/modules/core/bs_act.cpp
+++ b/modules/core/bs_act.cpp
@@ -49,8 +49,10 @@ class CommandBSAct : public Command
ircdproto->SendAction(ci->bi, ci->name, "%s", message.c_str());
ci->bi->lastmsg = time(NULL);
- if (Config->LogBot && !Config->LogChannel.empty() && LogChan && !debug && findchan(Config->LogChannel))
- ircdproto->SendPrivmsg(ci->bi, Config->LogChannel, "ACT %s %s %s", u->nick.c_str(), ci->name.c_str(), message.c_str());
+
+ // XXX Need to be able to find if someone is overriding this.
+ Log(LOG_COMMAND, u, this, ci) << message;
+
return MOD_CONT;
}
diff --git a/modules/core/bs_assign.cpp b/modules/core/bs_assign.cpp
index b1242c857..97b23c0ef 100644
--- a/modules/core/bs_assign.cpp
+++ b/modules/core/bs_assign.cpp
@@ -59,6 +59,9 @@ class CommandBSAssign : public Command
return MOD_CONT;
}
+ bool override = !check_access(u, ci, CA_ASSIGN);
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "for " << bi->nick;
+
bi->Assign(u, ci);
notice_lang(Config->s_BotServ, u, BOT_ASSIGN_ASSIGNED, bi->nick.c_str(), ci->name.c_str());
return MOD_CONT;
diff --git a/modules/core/bs_badwords.cpp b/modules/core/bs_badwords.cpp
index 46b38bf1d..c02ff6570 100644
--- a/modules/core/bs_badwords.cpp
+++ b/modules/core/bs_badwords.cpp
@@ -53,10 +53,14 @@ class BadwordsDelCallback : public NumberList
{
User *u;
ChannelInfo *ci;
+ Command *c;
unsigned Deleted;
+ bool override;
public:
- BadwordsDelCallback(User *_u, ChannelInfo *_ci, const Anope::string &list) : NumberList(list, true), u(_u), ci(_ci), Deleted(0)
+ BadwordsDelCallback(User *_u, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), u(_u), ci(_ci), c(_c), Deleted(0), override(false)
{
+ if (!check_access(u, ci, CA_BADWORDS) && u->Account()->HasPriv("botserv/administration"))
+ this->override = true;
}
~BadwordsDelCallback()
@@ -74,6 +78,7 @@ class BadwordsDelCallback : public NumberList
if (Number > ci->GetBadWordCount())
return;
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, c, ci) << "DEL " << ci->GetBadWord(Number -1 )->word;
++Deleted;
ci->EraseBadWord(Number - 1);
}
@@ -84,6 +89,9 @@ class CommandBSBadwords : public Command
private:
CommandReturn DoList(User *u, ChannelInfo *ci, const Anope::string &word)
{
+ bool override = !check_access(u, ci, CA_BADWORDS);
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "LIST";
+
if (!ci->GetBadWordCount())
notice_lang(Config->s_BotServ, u, BOT_BADWORDS_LIST_EMPTY, ci->name.c_str());
else if (!word.empty() && word.find_first_not_of("1234567890,-") == Anope::string::npos)
@@ -156,6 +164,8 @@ class CommandBSBadwords : public Command
}
}
+ bool override = !check_access(u, ci, CA_BADWORDS);
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "ADD " << realword;
ci->AddBadWord(realword, type);
notice_lang(Config->s_BotServ, u, BOT_BADWORDS_ADDED, realword.c_str(), ci->name.c_str());
@@ -168,7 +178,7 @@ class CommandBSBadwords : public Command
/* Special case: is it a number/list? Only do search if it isn't. */
if (!word.empty() && isdigit(word[0]) && word.find_first_not_of("1234567890,-") == Anope::string::npos)
{
- BadwordsDelCallback list(u, ci, word);
+ BadwordsDelCallback list(u, ci, this, word);
list.Process();
}
else
@@ -190,6 +200,8 @@ class CommandBSBadwords : public Command
return MOD_CONT;
}
+ bool override = !check_access(u, ci, CA_BADWORDS);
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "DEL " << badword->word;
ci->EraseBadWord(i);
notice_lang(Config->s_BotServ, u, BOT_BADWORDS_DELETED, badword->word.c_str(), ci->name.c_str());
@@ -200,6 +212,9 @@ class CommandBSBadwords : public Command
CommandReturn DoClear(User *u, ChannelInfo *ci)
{
+ bool override = !check_access(u, ci, CA_BADWORDS);
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "CLEAR";
+
ci->ClearBadWords();
notice_lang(Config->s_BotServ, u, BOT_BADWORDS_CLEAR);
return MOD_CONT;
diff --git a/modules/core/bs_bot.cpp b/modules/core/bs_bot.cpp
index f001c81a4..5c96ac70c 100644
--- a/modules/core/bs_bot.cpp
+++ b/modules/core/bs_bot.cpp
@@ -95,10 +95,13 @@ class CommandBSBot : public Command
if (!(bi = new BotInfo(nick, user, host, real)))
{
+ // XXX this cant happen?
notice_lang(Config->s_BotServ, u, BOT_BOT_CREATION_FAILED);
return MOD_CONT;
}
+ Log(LOG_ADMIN, u, this) << "ADD " << bi->GetMask() << " " << bi->realname;
+
notice_lang(Config->s_BotServ, u, BOT_BOT_ADDED, bi->nick.c_str(), bi->GetIdent().c_str(), bi->host.c_str(), bi->realname.c_str());
FOREACH_MOD(I_OnBotCreate, OnBotCreate(bi));
@@ -260,6 +263,7 @@ class CommandBSBot : public Command
}
notice_lang(Config->s_BotServ, u, BOT_BOT_CHANGED, oldnick.c_str(), bi->nick.c_str(), bi->GetIdent().c_str(), bi->host.c_str(), bi->realname.c_str());
+ Log(LOG_ADMIN, u, this) << "CHANGE " << oldnick << " to " << bi->GetMask() << " " << bi->realname;
FOREACH_MOD(I_OnBotChange, OnBotChange(bi));
return MOD_CONT;
@@ -294,6 +298,8 @@ class CommandBSBot : public Command
XLine x(bi->nick);
ircdproto->SendSQLineDel(&x);
+ Log(LOG_ADMIN, u, this) << "DEL " << bi->nick;
+
delete bi;
notice_lang(Config->s_BotServ, u, BOT_BOT_DELETED, nick.c_str());
return MOD_CONT;
diff --git a/modules/core/bs_kick.cpp b/modules/core/bs_kick.cpp
index 849efb7d0..2ed3c8639 100644
--- a/modules/core/bs_kick.cpp
+++ b/modules/core/bs_kick.cpp
@@ -42,6 +42,9 @@ class CommandBSKick : public Command
notice_help(Config->s_BotServ, u, BOT_NOT_ASSIGNED);
else
{
+ bool override = !check_access(u, ci, CA_SET);
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << option << " " << value;
+
if (option.equals_ci("BADWORDS"))
{
if (value.equals_ci("ON"))
@@ -54,7 +57,7 @@ class CommandBSKick : public Command
if (!error.empty() || ci->ttb[TTB_BADWORDS] < 0)
{
/* leaving the debug behind since we might want to know what these are */
- Alog(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_BADWORDS];
+ Log(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_BADWORDS];
/* reset the value back to 0 - TSL */
ci->ttb[TTB_BADWORDS] = 0;
notice_lang(Config->s_BotServ, u, BOT_KICK_BAD_TTB, ttb.c_str());
@@ -85,7 +88,7 @@ class CommandBSKick : public Command
ci->ttb[TTB_BOLDS] = convertTo<int16>(ttb, error, false);
if (!error.empty() || ci->ttb[TTB_BOLDS] < 0)
{
- Alog(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_BOLDS];
+ Log(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_BOLDS];
ci->ttb[TTB_BOLDS] = 0;
notice_lang(Config->s_BotServ, u, BOT_KICK_BAD_TTB, ttb.c_str());
return MOD_CONT;
@@ -118,7 +121,7 @@ class CommandBSKick : public Command
ci->ttb[TTB_CAPS] = convertTo<int16>(ttb, error, false);
if (!error.empty() || ci->ttb[TTB_CAPS] < 0)
{
- Alog(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_CAPS];
+ Log(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_CAPS];
ci->ttb[TTB_CAPS] = 0;
notice_lang(Config->s_BotServ, u, BOT_KICK_BAD_TTB, ttb.c_str());
return MOD_CONT;
@@ -163,7 +166,7 @@ class CommandBSKick : public Command
ci->ttb[TTB_COLORS] = convertTo<int16>(ttb, error, false);
if (!error.empty() || ci->ttb[TTB_COLORS] < 0)
{
- Alog(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_COLORS];
+ Log(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_COLORS];
ci->ttb[TTB_COLORS] = 0;
notice_lang(Config->s_BotServ, u, BOT_KICK_BAD_TTB, ttb.c_str());
return MOD_CONT;
@@ -196,7 +199,7 @@ class CommandBSKick : public Command
ci->ttb[TTB_FLOOD] = convertTo<int16>(ttb, error, false);
if (!error.empty() || ci->ttb[TTB_FLOOD] < 0)
{
- Alog(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_FLOOD];
+ Log(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_FLOOD];
ci->ttb[TTB_FLOOD] = 0;
notice_lang(Config->s_BotServ, u, BOT_KICK_BAD_TTB, ttb.c_str());
return MOD_CONT;
@@ -243,7 +246,7 @@ class CommandBSKick : public Command
ci->ttb[TTB_REPEAT] = convertTo<int16>(ttb, error, false);
if (!error.empty() || ci->ttb[TTB_REPEAT] < 0)
{
- Alog(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_REPEAT];
+ Log(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_REPEAT];
ci->ttb[TTB_REPEAT] = 0;
notice_lang(Config->s_BotServ, u, BOT_KICK_BAD_TTB, ttb.c_str());
return MOD_CONT;
@@ -281,7 +284,7 @@ class CommandBSKick : public Command
ci->ttb[TTB_REVERSES] = convertTo<int16>(ttb, error, false);
if (!error.empty() || ci->ttb[TTB_REVERSES] < 0)
{
- Alog(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_REVERSES];
+ Log(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_REVERSES];
ci->ttb[TTB_REVERSES] = 0;
notice_lang(Config->s_BotServ, u, BOT_KICK_BAD_TTB, ttb.c_str());
return MOD_CONT;
@@ -311,7 +314,7 @@ class CommandBSKick : public Command
ci->ttb[TTB_UNDERLINES] = convertTo<int16>(ttb, error, false);
if (!error.empty() || ci->ttb[TTB_UNDERLINES] < 0)
{
- Alog(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_UNDERLINES];
+ Log(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_UNDERLINES];
ci->ttb[TTB_UNDERLINES] = 0;
notice_lang(Config->s_BotServ, u, BOT_KICK_BAD_TTB, ttb.c_str());
return MOD_CONT;
@@ -341,7 +344,7 @@ class CommandBSKick : public Command
ci->ttb[TTB_ITALICS] = convertTo<int16>(ttb, error, false);
if (!error.empty() || ci->ttb[TTB_ITALICS] < 0)
{
- Alog(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_ITALICS];
+ Log(LOG_DEBUG) << "remainder of ttb " << error << " ttb " << ci->ttb[TTB_ITALICS];
ci->ttb[TTB_ITALICS] = 0;
notice_lang(Config->s_BotServ, u, BOT_KICK_BAD_TTB, ttb.c_str());
return MOD_CONT;
diff --git a/modules/core/bs_say.cpp b/modules/core/bs_say.cpp
index 1b799c415..916cf8fca 100644
--- a/modules/core/bs_say.cpp
+++ b/modules/core/bs_say.cpp
@@ -55,8 +55,10 @@ class CommandBSSay : public Command
ircdproto->SendPrivmsg(ci->bi, ci->name, "%s", text.c_str());
ci->bi->lastmsg = time(NULL);
- if (Config->LogBot && !Config->LogChannel.empty() && LogChan && !debug && findchan(Config->LogChannel))
- ircdproto->SendPrivmsg(ci->bi, Config->LogChannel, "SAY %s %s %s", u->nick.c_str(), ci->name.c_str(), text.c_str());
+
+ // XXX need a way to find if someone is overriding this
+ Log(LOG_COMMAND, u, this, ci) << text;
+
return MOD_CONT;
}
diff --git a/modules/core/bs_set.cpp b/modules/core/bs_set.cpp
index 87a15cf66..0ee46a0d5 100644
--- a/modules/core/bs_set.cpp
+++ b/modules/core/bs_set.cpp
@@ -64,6 +64,9 @@ class CommandBSSet : public Command
notice_lang(Config->s_BotServ, u, ACCESS_DENIED);
else
{
+ bool override = !check_access(u, ci, CA_SET);
+ Log(override ? LOG_ADMIN : LOG_COMMAND, u, this, ci) << option << value;
+
if (option.equals_ci("DONTKICKOPS"))
{
if (value.equals_ci("ON"))
diff --git a/modules/core/bs_unassign.cpp b/modules/core/bs_unassign.cpp
index bde37f78e..6b6b28fe9 100644
--- a/modules/core/bs_unassign.cpp
+++ b/modules/core/bs_unassign.cpp
@@ -36,6 +36,9 @@ class CommandBSUnassign : public Command
notice_help(Config->s_BotServ, u, BOT_UNASSIGN_PERSISTANT_CHAN);
else
{
+ bool override = !check_access(u, ci, CA_ASSIGN);
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "for " << ci->bi->nick;
+
ci->bi->UnAssign(u, ci);
notice_lang(Config->s_BotServ, u, BOT_UNASSIGN_UNASSIGNED, ci->name.c_str());
}
diff --git a/modules/core/cs_access.cpp b/modules/core/cs_access.cpp
index 5fea57486..c6714cf05 100644
--- a/modules/core/cs_access.cpp
+++ b/modules/core/cs_access.cpp
@@ -108,12 +108,16 @@ class AccessDelCallback : public NumberList
{
User *u;
ChannelInfo *ci;
+ Command *c;
unsigned Deleted;
Anope::string Nicks;
bool Denied;
+ bool override;
public:
- AccessDelCallback(User *_u, ChannelInfo *_ci, const Anope::string &numlist) : NumberList(numlist, true), u(_u), ci(_ci), Deleted(0), Denied(false)
+ AccessDelCallback(User *_u, ChannelInfo *_ci, Command *_c, const Anope::string &numlist) : NumberList(numlist, true), u(_u), ci(_ci), c(_c), Deleted(0), Denied(false)
{
+ if (!check_access(u, ci, CA_ACCESS_CHANGE) && u->Account()->HasPriv("chanserv/access/modify"))
+ this->override = true;
}
~AccessDelCallback()
@@ -124,7 +128,7 @@ class AccessDelCallback : public NumberList
notice_lang(Config->s_ChanServ, u, CHAN_ACCESS_NO_MATCH, ci->name.c_str());
else
{
- Alog() << Config->s_ChanServ << ": " << u->GetMask() << " (level " << get_access(u, ci) << ") deleted access of user" << (Deleted == 1 ? " " : "s ") << Nicks << " on " << ci->name;
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, c, ci) << "for user" << (Deleted == 1 ? " " : "s ") << Nicks;
if (Deleted == 1)
notice_lang(Config->s_ChanServ, u, CHAN_ACCESS_DELETED_ONE, ci->name.c_str());
@@ -183,6 +187,8 @@ class CommandCSAccess : public Command
return MOD_CONT;