diff options
| author | DukePyrolator <DukePyrolator@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-31 06:15:29 +0000 |
|---|---|---|
| committer | DukePyrolator <DukePyrolator@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-31 06:15:29 +0000 |
| commit | aa4b3e256377030d291fc2d5f4db94985ce04395 (patch) | |
| tree | 993302c0cbe754612f69c22bbbc57d00220cabd4 /src/core | |
| parent | 47504c9de5accda45a19627fd2b6ec13baa6ba95 (diff) | |
replaced the alog() command with a new type-safe and stream-based Alog()
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2777 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/core')
42 files changed, 156 insertions, 192 deletions
diff --git a/src/core/bs_kick.c b/src/core/bs_kick.c index 37cd742f5..be0815a29 100644 --- a/src/core/bs_kick.c +++ b/src/core/bs_kick.c @@ -46,15 +46,12 @@ class CommandBSKick : public Command if (value == "ON") { if (ttb) { errno = 0; - ci->ttb[TTB_BADWORDS] = - strtol(ttb, NULL, 10); + ci->ttb[TTB_BADWORDS] = strtol(ttb, NULL, 10); /* Only error if errno returns ERANGE or EINVAL or we are less then 0 - TSL */ - if (errno == ERANGE || errno == EINVAL - || ci->ttb[TTB_BADWORDS] < 0) { + if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_BADWORDS] < 0) + { /* leaving the debug behind since we might want to know what these are */ - if (debug) { - alog("debug: errno is %d ERANGE %d EINVAL %d ttb %d", errno, ERANGE, EINVAL, ci->ttb[TTB_BADWORDS]); - } + Alog(LOG_DEBUG) << "errno is " << errno << " ERANGE " << ERANGE << " EINVAL " << EINVAL << " 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); @@ -78,11 +75,9 @@ class CommandBSKick : public Command if (ttb) { errno = 0; ci->ttb[TTB_BOLDS] = strtol(ttb, NULL, 10); - if (errno == ERANGE || errno == EINVAL - || ci->ttb[TTB_BOLDS] < 0) { - if (debug) { - alog("debug: errno is %d ERANGE %d EINVAL %d ttb %d", errno, ERANGE, EINVAL, ci->ttb[TTB_BOLDS]); - } + if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_BOLDS] < 0) + { + Alog(LOG_DEBUG) << "errno is " << errno << " ERANGE " << ERANGE << " EINVAL " << EINVAL << " ttb " << ci->ttb[TTB_BOLDS]; ci->ttb[TTB_BOLDS] = 0; notice_lang(Config.s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; @@ -107,11 +102,9 @@ class CommandBSKick : public Command if (ttb) { errno = 0; ci->ttb[TTB_CAPS] = strtol(ttb, NULL, 10); - if (errno == ERANGE || errno == EINVAL - || ci->ttb[TTB_CAPS] < 0) { - if (debug) { - alog("debug: errno is %d ERANGE %d EINVAL %d ttb %d", errno, ERANGE, EINVAL, ci->ttb[TTB_CAPS]); - } + if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_CAPS] < 0) + { + Alog(LOG_DEBUG) << "errno is " << errno << " ERANGE " << ERANGE << " EINVAL " << EINVAL << " ttb " << ci->ttb[TTB_CAPS]; ci->ttb[TTB_CAPS] = 0; notice_lang(Config.s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; @@ -150,11 +143,9 @@ class CommandBSKick : public Command if (ttb) { errno = 0; ci->ttb[TTB_COLORS] = strtol(ttb, NULL, 10); - if (errno == ERANGE || errno == EINVAL - || ci->ttb[TTB_COLORS] < 0) { - if (debug) { - alog("debug: errno is %d ERANGE %d EINVAL %d ttb %d", errno, ERANGE, EINVAL, ci->ttb[TTB_COLORS]); - } + if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_COLORS] < 0) + { + Alog(LOG_DEBUG) << "errno is " << errno << " ERANGE " << ERANGE << " EINVAL " << EINVAL << " ttb " << ci->ttb[TTB_COLORS]; ci->ttb[TTB_COLORS] = 0; notice_lang(Config.s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; @@ -179,11 +170,8 @@ class CommandBSKick : public Command if (ttb) { errno = 0; ci->ttb[TTB_FLOOD] = strtol(ttb, NULL, 10); - if (errno == ERANGE || errno == EINVAL - || ci->ttb[TTB_FLOOD] < 0) { - if (debug) { - alog("debug: errno is %d ERANGE %d EINVAL %d ttb %d", errno, ERANGE, EINVAL, ci->ttb[TTB_FLOOD]); - } + if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_FLOOD] < 0) { + Alog(LOG_DEBUG) << "errno is " << errno << " ERANGE " << ERANGE << " EINVAL " << EINVAL << " ttb " << ci->ttb[TTB_FLOOD]; ci->ttb[TTB_FLOOD] = 0; notice_lang(Config.s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; @@ -224,11 +212,9 @@ class CommandBSKick : public Command if (ttb) { errno = 0; ci->ttb[TTB_REPEAT] = strtol(ttb, NULL, 10); - if (errno == ERANGE || errno == EINVAL - || ci->ttb[TTB_REPEAT] < 0) { - if (debug) { - alog("debug: errno is %d ERANGE %d EINVAL %d ttb %d", errno, ERANGE, EINVAL, ci->ttb[TTB_REPEAT]); - } + if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_REPEAT] < 0) + { + Alog(LOG_DEBUG) << "errno is " << errno << " ERANGE " << ERANGE << " EINVAL " << EINVAL << " ttb " << ci->ttb[TTB_REPEAT]; ci->ttb[TTB_REPEAT] = 0; notice_lang(Config.s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; @@ -260,11 +246,9 @@ class CommandBSKick : public Command errno = 0; ci->ttb[TTB_REVERSES] = strtol(ttb, NULL, 10); - if (errno == ERANGE || errno == EINVAL - || ci->ttb[TTB_REVERSES] < 0) { - if (debug) { - alog("debug: errno is %d ERANGE %d EINVAL %d ttb %d", errno, ERANGE, EINVAL, ci->ttb[TTB_REVERSES]); - } + if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_REVERSES] < 0) + { + Alog(LOG_DEBUG) << "errno is " << errno << " ERANGE " << ERANGE << " EINVAL " << EINVAL << " ttb " << ci->ttb[TTB_REVERSES]; ci->ttb[TTB_REVERSES] = 0; notice_lang(Config.s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; @@ -287,11 +271,9 @@ class CommandBSKick : public Command errno = 0; ci->ttb[TTB_UNDERLINES] = strtol(ttb, NULL, 10); - if (errno == ERANGE || errno == EINVAL - || ci->ttb[TTB_UNDERLINES] < 0) { - if (debug) { - alog("debug: errno is %d ERANGE %d EINVAL %d ttb %d", errno, ERANGE, EINVAL, ci->ttb[TTB_UNDERLINES]); - } + if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_UNDERLINES] < 0) + { + Alog(LOG_DEBUG) << "errno is " << errno << " ERANGE " << ERANGE << " EINVAL " << EINVAL << " ttb " << ci->ttb[TTB_UNDERLINES]; ci->ttb[TTB_UNDERLINES] = 0; notice_lang(Config.s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; diff --git a/src/core/cs_access.c b/src/core/cs_access.c index ec62dec42..808141aa0 100644 --- a/src/core/cs_access.c +++ b/src/core/cs_access.c @@ -227,7 +227,8 @@ class CommandCSAccess : public Command FOREACH_MOD(I_OnAccessChange, OnAccessChange(ci, u, na->nick, level)); - alog("%s: %s!%s@%s (level %d) set access level %d to %s (group %s) on channel %s", Config.s_ChanServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, ulev, access->level, na->nick, nc->display, ci->name.c_str()); + Alog() << Config.s_ChanServ << ": " << u->GetMask() << " (level " << ulev << ") set access level " + << access->level << " to " << na->nick << " (group " << nc->display << ") on channel " << ci->name; notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_LEVEL_CHANGED, nc->display, chan, level); return MOD_CONT; } @@ -243,7 +244,8 @@ class CommandCSAccess : public Command FOREACH_MOD(I_OnAccessAdd, OnAccessAdd(ci, u, na->nick, level)); - alog("%s: %s!%s@%s (level %d) set access level %d to %s (group %s) on channel %s", Config.s_ChanServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, ulev, level, na->nick, nc->display, ci->name.c_str()); + Alog() << Config.s_ChanServ << ": " << u->GetMask() << " (level " << ulev << ") set access level " + << level << " to " << na->nick << " (group " << nc->display << ") on channel " << ci->name; notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_ADDED, nc->display, ci->name.c_str(), level); } else if (cmd == "DEL") @@ -280,7 +282,8 @@ class CommandCSAccess : public Command } else { - alog("%s: %s!%s@%s (level %d) deleted access of user%s %s on %s", Config.s_ChanServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, get_access(u, ci), deleted == 1 ? "" : "s", nick, chan); + Alog() << Config.s_ChanServ << ": " << u->GetMask() << " (level " << get_access(u, ci) + << ") deleted access of user" << (deleted == 1 ? " " : "s ") << nick << " on " << chan; if (deleted == 1) notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_DELETED_ONE, ci->name.c_str()); else @@ -310,7 +313,8 @@ class CommandCSAccess : public Command else { notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_DELETED, access->nc->display, ci->name.c_str()); - alog("%s: %s!%s@%s (level %d) deleted access of %s (group %s) on %s", Config.s_ChanServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, get_access(u, ci), na->nick, access->nc->display, chan); + Alog() << Config.s_ChanServ << ": " << u->GetMask() << " (level " << get_access(u, ci) + << ") deleted access of " << na->nick << " (group " << access->nc->display << ") on " << chan; access->nc = NULL; access->in_use = 0; deleted = 1; @@ -403,10 +407,7 @@ class CommandCSAccess : public Command FOREACH_MOD(I_OnAccessClear, OnAccessClear(ci, u)); notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_CLEAR, ci->name.c_str()); - alog("%s: %s!%s@%s (level %d) cleared access list on %s", - Config.s_ChanServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, - get_access(u, ci), chan); - + Alog() << Config.s_ChanServ << ": " << u->GetMask() << " (level " << get_access(u, ci) << " cleared access list on " << chan; } else this->OnSyntaxError(u, ""); @@ -473,9 +474,8 @@ class CommandCSLevels : public Command if (stricmp(levelinfo[i].name, what) == 0) { ci->levels[levelinfo[i].what] = level; - alog("%s: %s!%s@%s set level %s on channel %s to %d", - Config.s_ChanServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, - levelinfo[i].name, ci->name.c_str(), level); + Alog() << Config.s_ChanServ << ": " << u->GetMask() << " set level " << levelinfo[i].name + << " on channel " << ci->name << " to " << level; notice_lang(Config.s_ChanServ, u, CHAN_LEVELS_CHANGED, levelinfo[i].name, chan, level); return MOD_CONT; @@ -489,9 +489,8 @@ class CommandCSLevels : public Command if (stricmp(levelinfo[i].name, what) == 0) { ci->levels[levelinfo[i].what] = ACCESS_INVALID; - alog("%s: %s!%s@%s disabled level %s on channel %s", - Config.s_ChanServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, - levelinfo[i].name, ci->name.c_str()); + Alog() << Config.s_ChanServ << ": " << u->GetMask() << " disabled level " << levelinfo[i].name + << " on channel " << ci->name; notice_lang(Config.s_ChanServ, u, CHAN_LEVELS_DISABLED, levelinfo[i].name, chan); return MOD_CONT; @@ -536,8 +535,7 @@ class CommandCSLevels : public Command } else if (cmd == "RESET") { reset_levels(ci); - alog("%s: %s!%s@%s reset levels definitions on channel %s", - Config.s_ChanServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, ci->name.c_str()); + Alog() << Config.s_ChanServ << ": " << u->GetMask() << " reset levels definitions on channel " << ci->name; notice_lang(Config.s_ChanServ, u, CHAN_LEVELS_RESET, chan); } else { this->OnSyntaxError(u, ""); diff --git a/src/core/cs_drop.c b/src/core/cs_drop.c index 7c085ea1a..1a94d9ff6 100644 --- a/src/core/cs_drop.c +++ b/src/core/cs_drop.c @@ -70,9 +70,8 @@ class CommandCSDrop : public Command ircdproto->SendSQLineDel(ci->name.c_str()); } - alog("%s: Channel %s dropped by %s!%s@%s (founder: %s)", - Config.s_ChanServ, ci->name.c_str(), u->nick.c_str(), u->GetIdent().c_str(), - u->host, (ci->founder ? ci->founder->display : "(none)")); + Alog() << Config.s_ChanServ << ": Channel " << ci->name << " dropped by " << u->GetMask() << " (founder: " + << (ci->founder ? ci->founder->display : "(none)") << ")"; delete ci; diff --git a/src/core/cs_forbid.c b/src/core/cs_forbid.c index 57a0b552b..64a707c8f 100644 --- a/src/core/cs_forbid.c +++ b/src/core/cs_forbid.c @@ -55,7 +55,7 @@ class CommandCSForbid : public Command ci = new ChannelInfo(chan); if (!ci) { - alog("%s: Valid FORBID for %s by %s failed", Config.s_ChanServ, ci->name.c_str(), u->nick.c_str()); + Alog() << Config.s_ChanServ << ": Valid FORBID for " << ci->name << " by " << u->nick << " failed"; notice_lang(Config.s_ChanServ, u, CHAN_FORBID_FAILED, chan); return MOD_CONT; } @@ -91,7 +91,7 @@ class CommandCSForbid : public Command ircdproto->SendSQLine(ci->name, reason ? reason : "Forbidden"); } - alog("%s: %s set FORBID for channel %s", Config.s_ChanServ, u->nick.c_str(), ci->name.c_str()); + Alog() << Config.s_ChanServ << ": " << u->nick << " set FORBID for channel " << ci->name; notice_lang(Config.s_ChanServ, u, CHAN_FORBID_SUCCEEDED, chan); FOREACH_MOD(I_OnChanForbidden, OnChanForbidden(ci)); diff --git a/src/core/cs_register.c b/src/core/cs_register.c index d934afb6e..67c4d0ff7 100644 --- a/src/core/cs_register.c +++ b/src/core/cs_register.c @@ -55,7 +55,7 @@ class CommandCSRegister : public Command notice_lang(Config.s_ChanServ, u, u->nc->channelcount > Config.CSMaxReg ? CHAN_EXCEEDED_CHANNEL_LIMIT : CHAN_REACHED_CHANNEL_LIMIT, Config.CSMaxReg); else if (!(ci = new ChannelInfo(chan))) { - alog("%s: makechan() failed for REGISTER %s", Config.s_ChanServ, chan); + Alog() << Config.s_ChanServ << ": makechan() failed for REGISTER " << chan; notice_lang(Config.s_ChanServ, u, CHAN_REGISTRATION_FAILED); } else @@ -76,7 +76,7 @@ class CommandCSRegister : public Command ci->bi = NULL; ++ci->founder->channelcount; - alog("%s: Channel '%s' registered by %s!%s@%s", Config.s_ChanServ, chan, u->nick.c_str(), u->GetIdent().c_str(), u->host); + Alog() << Config.s_ChanServ << ": Channel '" << chan << "' registered by " << u->GetMask(); notice_lang(Config.s_ChanServ, u, CHAN_REGISTERED, chan, u->nick.c_str()); /* Implement new mode lock */ diff --git a/src/core/cs_set.c b/src/core/cs_set.c index 158987acd..2d8981072 100644 --- a/src/core/cs_set.c +++ b/src/core/cs_set.c @@ -42,9 +42,8 @@ class CommandCSSet : public Command return MOD_CONT; } - alog("%s: Changing founder of %s from %s to %s by %s!%s@%s", - Config.s_ChanServ, ci->name.c_str(), ci->founder->display, nc->display, u->nick.c_str(), - u->GetIdent().c_str(), u->host); + Alog() << Config.s_ChanServ << ": Changing founder of " << ci->name << " from " << ci->founder->display + << " to " << nc->display << " by " << u->GetMask(); /* Founder and successor must not be the same group */ if (nc == ci->successor) @@ -88,10 +87,9 @@ class CommandCSSet : public Command else nc = NULL; - alog("%s: Changing successor of %s from %s to %s by %s!%s@%s", - Config.s_ChanServ, ci->name.c_str(), - (ci->successor ? ci->successor->display : "none"), - (nc ? nc->display : "none"), u->nick.c_str(), u->GetIdent().c_str(), u->host); + Alog() << Config.s_ChanServ << ": Changing successor of " << ci->name << " from " + << (ci->successor ? ci->successor->display : "none") + << " to " << (nc ? nc->display : "none") << " by " << u->GetMask(); ci->successor = nc; @@ -500,16 +498,14 @@ class CommandCSSet : public Command ci->SetFlag(CI_XOP); } - alog("%s: %s!%s@%s enabled XOP for %s", Config.s_ChanServ, u->nick.c_str(), - u->GetIdent().c_str(), u->host, ci->name.c_str()); + Alog() << Config.s_ChanServ << ": " << u->GetMask() << " enabled XOP for " << ci->name; notice_lang(Config.s_ChanServ, u, CHAN_SET_XOP_ON, ci->name.c_str()); } else if (param == "OFF") { ci->UnsetFlag(CI_XOP); - alog("%s: %s!%s@%s disabled XOP for %s", Config.s_ChanServ, u->nick.c_str(), - u->GetIdent().c_str(), u->host, ci->name.c_str()); + Alog() << Config.s_ChanServ << ": " << u->GetMask() << " disabled XOP for " << ci->name; notice_lang(Config.s_ChanServ, u, CHAN_SET_XOP_OFF, ci->name.c_str()); } else diff --git a/src/core/cs_suspend.c b/src/core/cs_suspend.c index 03a058629..d356e36e2 100644 --- a/src/core/cs_suspend.c +++ b/src/core/cs_suspend.c @@ -76,14 +76,14 @@ class CommandCSSuspend : public Command if (Config.WallForbid) ircdproto->SendGlobops(findbot(Config.s_ChanServ), "\2%s\2 used SUSPEND on channel \2%s\2", u->nick.c_str(), ci->name.c_str()); - alog("%s: %s set SUSPEND for channel %s", Config.s_ChanServ, u->nick.c_str(), ci->name.c_str()); + Alog() << Config.s_ChanServ << ": " << u->GetMask() << " set SUSPEND for channel " << ci->name; notice_lang(Config.s_ChanServ, u, CHAN_SUSPEND_SUCCEEDED, chan); FOREACH_MOD(I_OnChanSuspend, OnChanSuspend(ci)); } else { - alog("%s: Valid SUSPEND for %s by %s failed", Config.s_ChanServ, ci->name.c_str(), u->nick.c_str()); + Alog() << Config.s_ChanServ << ": Valid SUSPEND for " << ci->name << " by " << u->GetMask() << " failed"; notice_lang(Config.s_ChanServ, u, CHAN_SUSPEND_FAILED, chan); } return MOD_CONT; @@ -146,14 +146,14 @@ class CommandCSUnSuspend : public Command if (Config.WallForbid) ircdproto->SendGlobops(findbot(Config.s_ChanServ), "\2%s\2 used UNSUSPEND on channel \2%s\2", u->nick.c_str(), ci->name.c_str()); - alog("%s: %s set UNSUSPEND for channel %s", Config.s_ChanServ, u->nick.c_str(), ci->name.c_str()); + Alog() << Config.s_ChanServ << ": " << u->GetMask() << " set UNSUSPEND for channel " << ci->name; notice_lang(Config.s_ChanServ, u, CHAN_UNSUSPEND_SUCCEEDED, chan); FOREACH_MOD(I_OnChanUnsuspend, OnChanUnsuspend(ci)); } else { - alog("%s: Valid UNSUSPEND for %s by %s failed", Config.s_ChanServ, chan, u->nick.c_str()); + Alog() << Config.s_ChanServ << ": Valid UNSUSPEND for " << chan << " by " << u->nick << " failed"; notice_lang(Config.s_ChanServ, u, CHAN_UNSUSPEND_FAILED, chan); } return MOD_CONT; diff --git a/src/core/cs_topic.c b/src/core/cs_topic.c index 8b700a7c5..67546d8e8 100644 --- a/src/core/cs_topic.c +++ b/src/core/cs_topic.c @@ -55,7 +55,7 @@ class CommandCSTopic : public Command c->topic_time = ci->last_topic_time; if (!check_access(u, ci, CA_TOPIC)) - alog("%s: %s!%s@%s changed topic of %s as services admin.", Config.s_ChanServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, c->name.c_str()); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " changed topic of " << c->name << " as services admin."; if (ircd->join2set && whosends(ci) == findbot(Config.s_ChanServ)) { ircdproto->SendJoin(findbot(Config.s_ChanServ), c->name.c_str(), c->creation_time); diff --git a/src/core/cs_xop.c b/src/core/cs_xop.c index 021d8c3a9..130f62943 100644 --- a/src/core/cs_xop.c +++ b/src/core/cs_xop.c @@ -189,7 +189,9 @@ class XOPBase : public Command access->creator = u->nick; } - alog("%s: %s!%s@%s (level %d) %s access level %d to %s (group %s) on channel %s", Config.s_ChanServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, ulev, change ? "changed" : "set", level, na->nick, nc->display, ci->name.c_str()); + Alog() << Config.s_ChanServ << ": " << u->GetMask() << " (level " << ulev << ") " + << (change ? "changed" : "set") << " access level " << level << " to " << na->nick + << " (group " << nc->display << ") on channel " << ci->name; if (!change) { diff --git a/src/core/db_plain.cpp b/src/core/db_plain.cpp index 564cd9a35..039f19674 100644 --- a/src/core/db_plain.cpp +++ b/src/core/db_plain.cpp @@ -127,7 +127,7 @@ static void ReadDatabase(Module *m = NULL) } catch (const char *err) { - alog("[db_plain}: %s", err); + Alog() << "[db_plain}: " << err; } } else if (na && Type == MD_NA) @@ -143,7 +143,7 @@ static void ReadDatabase(Module *m = NULL) } catch (const char *err) { - alog("[db_plain}: %s", err); + Alog() << "[db_plain}: " << err; } } else if (bi && Type == MD_BI) @@ -159,7 +159,7 @@ static void ReadDatabase(Module *m = NULL) } catch (const char *err) { - alog("[db_plain}: %s", err); + Alog() << "[db_plain}: " << err; } } else if (ci && Type == MD_CH) @@ -175,7 +175,7 @@ static void ReadDatabase(Module *m = NULL) } catch (const char *err) { - alog("[db_plain}: %s", err); + Alog() << "[db_plain}: " << err; } } } @@ -397,8 +397,7 @@ static void LoadNickCore(const std::vector<std::string> ¶ms) nc->memos.memomax = atoi(params[3].c_str()); nc->channelcount = atoi(params[4].c_str()); - if (debug > 1) - alog("[db_plain]: Loaded NickCore %s", nc->display); + Alog(LOG_DEBUG_2) << "[db_plain]: Loaded NickCore " << nc->display; } static void LoadNickAlias(const std::vector<std::string> ¶ms) @@ -406,7 +405,7 @@ static void LoadNickAlias(const std::vector<std::string> ¶ms) NickCore *nc = findcore(params[0].c_str()); if (!nc) { - alog("[db_plain]: Unable to find core %s", params[0].c_str()); + Alog() << "[db_plain]: Unable to find core " << params[0]; return; } @@ -416,8 +415,7 @@ static void LoadNickAlias(const std::vector<std::string> ¶ms) na->last_seen = strtol(params[3].c_str(), NULL, 10); - if (debug > 1) - alog("[db_plain}: Loaded nickalias for %s", na->nick); + Alog(LOG_DEBUG_2) << "[db_plain}: Loaded nickalias for " << na->nick; } static void LoadBotInfo(const std::vector<std::string> ¶ms) @@ -429,8 +427,7 @@ static void LoadBotInfo(const std::vector<std::string> ¶ms) bi->chancount = atol(params[5].c_str()); bi->real = sstrdup(params[6].c_str()); - if (debug > 1) - alog("[db_plain]: Loaded botinfo for %s", bi->nick.c_str()); + Alog(LOG_DEBUG_2) << "[db_plain]: Loaded botinfo for " << bi->nick; } static void LoadChanInfo(const std::vector<std::string> ¶ms) @@ -450,8 +447,7 @@ static void LoadChanInfo(const std::vector<std::string> ¶ms) ci->memos.memomax = atoi(params[4].c_str()); - if (debug > 1) - alog("[db_plain]: loaded channel %s", ci->name.c_str()); + Alog(LOG_DEBUG_2) << "[db_plain]: loaded channel " << ci->name; } static void LoadOperInfo(const std::vector<std::string> ¶ms) @@ -651,7 +647,7 @@ class DBPlain : public Module ci->founder = findcore(params[0].c_str()); if (!ci->founder) { - alog("[db_plain]: Deleting founderless channel %s", ci->name.c_str()); + Alog() << "[db_plain]: Deleting founderless channel " << ci->name; delete ci; ci = NULL; throw "no founder"; diff --git a/src/core/enc_md5.c b/src/core/enc_md5.c index 488fd5754..cc187b3bc 100644 --- a/src/core/enc_md5.c +++ b/src/core/enc_md5.c @@ -356,8 +356,7 @@ class EMD5 : public Module b64_encode(digest, 16, cpass, 1000); buf.append(cpass); - if (debug > 1) - alog("debug: (enc_md5) hashed password %s to %s ", src.c_str(), buf.c_str()); + Alog(LOG_DEBUG_2) << "(enc_md5) hashed password from [" << src << "] to [" << buf << "]"; dest.assign(buf); return EVENT_ALLOW; } diff --git a/src/core/enc_none.c b/src/core/enc_none.c index 2a5237662..8cd375428 100644 --- a/src/core/enc_none.c +++ b/src/core/enc_none.c @@ -30,8 +30,7 @@ class ENone : public Module char cpass[1000]; b64_encode(src.c_str(), src.size(), cpass, 1000); buf.append(cpass); - if (debug > 1) - alog("debug: (enc_none) hashed password from [%s] to [%s]", src.c_str(), buf.c_str()); + Alog(LOG_DEBUG_2) << "(enc_none) hashed password from [" << src << "] to [" << buf << "]"; dest.assign(buf); return EVENT_ALLOW; } diff --git a/src/core/enc_old.c b/src/core/enc_old.c index a04ec75e9..1a4e671f0 100644 --- a/src/core/enc_old.c +++ b/src/core/enc_old.c @@ -361,8 +361,7 @@ class EOld : public Module b64_encode(digest2, 16, cpass, 1000); buf.append(cpass); - if (debug > 1) - alog("debug: (enc_old) hashed password from [%s] to [%s]", src.c_str(), buf.c_str()); + Alog(LOG_DEBUG_2) << "(enc_old) hashed password from [" << src << "] to [" << buf << "]"; dest.assign(buf); return EVENT_ALLOW; } diff --git a/src/core/enc_sha1.c b/src/core/enc_sha1.c index bcf289f0a..95f7083ee 100644 --- a/src/core/enc_sha1.c +++ b/src/core/enc_sha1.c @@ -211,8 +211,7 @@ class ESHA1 : public Module b64_encode(digest, 20, cpass, 1000); buf.append(cpass); - if (debug > 1) - alog("debug: (enc_sha1) hashed password from [%s] to [%s] ", src.c_str(), buf.c_str()); + Alog(LOG_DEBUG_2) << "(enc_sha1) hashed password from [" << src << "] to [" << buf << "]"; dest.assign(buf); return EVENT_ALLOW; } diff --git a/src/core/enc_sha256.c b/src/core/enc_sha256.c index b37c574ec..307e905d9 100644 --- a/src/core/enc_sha256.c +++ b/src/core/enc_sha256.c @@ -297,8 +297,7 @@ class ESHA256 : public Module b64_encode(digest, SHA256_DIGEST_SIZE, cpass, 1000); buf << "sha256:" << cpass << ":" << GetSaltString(); - if (debug > 1) - alog("debug: (enc_sha256) hashed password from [%s] to [%s]", src.c_str(), buf.str().c_str()); + Alog(LOG_DEBUG_2) << "(enc_sha256) hashed password from [" << src << "] to [" << buf.str() << " ]"; dest.assign(buf.str()); return EVENT_ALLOW; diff --git a/src/core/hs_del.c b/src/core/hs_del.c index 25df95b31..b01debd02 100644 --- a/src/core/hs_del.c +++ b/src/core/hs_del.c @@ -33,7 +33,7 @@ class CommandHSDel : public Command notice_lang(Config.s_HostServ, u, NICK_X_FORBIDDEN, nick); return MOD_CONT; } - alog("vHost for user \002%s\002 deleted by oper \002%s\002", nick, u->nick.c_str()); + Alog() << "vHost for user \002" << nick << "\002 deleted by oper \002" << u->nick << "\002"; FOREACH_MOD(I_OnDeleteVhost, OnDeleteVhost(na)); na->hostinfo.RemoveVhost(); notice_lang(Config.s_HostServ, u, HOST_DEL, nick); diff --git a/src/core/hs_delall.c b/src/core/hs_delall.c index d938f40ac..4da35c684 100644 --- a/src/core/hs_delall.c +++ b/src/core/hs_delall.c @@ -42,7 +42,7 @@ class CommandHSDelAll : public Command na = static_cast<NickAlias *>(nc->aliases.list[i]); na->hostinfo.RemoveVhost(); } - alog("vHosts for all nicks in group \002%s\002 deleted by oper \002%s\002", nc->display, u->nick.c_str()); + Alog() << "vHosts for all nicks in group \002" << nc->display << "\002 deleted by oper \002" << u->nick << "\002"; notice_lang(Config.s_HostServ, u, HOST_DELALL, nc->display); } else diff --git a/src/core/hs_set.c b/src/core/hs_set.c index dd54cc121..e50723d0e 100644 --- a/src/core/hs_set.c +++ b/src/core/hs_set.c @@ -118,10 +118,10 @@ class CommandHSSet : public Command delete [] hostmask; return MOD_CONT; } - if (vIdent && ircd->vident) - alog("vHost for user \002%s\002 set to \002%s@%s\002 by oper \002%s\002", nick, vIdent, hostmask, u->nick.c_str()); - else - alog("vHost for user \002%s\002 set to \002%s\002 by oper \002%s\002", nick, hostmask, u->nick.c_str()); + Alog() << "vHost for user \002" << nick << "\002 set to \002" + << (vIdent && ircd->vident ? vIdent : "") << (vIdent && ircd->vident ? "@" : "") + << hostmask << " \002 by oper \002" << u->nick << "\002"; + na->hostinfo.SetVhost(vIdent ? vIdent : "", hostmask, u->nick); FOREACH_MOD(I_OnSetVhost, OnSetVhost(na)); if (vIdent) diff --git a/src/core/hs_setall.c b/src/core/hs_setall.c index 2d22644dd..bb6f9cd15 100644 --- a/src/core/hs_setall.c +++ b/src/core/hs_setall.c @@ -116,10 +116,10 @@ class CommandHSSetAll : public Command tmp_time = time(NULL); - if (vIdent && ircd->vident) - alog("vHost for all nicks in group \002%s\002 set to \002%s@%s\002 by oper \002%s\002", nick, vIdent, hostmask, u->nick.c_str()); - else - alog("vHost for all nicks in group \002%s\002 set to \002%s\002 by oper \002%s\002", nick, hostmask, u->nick.c_str()); + Alog() << "vHost for all nicks in group \002" << nick << "\002 set to \002" + << (vIdent && ircd->vident ? vIdent : "") << (vIdent && ircd->vident ? "@" : "") + << hostmask << " \002 by oper \002" << u->nick << "\002"; + na->hostinfo.SetVhost(vIdent ? vIdent : "", hostmask, u->nick); HostServSyncVhosts(na); FOREACH_MOD(I_OnSetVhost, OnSetVhost(na)); diff --git a/src/core/ms_rsend.c b/src/core/ms_rsend.c index b5847fc81..a4c06a4cd 100644 --- a/src/core/ms_rsend.c +++ b/src/core/ms_rsend.c @@ -58,8 +58,7 @@ class CommandMSRSend : public Command else { /* rsend has been disabled */ - if (debug) - alog("debug: MSMemoReceipt is set misconfigured to %d", Config.MSMemoReceipt); + Alog(LOG_DEBUG) << "MSMemoReceipt is set misconfigured to " << Config.MSMemoReceipt; notice_lang(Config.s_MemoServ, u, MEMO_RSEND_DISABLED); } diff --git a/src/core/ns_drop.c b/src/core/ns_drop.c index 96d573b84..152287b2f 100644 --- a/src/core/ns_drop.c +++ b/src/core/ns_drop.c @@ -44,7 +44,7 @@ class CommandNSDrop : public Command { if (Config.WallDrop) ircdproto->SendGlobops(findbot(Config.s_NickServ), "\2%s\2 used DROP on \2%s\2", u->nick.c_str(), nick); - alog("%s: %s!%s@%s dropped nickname %s (e-mail: %s)", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, nr->nick, nr->email); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " dropped nickname " << nr->nick << " (e-mail: " << nr->email << ")"; delete nr; notice_lang(Config.s_NickServ, u, NICK_X_DROPPED, nick); } @@ -72,7 +72,7 @@ class CommandNSDrop : public Command if (ircd->sqline && (na->HasFlag(NS_FORBIDDEN))) ircdproto->SendSQLineDel(na->nick); - alog("%s: %s!%s@%s dropped nickname %s (group %s) (e-mail: %s)", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, na->nick, na->nc->display, na->nc->email ? na->nc->email : "none"); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " dropped nickname " << na->nick << " (group " << na->nc->display << ") (e-mail: " << (na->nc->email ? na->nc->email : "none") << ")"; delete na; FOREACH_MOD(I_OnNickDrop, OnNickDrop(my_nick ? my_nick : nick)); diff --git a/src/core/ns_forbid.c b/src/core/ns_forbid.c index 70c29fa32..18f3bf2aa 100644 --- a/src/core/ns_forbid.c +++ b/src/core/ns_forbid.c @@ -75,14 +75,14 @@ class CommandNSForbid : public Command if (Config.WallForbid) ircdproto->SendGlobops(findbot(Config.s_NickServ), "\2%s\2 used FORBID on \2%s\2", u->nick.c_str(), nick); - alog("%s: %s set FORBID for nick %s", Config.s_NickServ, u->nick.c_str(), nick); + Alog() << Config.s_NickServ << ": " << u->nick << " set FORBID for nick " << nick; notice_lang(Config.s_NickServ, u, NICK_FORBID_SUCCEEDED, nick); FOREACH_MOD(I_OnNickForbidden, OnNickForbidden(na)); } else { - alog("%s: Valid FORBID for %s by %s failed", Config.s_NickServ, nick, u->nick.c_str()); + Alog() << Config.s_NickServ << ": Valid FORBID for " << nick << " by " << u->nick << " failed"; notice_lang(Config.s_NickServ, u, NICK_FORBID_FAILED, nick); } return MOD_CONT; diff --git a/src/core/ns_getemail.c b/src/core/ns_getemail.c index 94e5f8f8a..ab83936e4 100644 --- a/src/core/ns_getemail.c +++ b/src/core/ns_getemail.c @@ -33,7 +33,7 @@ class CommandNSGetEMail : public Command int i, j = 0; NickCore *nc; - alog("%s: %s!%s@%s used GETEMAIL on %s", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, email.c_str()); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " used GETEMAIL on " << email; for (i = 0; i < 1024; ++i) { for (nc = nclists[i]; nc; nc = nc->next) diff --git a/src/core/ns_getpass.c b/src/core/ns_getpass.c index f788287ab..026f0ecdc 100644 --- a/src/core/ns_getpass.c +++ b/src/core/ns_getpass.c @@ -33,7 +33,7 @@ class CommandNSGetPass : public Command { if ((nr = findrequestnick(nick))) { - alog("%s: %s!%s@%s used GETPASS on %s", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, nick); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " used GETPASS on " << nick; if (Config.WallGetpass) ircdproto->SendGlobops(findbot(Config.s_NickServ), "\2%s\2 used GETPASS on \2%s\2", u->nick.c_str(), nick); notice_lang(Config.s_NickServ, u, NICK_GETPASS_PASSCODE_IS, nick, nr->passcode.c_str()); @@ -49,7 +49,7 @@ class CommandNSGetPass : public Command { if (enc_decrypt(na->nc->pass, tmp_pass) == 1) { - alog("%s: %s!%s@%s used GETPASS on %s", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, nick); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " used GETPASS on " << nick; if (Config.WallGetpass) ircdproto->SendGlobops(findbot(Config.s_NickServ), "\2%s\2 used GETPASS on \2%s\2", u->nick.c_str(), nick); notice_lang(Config.s_NickServ, u, NICK_GETPASS_PASSWORD_IS, nick, tmp_pass.c_str()); diff --git a/src/core/ns_ghost.c b/src/core/ns_ghost.c index 6c4ee92fb..771dc6195 100644 --- a/src/core/ns_ghost.c +++ b/src/core/ns_ghost.c @@ -53,7 +53,7 @@ class CommandNSGhost : public Command notice_lang(Config.s_NickServ, u, ACCESS_DENIED); if (!res) { - alog("%s: GHOST: invalid password for %s by %s!%s@%s", Config.s_NickServ, nick, u->nick.c_str(), u->GetIdent().c_str(), u->host); + Alog() << Config.s_NickServ << ": GHOST: invalid password for " << nick << " by " << u->GetMask(); bad_password(u); } } diff --git a/src/core/ns_group.c b/src/core/ns_group.c index 857d65768..cb463d96f 100644 --- a/src/core/ns_group.c +++ b/src/core/ns_group.c @@ -69,12 +69,12 @@ class CommandNSGroup : public Command notice_lang(Config.s_NickServ, u, NICK_GROUP_PLEASE_WAIT, (Config.NSRegDelay + u->lastnickreg) - time(NULL)); else if (u->nc && u->nc->HasFlag(NI_SUSPENDED)) { - alog("%s: %s!%s@%s tried to use GROUP from SUSPENDED nick %s", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, target->nick); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " tried to use GROUP from SUSPENDED nick " << target->nick; notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, u->nick.c_str()); } else if (target && target->nc->HasFlag(NI_SUSPENDED)) { - alog("%s: %s!%s@%s tried to use GROUP from SUSPENDED nick %s", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, target->nick); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " tried to use GROUP from SUSPENDED nick " << target->nick; notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, target->nick); } else if (target->HasFlag(NS_FORBIDDEN)) @@ -87,7 +87,7 @@ class CommandNSGroup : public Command notice_lang(Config.s_NickServ, u, NICK_GROUP_TOO_MANY, target->nick, Config.s_NickServ, Config.s_NickServ); else if (enc_check_password(pass, target->nc->pass) != 1) { - alog("%s: Failed GROUP for %s!%s@%s (invalid password)", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host); + Alog() << Config.s_NickServ << ": Failed GROUP for " << u->GetMask() << " (invalid password)"; notice_lang(Config.s_NickServ, u, PASSWORD_INCORRECT); bad_password(u); } @@ -124,7 +124,9 @@ class CommandNSGroup : public Command FOREACH_MOD(I_OnNickGroup, OnNickGroup(u, target)); ircdproto->SetAutoIdentificationToken(u); - alog("%s: %s!%s@%s makes %s join group of %s (%s) (e-mail: %s)", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, u->nick.c_str(), target->nick, target->nc->display, (target->nc->email ? target->nc->email : "none")); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " makes " << u->nick + << " join group of " << target->nick << " (" << target->nc->display + << ") (e-mail: " << (target->nc->email ? target->nc->email : "none") << ")"; notice_lang(Config.s_NickServ, u, NICK_GROUP_JOINED, target->nick); u->lastnickreg = time(NULL); @@ -133,7 +135,7 @@ class CommandNSGroup : public Command } else { - alog("%s: makealias(%s) failed", Config.s_NickServ, u->nick.c_str()); + Alog() << Config.s_NickServ << ": makealias(" << u->nick << ") failed"; notice_lang(Config.s_NickServ, u, NICK_GROUP_FAILED); } } diff --git a/src/core/ns_identify.c b/src/core/ns_identify.c index 03b59aeea..44aebeb1a 100644 --- a/src/core/ns_identify.c +++ b/src/core/ns_identify.c @@ -52,7 +52,7 @@ class CommandNSIdentify : public Command notice_lang(Config.s_NickServ, u, NICK_ALREADY_IDENTIFIED); else if (!(res = enc_check_password(pass, na->nc->pass))) { - alog("%s: Failed IDENTIFY for %s!%s@%s", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host); + Alog() << Config.s_NickServ << ": Failed IDENTIFY for " << u->nick << "!" << u->GetIdent() << "@" << u->host; notice_lang(Config.s_NickServ, u, PASSWORD_INCORRECT); bad_password(u); } @@ -62,7 +62,7 @@ class CommandNSIdentify : public Command { if (nick_identified(u)) { - alog("%s: %s!%s@%s logged out of account %s", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, u->nc->display); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " logged out of account " << u->nc->display; } if (na->last_realname) @@ -78,7 +78,7 @@ class CommandNSIdentify : public Command FOREACH_MOD(I_OnNickIdentify, OnNickIdentify(u)); - alog("%s: %s!%s@%s identified for nick %s", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, u->nick.c_str()); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " identified for account " << u->nc->display; notice_lang(Config.s_NickServ, u, NICK_IDENTIFY_SUCCEEDED); if (ircd->vhost) do_on_id(u); diff --git a/src/core/ns_logout.c b/src/core/ns_logout.c index fcea30b3b..c36c46615 100644 --- a/src/core/ns_logout.c +++ b/src/core/ns_logout.c @@ -49,7 +49,7 @@ class CommandNSLogout : public Command } u2->isSuperAdmin = 0; /* Dont let people logout and remain a SuperAdmin */ - alog("%s: %s!%s@%s logged out nickname %s", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, u2->nick.c_str()); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " logged out nickname " << u2->nick; /* Remove founder status from this user in all channels */ if (nick) diff --git a/src/core/ns_recover.c b/src/core/ns_recover.c index 320461fdd..059aee92d 100644 --- a/src/core/ns_recover.c +++ b/src/core/ns_recover.c @@ -61,7 +61,7 @@ class CommandNSRecover : public Command notice_lang(Config.s_NickServ, u, ACCESS_DENIED); if (!res) { - alog("%s: RECOVER: invalid password for %s by %s!%s@%s", Config.s_NickServ, nick, u->nick.c_str(), u->GetIdent().c_str(), u->host); + Alog() << Config.s_NickServ << ": RECOVER: invalid password for " << nick << " by " << u->GetMask(); bad_password(u); } } diff --git a/src/core/ns_register.c b/src/core/ns_register.c index a62c5e82f..298256eba 100644 --- a/src/core/ns_register.c +++ b/src/core/ns_register.c @@ -26,7 +26,7 @@ class CommandNSConfirm : public Command if (!na) { - alog("%s: makenick(%s) failed", Config.s_NickServ, u->nick.c_str()); + Alog() << Config.s_NickServ << ": makenick(" << u->nick << ") failed"; notice_lang(Config.s_NickServ, u, NICK_REGISTRATION_FAILED); return MOD_CONT; } @@ -61,7 +61,7 @@ class CommandNSConfirm : public Command if (!force) { u->nc = na->nc; - alog("%s: '%s' registered by %s@%s (e-mail: %s)", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, nr->email ? nr->email : "none"); + Alog() << Config.s_NickServ << ": '" << u->nick << "' registered by " << u->GetIdent() << "@" << u->host << " (e-mail: " << (nr->email ? nr->email : "none") << ")"; if (Config.NSAddAccessOnReg) notice_lang(Config.s_NickServ, u, NICK_REGISTERED, u->nick.c_str(), na->nc->GetAccess(0).c_str()); else @@ -78,10 +78,8 @@ class CommandNSConfirm : public Command } else { - alog("%s: '%s' confirmed by %s!%s@%s (email: %s)", Config.s_NickServ, nr->nick, u->nick.c_str(), u->GetIdent().c_str(), u->host, nr->email ? nr->email : "none"); - + Alog() << Config.s_NickServ << ": '" << nr->nick << "' confirmed by " << u->GetMask() << " (email: " << (nr->email ? nr->email : "none") << " )"; notice_lang(Config.s_NickServ, u, NICK_FORCE_REG, nr->nick); - User *user = finduser(nr->nick); /* Delrequest must be called before validate_user */ delete nr; @@ -254,7 +252,7 @@ class CommandNSRegister : public CommandNSConfirm /* i.e. there's already such a nick regged */ if (na->HasFlag(NS_FORBIDDEN)) { - alog("%s: %s@%s tried to register FORBIDden nick %s", Config.s_NickServ, u->GetIdent().c_str(), u->host, u->nick.c_str()); + Alog() << Config.s_NickServ << ": " << u->GetIdent() << "@" << u->host << " tried to register FORBIDden nick " << u->nick; notice_lang(Config.s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick.c_str()); } else @@ -284,11 +282,11 @@ class CommandNSRegister : public CommandNSConfirm if (!do_sendregmail(u, nr)) { notice_lang(Config.s_NickServ, u, NICK_ENTER_REG_CODE, email, Config.s_NickServ); - alog("%s: sent registration verification code to %s", Config.s_NickServ, nr->email); + Alog() << Config.s_NickServ << ": sent registration verification code to " << nr->email; } else { - alog("%s: Unable to send registration verification mail", Config.s_NickServ); + Alog() << Config.s_NickServ << ": Unable to send registration verification mail"; notice_lang(Config.s_NickServ, u, NICK_REG_UNABLE); delete nr; return MOD_CONT; @@ -343,11 +341,11 @@ class CommandNSResend : public Command { nr->lastmail = time(NULL); notice_lang(Config.s_NickServ, u, NICK_REG_RESENT, nr->email); - alog("%s: re-sent registration verification code for %s to %s", Config.s_NickServ, nr->nick, nr->email); + Alog() << Config.s_NickServ << ": re-sent registration verification code for " << nr->nick << " to " << nr->email; } else { - alog("%s: Unable to re-send registration verification mail for %s", Config.s_NickServ, nr->nick); + Alog() << Config.s_NickServ << ": Unable to re-send registration verification mail for " << nr->nick; return MOD_CONT; } } diff --git a/src/core/ns_release.c b/src/core/ns_release.c index 867936f74..4424d7864 100644 --- a/src/core/ns_release.c +++ b/src/core/ns_release.c @@ -50,7 +50,7 @@ class CommandNSRelease : public Command notice_lang(Config.s_NickServ, u, ACCESS_DENIED); if (!res) { - alog("%s: RELEASE: invalid password for %s by %s!%s@%s", Config.s_NickServ, nick, u->nick.c_str(), u->GetIdent().c_str(), u->host); + Alog() << Config.s_NickServ << ": RELEASE: invalid password for " << nick << " by " << u->GetMask(); bad_password(u); } } diff --git a/src/core/ns_resetpass.c b/src/core/ns_resetpass.c index d174864b1..fe39341e9 100644 --- a/src/core/ns_resetpass.c +++ b/src/core/ns_resetpass.c @@ -67,7 +67,7 @@ class CommandNSResetPass : public Command na->nc->Extend("ns_resetpass_code", new ExtensibleItemPointerArray<char>(sstrdup(passcode))); na->nc->Extend("ns_resetpass_time", new ExtensibleItemRegular<time_t>(time(NULL))); - alog("%s: %s!%s@%s used RESETPASS on %s (%s)", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, na->nick, na->nc->display); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " used RESETPASS on " << na->nick << " (" << na->nc->display << ")"; notice_lang(Config.s_NickServ, u, NICK_RESETPASS_COMPLETE, na->nick); } @@ -144,8 +144,7 @@ class NSResetPass : public Module ircdproto->SetAutoIdentificationToken(u); FOREACH_MOD(I_OnNickIdentify, OnNickIdentify(u)); - alog("%s: %s!%s@%s used CONFIRM with RESETPASS to forcefully identify to %s", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, na->nick); - + Alog() << Config.s_NickServ << ": " << u->GetMask() << " used CONFIRM with RESETPASS to forcefully identify to " << na->nick; notice_lang(Config.s_NickServ, u, NICK_CONFIRM_SUCCESS, Config.s_NickServ); if (ircd->vhost) @@ -156,7 +155,7 @@ class NSResetPass : public Module } else { - alog("%s: Invalid CONFIRM passcode for %s from %s!%s@%s", Config.s_NickServ, na->nick, u->nick.c_str(), u->GetIdent().c_str(), u->host); + Alog() << Config.s_NickServ << ": Invalid CONFIRM passcode for " << na->nick << " from " << u->GetMask(); notice_lang(Config.s_NickServ, u, NICK_CONFIRM_INVALID); bad_password(u); } diff --git a/src/core/ns_saset.c b/src/core/ns_saset.c index 5a86b1327..3ae40baea 100644 --- a/src/core/ns_saset.c +++ b/src/core/ns_saset.c @@ -83,7 +83,7 @@ private: buf = param.c_str(); /* conversion from ci::string to std::string */ if (enc_encrypt(buf, nc->pass)) { - alog("%s: Failed to encrypt password for %s (set)", Config.s_NickServ, nc->display); + Alog() << Config.s_NickServ << ": Failed to encrypt password for " << nc->display << " (set)"; notice_lang(Config.s_NickServ, u, NICK_SASET_PASSWORD_FAILED, nc->display); return MOD_CONT; } @@ -93,7 +93,7 @@ private: else notice_lang(Config.s_NickServ, u, NICK_SASET_PASSWORD_CHANGED, nc->display); - alog("%s: %s!%s@%s used SASET PASSWORD on %s (e-mail: %s)", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, nc->display, nc->email ? nc->email : "none"); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " used SASET PASSWORD on " << nc->display << " (e-mail: "<< (nc->email ? nc->email : "none") << ")"; if (Config.WallSetpass) ircdproto->SendGlobops(findbot(Config.s_NickServ), "\2%s\2 used SASET PASSWORD on \2%s\2", u->nick.c_str(), nc->display); return MOD_CONT; @@ -139,7 +139,7 @@ private: return MOD_CONT; } - alog("%s: %s!%s@%s used SASET EMAIL on %s (e-mail: %s)", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, nc->display, nc->email ? nc->email : "none"); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " used SASET EMAIL on " << nc->display << " (e-mail: " << (nc->email ? nc->email : "none") << ")"; if (nc->email) delete [] nc->email; diff --git a/src/core/ns_sendpass.c b/src/core/ns_sendpass.c index f541ba9d5..9c3667047 100644 --- a/src/core/ns_sendpass.c +++ b/src/core/ns_sendpass.c @@ -61,7 +61,7 @@ class CommandNSSendPass : public Command MailEnd(mail); - alog("%s: %s!%s@%s used SENDPASS on %s", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, nick); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " used SENDPASS on " << nick; notice_lang(Config.s_NickServ, u, NICK_SENDPASS_OK, nick); } else diff --git a/src/core/ns_set.c b/src/core/ns_set.c index c2a60742d..054959a27 100644 --- a/src/core/ns_set.c +++ b/src/core/ns_set.c @@ -80,7 +80,7 @@ class CommandNSSet : public Command buf = param.c_str(); /* conversion from ci::string to std::string */ if (enc_encrypt(buf, nc->pass) < 0) { - alog("%s: Failed to encrypt password for %s (set)", Config.s_NickServ, nc->display); + Alog() << Config.s_NickServ << ": Failed to encrypt password for " << nc->display << " (set)"; notice_lang(Config.s_NickServ, u, NICK_SET_PASSWORD_FAILED); return MOD_CONT; } @@ -90,7 +90,7 @@ class CommandNSSet : public Command else notice_lang(Config.s_NickServ, u, NICK_SET_PASSWORD_CHANGED); - alog("%s: %s!%s@%s (e-mail: %s) changed its password.", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, nc->email ? nc->email : "none"); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " (e-mail: " << (nc->email ? nc->email : "none") << ") changed its password."; return MOD_CONT; } @@ -158,7 +158,7 @@ class CommandNSSet : public Command return MOD_CONT; } - alog("%s: %s!%s@%s (e-mail: %s) changed its e-mail to %s.", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, nc->email ? nc->email : "none", param ? param : "none"); + Alog() << Config.s_NickServ << ": " << u->GetMask() << " (e-mail: " << (nc->email ? nc->email : "none") << ") changed its e-mail to " << (param ? param : "none"); if (nc->email) delete [] nc->email; diff --git a/src/core/ns_suspend.c b/src/core/ns_suspend.c index a9c6b65ba..a0e6a5967 100644 --- a/src/core/ns_suspend.c +++ b/src/core/ns_suspend.c @@ -81,14 +81,14 @@ class CommandNSSuspend : public Command if (Config.WallForbid) ircdproto->SendGlobops(findbot(Config.s_NickServ), "\2%s\2 used SUSPEND on \2%s\2", u->nick.c_str(), nick); - alog("%s: %s set SUSPEND for nick %s", Config.s_NickServ, u->nick.c_str(), nick); + Alog() << Config.s_NickServ << ": " << u->nick << " set SUSPEND for nick " << nick; notice_lang(Config.s_NickServ, u, NICK_SUSPEND_SUCCEEDED, nick); FOREACH_MOD(I_OnNickSuspended, OnNickSuspend(na)) } else { - alog("%s: Valid SUSPEND for %s by %s failed", Config.s_NickServ, nick, u->nick.c_str()); + Alog() << Config.s_NickServ << ": Valid SUSPEND for " << nick << " by " << u->nick << " failed"; notice_lang(Config.s_NickServ, u, NICK_SUSPEND_FAILED, nick); } return MOD_CONT; @@ -149,14 +149,14 @@ class CommandNSUnSuspend : public Command if (Config.WallForbid) ircdproto->SendGlobops(findbot(Config.s_NickServ), "\2%s\2 used UNSUSPEND on \2%s\2", u->nick.c_str(), nick); - alog("%s: %s set UNSUSPEND for nick %s", Config.s_NickServ, u->nick.c_str(), nick); + Alog() << Config.s_NickServ << ": " << u->nick << " set UNSUSPEND for nick " << nick; notice_lang(Config.s_NickServ, u, NICK_UNSUSPEND_SUCCEEDED, nick); FOREACH_MOD(I_OnNickUnsuspended, OnNickUnsuspended(na)); } else { - alog("%s: Valid UNSUSPEND for %s by %s failed", Config.s_NickServ, nick, u->nick.c_str()); + Alog() << Config.s_NickServ << ": Valid UNSUSPEND for " << nick << " by " << u->nick << " failed"; notice_lang(Config.s_NickServ, u, NICK_UNSUSPEND_FAILED, nick); } return MOD_CONT; diff --git a/src/core/os_defcon.c b/src/core/os_defcon.c index fdb2d236e..c06cf8c62 100644 --- a/src/core/os_defcon.c +++ b/src/core/os_defcon.c @@ -36,7 +36,7 @@ class DefConTimeout : public Timer { Config.DefConLevel = level; FOREACH_MOD(I_OnDefconLevel, OnDefconLevel(level)); - alog("Defcon level timeout, returning to lvl %d", level); + Alog() << "Defcon level timeout, returning to lvl " << level; ircdproto->SendGlobops(findbot(Config.s_OperServ), getstring(OPER_DEFCON_WALL), Config.s_OperServ, level); if (Config.GlobalOnDefcon) @@ -95,7 +95,7 @@ class CommandOSDEFCON : public Command notice_lang(Config.s_OperServ, u, OPER_DEFCON_CHANGED, Config.DefConLevel); defcon_sendlvls(u); - alog("Defcon level changed to %d by Oper %s", newLevel, u->nick.c_str()); + Alog() << "Defcon level changed to " << newLevel << " by Oper " << u->nick; ircdproto->SendGlobops(findbot(Config.s_OperServ), getstring(OPER_DEFCON_WALL), u->nick.c_str(), newLevel); /* Global notice the user what is happening. Also any Message that the Admin would like to add. Set in config file. */ @@ -164,7 +164,7 @@ class OSDEFCON : public Module if (CheckDefCon(DEFCON_AKILL_NEW_CLIENTS)) { mask = "*@" + std::string(u->host); - alog("DEFCON: adding akill for %s", mask.c_str()); + Alog() << "DEFCON: adding akill for " << mask; add_akill(NULL, mask.c_str(), Config.s_OperServ, time(NULL) + Config.DefConAKILL, Config.DefConAkillReason ? Config.DefConAkillReason : @@ -375,7 +375,7 @@ void runDefCon() { if (Config.DefConChanModes[0] == '+' || Config.DefConChanModes[0] == '-') { - alog("DEFCON: setting %s on all chan's", Config.DefConChanModes); + Alog() << "DEFCON: setting " << Config.DefConChanModes << "on all chan's"; DefConModesSet = 1; MassChannelModes(findbot(Config.s_OperServ), Config.DefConChanModes); } @@ -390,7 +390,7 @@ void runDefCon() DefConModesSet = 0; if ((newmodes = defconReverseModes(Config.DefConChanModes))) { - alog("DEFCON: setting %s on all chan's", newmodes); + Alog() << "DEFCON: setting " << newmodes << " on all chan's"; MassChannelModes(findbot(Config.s_OperServ), newmodes); delete [] newmodes; } @@ -443,7 +443,7 @@ void defconParseModeString(const char *str) { if (cm->Type == MODE_STATUS || cm->Type == MODE_LIST || !cm->CanSet(NULL)) { - alog("DefConChanModes mode character '%c' cannot be locked", mode); + Alog() << "DefConChanModes mode character '" << mode << "' cannot be locked"; continue; } else if (add) @@ -457,7 +457,7 @@ void defconParseModeString(const char *str) if (!ss.GetToken(param)) { - alog("DefConChanModes mode character '%c' has no parameter while one is expected", mode); + Alog() << "DefConChanModes mode character '" << mode << "' has no parameter while one is expected"; continue; } @@ -489,7 +489,7 @@ void defconParseModeString(const char *str) { DefConModesOn.UnsetFlag(CMODE_REDIRECT); - alog("DefConChanModes must lock mode +l as well to lock mode +L"); + Alog() << "DefConChanModes must lock mode +l as well to lock mode +L"; } } @@ -500,7 +500,7 @@ void defconParseModeString(const char *str) if (DefConModesOn.HasFlag(cm->Name) && !DefConModesOn.HasFlag(CMODE_INVITE)) { DefConModesOn.UnsetFlag(CMODE_NOKNOCK); - alog("DefConChanModes must lock mode +i as well to lock mode +K"); + Alog() << "DefConChanModes must lock mode +i as well to lock mode +K"; } } } diff --git a/src/core/os_ignore.c b/src/core/os_ignore.c index b488ec1f1..2519cde96 100644 --- a/src/core/os_ignore.c +++ b/src/core/os_ignore.c @@ -181,8 +181,7 @@ class OSIgnore : public Module if (ign->time != 0 && ign->time <= now) { - if (debug) - alog("[os_ignore] debug: Expiring ignore entry %s", ign->mask); + Alog(LOG_DEBUG) << "[os_ignore] Expiring ignore entry " << ign->mask; if (ign->prev) ign->prev->next = ign->next; else if (ignore == ign) diff --git a/src/core/os_modunload.c b/src/core/os_modunload.c index e362d9e26..bf720c971 100644 --- a/src/core/os_modunload.c +++ b/src/core/os_modunload.c @@ -34,7 +34,7 @@ class CommandOSModUnLoad : public Command return MOD_CONT; } - alog("Trying to unload module [%s]", name); + Alog() << "Trying to unload module [" << name << "]"; status = ModuleManager::UnloadModule(m, u); diff --git a/src/core/os_news.c b/src/core/os_news.c index 853c81d31..69d0fa808 100644 --- a/src/core/os_news.c +++ b/src/core/os_news.c @@ -89,7 +89,7 @@ static void DisplayNews(User *u, NewsType Type) msg = NEWS_RANDOM_TEXT; else { - alog("news: Invalid type (%d) to display_news()", Type); + Alog() << "news: Invalid type (" << Type << ") to display_news()"; return; } @@ -285,7 +285,7 @@ class NewsBase : public Command msgs = findmsgs(type, &type_name); if (!msgs) { - alog("news: Invalid type to do_news()"); + Alog() << "news: Invalid type to do_news()"; return MOD_CONT; } @@ -461,15 +461,14 @@ class OSNews : public Module for (std::vector<NewsItem *>::iterator it = News.begin(); it != News.end(); ++it) { NewsItem *n = *it; - - char buf[512], *ntype; + char buf[512]; const char* ntype; if (n->type == NEWS_LOGON) ntype = "LOGON"; else if (n->type == NEWS_RANDOM) ntype = "RANDOM"; else if (n->type == NEWS_OPER) ntype = "OPER"; - snprintf(buf, sizeof(buf), "OS NEWS %d %ld %s %s :%s", n->num, n->time, n->who.c_str(), ntype, n->Text.c_str()); + snprintf(buf, sizeof(buf), "OS NEWS %d %ld %s %s :%s", n->num, n->time, n->who.c_str(), ntype, n->Text.c_str()); Write(buf); } } diff --git a/src/core/os_set.c b/src/core/os_set.c index e216d3a1d..7be3a67f0 100644 --- a/src/core/os_set.c +++ b/src/core/os_set.c @@ -75,7 +75,7 @@ class CommandOSSet : public Command if (setting == "ON") { readonly = 1; - alog("Read-only mode activated"); + Alog() << "Read-only mode activated"; close_log(); notice_lang(Config.s_OperServ, u, OPER_SET_READONLY_ON); } @@ -83,7 +83,7 @@ class CommandOSSet : public Command { readonly = 0; open_log(); - alog("Read-only mode deactivated"); + Alog() << "Read-only mode deactivated"; notice_lang(Config.s_OperServ, u, OPER_SET_READONLY_OFF); } else @@ -117,12 +117,12 @@ class CommandOSSet : public Command ircdproto->SendJoin(findbot(Config.s_GlobalNoticer), Config.LogChannel, c ? c->creation_time : time(NULL)); } LogChan = true; - alog("Now sending log messages to %s", Config.LogChannel); + Alog() << "Now sending log messages to " << Config.LogChannel; notice_lang(Config.s_OperServ, u, OPER_SET_LOGCHAN_ON, Config.LogChannel); } else if (Config.LogChannel && setting == "OFF") { - alog("No longer sending log messages to a channel"); + Alog() << "No longer sending log messages to a channel"; if (ircd->join2msg) ircdproto->SendPart(findbot(Config.s_GlobalNoticer), findchan(Config.LogChannel), NULL); LogChan = false; @@ -155,14 +155,14 @@ class CommandOSSet : public Command { u->isSuperAdmin = 1; notice_lang(Config.s_OperServ, u, OPER_SUPER_ADMIN_ON); - alog("%s: %s is a SuperAdmin ", Config.s_OperServ, u->nick.c_str()); + Alog() << Config.s_OperServ << ": " << u->nick << " is a SuperAdmin"; ircdproto->SendGlobops(findbot(Config.s_OperServ), getstring(OPER_SUPER_ADMIN_WALL_ON), u->nick.c_str()); } else if (setting == "OFF") { u->isSuperAdmin = 0; notice_lang(Config.s_OperServ, u, OPER_SUPER_ADMIN_OFF); - alog("%s: %s is no longer a SuperAdmin", Config.s_OperServ, u->nick.c_str()); + Alog() << Config.s_OperServ << ": " << u->nick << " is no longer a SuperAdmin"; ircdproto->SendGlobops(findbot(Config.s_OperServ), getstring(OPER_SUPER_ADMIN_WALL_OFF), u->nick.c_str()); } else @@ -184,19 +184,19 @@ class CommandOSSet : public Command if (setting == "ON") { debug = 1; - alog("Debug mode activated"); + Alog() << "Debug mode activated"; notice_lang(Config.s_OperServ, u, OPER_SET_DEBUG_ON); } else if (setting == "OFF" || (setting[0] == '0' && !atoi(setting.c_str()))) { - alog("Debug mode deactivated"); + Alog() << "Debug mode deactivated"; debug = 0; notice_lang(Config.s_OperServ, u, OPER_SET_DEBUG_OFF); } else if (isdigit(setting[0]) && atoi(setting.c_str()) > 0) { debug = atoi(setting.c_str()); - alog("Debug mode activated (level %d)", debug); + Alog() << "Debug mode activated (level " << debug << ")"; notice_lang(Config.s_OperServ, u, OPER_SET_DEBUG_LEVEL, debug); } else @@ -218,13 +218,13 @@ class CommandOSSet : public Command if (setting == "ON") { noexpire = 1; - alog("No expire mode activated"); + Alog() << "No expire mode activated"; notice_lang(Config.s_OperServ, u, OPER_SET_NOEXPIRE_ON); } else if (setting == "OFF") { noexpire = 0; - alog("No expire mode deactivated"); + Alog() << "No expire mode deactivated"; notice_lang(Config.s_OperServ, u, OPER_SET_NOEXPIRE_OFF); } else diff --git a/src/core/ss_main.c b/src/core/ss_main.c index b37cbafab..8ff8080b9 100644 --- a/src/core/ss_main.c +++ b/src/core/ss_main.c @@ -47,10 +47,10 @@ class SSMain : public Module statserv = findbot("StatServ"); if (!statserv) { - alog("Creating SS"); + Alog() << "Creating SS"; statserv = new BotInfo("StatServ", Config.ServiceUser, Config.ServiceHost, "Stats Service"); } - alog("Done creating SS"); + Alog() << "Done creating SS"; statserv->cmdTable = cmdTable; } |
