diff options
author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-04 05:45:58 +0000 |
---|---|---|
committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-04 05:45:58 +0000 |
commit | 2708eea5d13c249143b83fbaa8b552992f0ac8b6 (patch) | |
tree | 5afffad5f83ca6daa89784c27f4d4e9c5f4eb8fc /src | |
parent | f58026749b0c0770a322893b27c013168be5cdbc (diff) |
Removed NICKMAX and CHANMAX, replaced user->nick, c->name, and ci->name with std::string
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2732 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
108 files changed, 624 insertions, 657 deletions
diff --git a/src/actions.c b/src/actions.c index 6ed840653..0e15f2cf4 100644 --- a/src/actions.c +++ b/src/actions.c @@ -97,8 +97,8 @@ void sqline(const std::string &mask, const std::string &reason) cunext = cu->next; if (is_oper(cu->user)) continue; - av[0] = c->name; - av[1] = cu->user->nick; + av[0] = c->name.c_str(); + av[1] = cu->user->nick.c_str(); av[2] = reason.c_str(); ircdproto->SendKick(findbot(Config.s_OperServ), c, cu->user, "Q-Lined: %s", av[2]); do_kick(Config.s_ChanServ, 3, av); @@ -158,7 +158,7 @@ void common_unban(ChannelInfo *ci, const std::string &nick) for (ban = ci->c->bans->entries; ban; ban = next) { next = ban->next; - if (entry_match(ban, u->nick, u->GetIdent().c_str(), u->host, ip) || entry_match(ban, u->nick, u->GetIdent().c_str(), u->GetDisplayedHost().c_str(), ip)) + if (entry_match(ban, u->nick.c_str(), u->GetIdent().c_str(), u->host, ip) || entry_match(ban, u->nick.c_str(), u->GetIdent().c_str(), u->GetDisplayedHost().c_str(), ip)) ci->c->RemoveMode(NULL, CMODE_BAN, ban->mask); } } diff --git a/src/bots.cpp b/src/bots.cpp index cae202bf2..ddd517b77 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -167,7 +167,7 @@ void BotInfo::UnAssign(User *u, ChannelInfo *ci) if (ci->c && ci->c->usercount >= Config.BSMinUsers) { if (u) - ircdproto->SendPart(ci->bi, ci->c, "UNASSIGN from %s", u->nick); + ircdproto->SendPart(ci->bi, ci->c, "UNASSIGN from %s", u->nick.c_str()); else ircdproto->SendPart(ci->bi, ci->c, ""); } diff --git a/src/botserv.c b/src/botserv.c index bbe3f30c9..f145e7028 100644 --- a/src/botserv.c +++ b/src/botserv.c @@ -91,7 +91,7 @@ void botserv(User * u, char *buf) if (!(s = strtok(NULL, ""))) { *s = 0; } - ircdproto->SendCTCP(findbot(Config.s_BotServ), u->nick, "PING %s", s); + ircdproto->SendCTCP(findbot(Config.s_BotServ), u->nick.c_str(), "PING %s", s); } else { mod_run_cmd(Config.s_BotServ, u, BOTSERV, cmd); } @@ -114,7 +114,7 @@ void botmsgs(User * u, BotInfo * bi, char *buf) if (!(s = strtok(NULL, ""))) { *s = 0; } - ircdproto->SendCTCP(bi, u->nick, "PING %s", s); + ircdproto->SendCTCP(bi, u->nick.c_str(), "PING %s", s); } else if (cmd && bi->cmdTable) { @@ -145,7 +145,7 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf) /* Answer to ping if needed, without breaking the buffer. */ if (!strnicmp(buf, "\1PING", 5)) { - ircdproto->SendCTCP(ci->bi, u->nick, "PING %s", buf); + ircdproto->SendCTCP(ci->bi, u->nick.c_str(), "PING %s", buf); } /* If it's a /me, cut the CTCP part at the beginning (not @@ -409,7 +409,7 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf) /* return if the user is on the ignore list */ - if (get_ignore(u->nick) != NULL) { + if (get_ignore(u->nick.c_str()) != NULL) { return; } @@ -650,7 +650,7 @@ void bot_join(ChannelInfo * ci) "%s invited %s into the channel.", ci->bi->nick, ci->bi->nick); } - ircdproto->SendJoin(ci->bi, ci->c->name, ci->c->creation_time); + ircdproto->SendJoin(ci->bi, ci->c->name.c_str(), ci->c->creation_time); ci->c->SetMode(NULL, CMODE_PROTECT, ci->bi->nick); ci->c->SetMode(NULL, CMODE_OP, ci->bi->nick); FOREACH_MOD(I_OnBotJoin, OnBotJoin(ci, ci->bi)); @@ -707,8 +707,8 @@ static void bot_kick(ChannelInfo * ci, User * u, int message, ...) vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); - av[0] = ci->name; - av[1] = u->nick; + av[0] = ci->name.c_str(); + av[1] = u->nick.c_str(); av[2] = buf; ircdproto->SendKick(ci->bi, ci->c, u, "%s", av[2]); do_kick(ci->bi->nick, 3, av); @@ -732,20 +732,18 @@ void bot_raw_ban(User * requester, ChannelInfo * ci, char *nick, if ((ModeManager::FindUserModeByName(UMODE_PROTECTED))) { if (is_protected(u) && (requester != u)) { - ircdproto->SendPrivmsg(ci->bi, ci->name, "%s", - getstring(ACCESS_DENIED)); + ircdproto->SendPrivmsg(ci->bi, ci->name.c_str(), "%s", getstring(ACCESS_DENIED)); return; } } - if (ci->HasFlag(CI_PEACE) && stricmp(requester->nick, nick) && (get_access(u, ci) >= get_access(requester, ci))) + if (ci->HasFlag(CI_PEACE) && stricmp(requester->nick.c_str(), nick) && (get_access(u, ci) >= get_access(requester, ci))) return; if (ModeManager::FindChannelModeByName(CMODE_EXCEPT)) { if (is_excepted(ci, u) == 1) { - ircdproto->SendPrivmsg(ci->bi, ci->name, "%s", - getstring(BOT_EXCEPT)); + ircdproto->SendPrivmsg(ci->bi, ci->name.c_str(), "%s", getstring(BOT_EXCEPT)); return; } } @@ -754,7 +752,7 @@ void bot_raw_ban(User * requester, ChannelInfo * ci, char *nick, ci->c->SetMode(NULL, CMODE_BAN, mask); - kav[0] = ci->name; + kav[0] = ci->name.c_str(); kav[1] = nick; if (!reason) { @@ -767,7 +765,7 @@ void bot_raw_ban(User * requester, ChannelInfo * ci, char *nick, /* Check if we need to do a signkick or not -GD */ if ((ci->HasFlag(CI_SIGNKICK) || ci->HasFlag(CI_SIGNKICK_LEVEL)) && !check_access(requester, ci, CA_SIGNKICK)) - ircdproto->SendKick(ci->bi, ci->c, u, "%s (%s)", kav[2], requester->nick); + ircdproto->SendKick(ci->bi, ci->c, u, "%s (%s)", kav[2], requester->nick.c_str()); else ircdproto->SendKick(ci->bi, ci->c, u, "%s", kav[2]); @@ -791,16 +789,15 @@ void bot_raw_kick(User * requester, ChannelInfo * ci, char *nick, if ((ModeManager::FindUserModeByName(UMODE_PROTECTED))) { if (is_protected(u) && (requester != u)) { - ircdproto->SendPrivmsg(ci->bi, ci->name, "%s", - getstring(ACCESS_DENIED)); + ircdproto->SendPrivmsg(ci->bi, ci->name.c_str(), "%s", getstring(ACCESS_DENIED)); return; } } - if (ci->HasFlag(CI_PEACE) && stricmp(requester->nick, nick) && (get_access(u, ci) >= get_access(requester, ci))) + if (ci->HasFlag(CI_PEACE) && stricmp(requester->nick.c_str(), nick) && (get_access(u, ci) >= get_access(requester, ci))) return; - av[0] = ci->name; + av[0] = ci->name.c_str(); av[1] = nick; if (!reason) { @@ -812,7 +809,7 @@ void bot_raw_kick(User * requester, ChannelInfo * ci, char *nick, } if (ci->HasFlag(CI_SIGNKICK) || ((ci->HasFlag(CI_SIGNKICK_LEVEL)) && !check_access(requester, ci, CA_SIGNKICK))) - ircdproto->SendKick(ci->bi, ci->c, u, "%s (%s)", av[2], requester->nick); + ircdproto->SendKick(ci->bi, ci->c, u, "%s (%s)", av[2], requester->nick.c_str()); else ircdproto->SendKick(ci->bi, ci->c, u, "%s", av[2]); do_kick(ci->bi->nick, 3, av); @@ -839,15 +836,13 @@ void bot_raw_mode(User * requester, ChannelInfo * ci, const char *mode, if ((ModeManager::FindUserModeByName(UMODE_PROTECTED))) { if (is_protected(u) && *mode == '-' && (requester != u)) { - ircdproto->SendPrivmsg(ci->bi, ci->name, "%s", - getstring(ACCESS_DENIED)); + ircdproto->SendPrivmsg(ci->bi, ci->name.c_str(), "%s", getstring(ACCESS_DENIED)); return; } } if (*mode == '-' && ci->HasFlag(CI_PEACE) - && stricmp(requester->nick, nick) - && (get_access(u, ci) >= get_access(requester, ci))) + && stricmp(requester->nick.c_str(), nick) && (get_access(u, ci) >= get_access(requester, ci))) return; ci->c->SetModes(NULL, "%s %s", mode, nick); diff --git a/src/channels.c b/src/channels.c index 79f956581..5e9ca98de 100644 --- a/src/channels.c +++ b/src/channels.c @@ -33,7 +33,7 @@ Channel::Channel(const std::string &name, time_t ts) if (name.empty()) throw CoreException("A channel without a name ?"); - strscpy(this->name, name.c_str(), sizeof(this->name)); + this->name = name; list = &chanlist[HASH(this->name)]; this->prev = NULL; this->next = *list; @@ -43,7 +43,6 @@ Channel::Channel(const std::string &name, time_t ts) this->creation_time = ts; this->topic = NULL; - *this->topic_setter = 0; this->bans = this->excepts = this->invites = NULL; this->users = NULL; this->usercount = 0; @@ -51,7 +50,7 @@ Channel::Channel(const std::string &name, time_t ts) this->server_modetime = this->chanserv_modetime = 0; this->server_modecount = this->chanserv_modecount = this->bouncy_modes = this->topic_sync = 0; - this->ci = cs_findchan(this->name); + this->ci = cs_findchan(this->name.c_str()); if (this->ci) { this->ci->c = this; @@ -75,7 +74,7 @@ Channel::~Channel() FOREACH_MOD(I_OnChannelDelete, OnChannelDelete(this)); if (debug) - alog("debug: Deleting channel %s", this->name); + alog("debug: Deleting channel %s", this->name.c_str()); for (bd = this->bd; bd; bd = next) { @@ -148,7 +147,7 @@ void Channel::SetModeInternal(ChannelMode *cm, const std::string ¶m, bool En { if (param.empty()) { - alog("Channel::SetModeInternal() mode %c with no parameter for channel %s", cm->ModeChar, this->name); + alog("Channel::SetModeInternal() mode %c with no parameter for channel %s", cm->ModeChar, this->name.c_str()); return; } @@ -160,12 +159,12 @@ void Channel::SetModeInternal(ChannelMode *cm, const std::string ¶m, bool En if (!u) { if (debug) - alog("debug: MODE %s +%c for nonexistant user %s", this->name, cm->ModeChar, param.c_str()); + alog("debug: MODE %s +%c for nonexistant user %s", this->name.c_str(), cm->ModeChar, param.c_str()); return; } if (debug) - alog("debug: Setting +%c on %s for %s", cm->ModeChar, this->name, u->nick); + alog("debug: Setting +%c on %s for %s", cm->ModeChar, this->name.c_str(), u->nick.c_str()); ChannelModeStatus *cms = dynamic_cast<ChannelModeStatus *>(cm); /* Set the new status on the user */ @@ -179,7 +178,7 @@ void Channel::SetModeInternal(ChannelMode *cm, const std::string ¶m, bool En { if (param.empty()) { - alog("Channel::SetModeInternal() mode %c with no parameter for channel %s", cm->ModeChar, this->name); + alog("Channel::SetModeInternal() mode %c with no parameter for channel %s", cm->ModeChar, this->name.c_str()); return; } @@ -194,7 +193,7 @@ void Channel::SetModeInternal(ChannelMode *cm, const std::string ¶m, bool En { if (cm->Type != MODE_PARAM) { - alog("Channel::SetModeInternal() mode %c for %s with a paramater, but its not a param mode", cm->ModeChar, this->name); + alog("Channel::SetModeInternal() mode %c for %s with a paramater, but its not a param mode", cm->ModeChar, this->name.c_str()); return; } @@ -280,7 +279,7 @@ void Channel::RemoveModeInternal(ChannelMode *cm, const std::string ¶m, bool { if (param.empty()) { - alog("Channel::RemoveModeInternal() mode %c with no parameter for channel %s", cm->ModeChar, this->name); + alog("Channel::RemoveModeInternal() mode %c with no parameter for channel %s", cm->ModeChar, this->name.c_str()); return; } @@ -291,12 +290,12 @@ void Channel::RemoveModeInternal(ChannelMode *cm, const std::string ¶m, bool User *u = finduser(param); if (!u) { - alog("Channel::RemoveModeInternal() MODE %s +%c for nonexistant user %s", this->name, cm->ModeChar, param.c_str()); + alog("Channel::RemoveModeInternal() MODE %s +%c for nonexistant user %s", this->name.c_str(), cm->ModeChar, param.c_str()); return; } if (debug) - alog("debug: Setting +%c on %s for %s", cm->ModeChar, this->name, u->nick); + alog("debug: Setting +%c on %s for %s", cm->ModeChar, this->name.c_str(), u->nick.c_str()); ChannelModeStatus *cms = dynamic_cast<ChannelModeStatus *>(cm); chan_remove_user_status(this, u, cms->Status); @@ -307,7 +306,7 @@ void Channel::RemoveModeInternal(ChannelMode *cm, const std::string ¶m, bool { if (param.empty()) { - alog("Channel::RemoveModeInternal() mode %c with no parameter for channel %s", cm->ModeChar, this->name); + alog("Channel::RemoveModeInternal() mode %c with no parameter for channel %s", cm->ModeChar, this->name.c_str()); return; } @@ -859,7 +858,7 @@ void chan_remove_user_status(Channel * chan, User * user, int16 status) if (debug >= 2) alog("debug: removing user status (%d) from %s for %s", status, - user->nick, chan->name); + user->nick.c_str(), chan->name.c_str()); for (uc = user->chans; uc; uc = uc->next) { if (uc->chan == chan) { @@ -880,14 +879,14 @@ void chan_set_user_status(Channel * chan, User * user, int16 status) if (debug >= 2) alog("debug: setting user status (%d) on %s for %s", status, - user->nick, chan->name); + user->nick.c_str(), chan->name.c_str()); if (Config.HelpChannel && ((um = ModeManager::FindUserModeByName(UMODE_HELPOP))) && (status & CUS_OP) - && (stricmp(chan->name, Config.HelpChannel) == 0) + && (stricmp(chan->name.c_str(), Config.HelpChannel) == 0) && (!chan->ci || check_access(user, chan->ci, CA_AUTOOP))) { if (debug) { alog("debug: %s being given helpop for having %d status in %s", - user->nick, status, chan->name); + user->nick.c_str(), status, chan->name.c_str()); } user->SetMode(NULL, um); @@ -922,7 +921,7 @@ Channel *findchan(const char *chan) alog("debug: findchan(%p)", chan); c = chanlist[HASH(chan)]; while (c) { - if (stricmp(c->name, chan) == 0) { + if (stricmp(c->name.c_str(), chan) == 0) { if (debug >= 3) alog("debug: findchan(%s) -> %p", chan, static_cast<void *>(c)); return c; @@ -950,7 +949,7 @@ Channel *firstchan() current = chanlist[next_index++]; if (debug >= 3) alog("debug: firstchan() returning %s", - current ? current->name : "NULL (end of list)"); + current ? current->name.c_str() : "NULL (end of list)"); return current; } @@ -964,7 +963,7 @@ Channel *nextchan() } if (debug >= 3) alog("debug: nextchan() returning %s", - current ? current->name : "NULL (end of list)"); + current ? current->name.c_str() : "NULL (end of list)"); return current; } @@ -1093,7 +1092,7 @@ void do_join(const char *source, int ac, const char **av) c = user->chans; while (c) { nextc = c->next; - channame = sstrdup(c->chan->name); + channame = sstrdup(c->chan->name.c_str()); FOREACH_MOD(I_OnPrePartChannel, OnPrePartChannel(user, c->chan)); chan_deluser(user, c->chan); FOREACH_MOD(I_OnPartChannel, OnPartChannel(user, findchan(channame), channame, "")); @@ -1179,9 +1178,9 @@ void do_kick(const char *source, int ac, const char **av) continue; } if (debug) { - alog("debug: kicking %s from %s", user->nick, av[0]); + alog("debug: kicking %s from %s", user->nick.c_str(), av[0]); } - for (c = user->chans; c && stricmp(av[0], c->chan->name) != 0; + for (c = user->chans; c && stricmp(av[0], c->chan->name.c_str()) != 0; c = c->next); if (c) { @@ -1232,7 +1231,7 @@ void do_part(const char *source, int ac, const char **av) *t++ = 0; if (debug) alog("debug: %s leaves %s", source, s); - for (c = user->chans; c && stricmp(s, c->chan->name) != 0; + for (c = user->chans; c && stricmp(s, c->chan->name.c_str()) != 0; c = c->next); if (c) { if (!c->chan) { @@ -1457,14 +1456,14 @@ void do_sjoin(const char *source, int ac, const char **av) int i; for (i = 1; i < end2 - cubuf; i++) - modes[i] = user->nick; + modes[i] = user->nick.c_str(); ChanSetInternalModes(c, 1 + (end2 - cubuf - 1), modes); } if (c->ci && (!serv || is_sync(serv)) && !c->topic_sync) - restore_topic(c->name); + restore_topic(c->name.c_str()); chan_set_correct_modes(user, c, 1); FOREACH_MOD(I_OnJoinChannel, OnJoinChannel(user, c)); @@ -1543,7 +1542,7 @@ void do_sjoin(const char *source, int ac, const char **av) int i; for (i = 1; i < end2 - cubuf; i++) - modes[i] = user->nick; + modes[i] = user->nick.c_str(); ChanSetInternalModes(c, 1 + (end2 - cubuf - 1), modes); } @@ -1618,7 +1617,7 @@ void do_sjoin(const char *source, int ac, const char **av) int i; for (i = 1; i < end2 - cubuf; i++) - modes[i] = user->nick; + modes[i] = user->nick.c_str(); ChanSetInternalModes(c, 1 + (end2 - cubuf - 1), modes); } @@ -1664,7 +1663,7 @@ void do_sjoin(const char *source, int ac, const char **av) c = join_user_update(user, c, av[1], ts); if (is_created && c->ci) - restore_topic(c->name); + restore_topic(c->name.c_str()); chan_set_correct_modes(user, c, 1); FOREACH_MOD(I_OnJoinChannel, OnJoinChannel(user, c)); @@ -1791,7 +1790,7 @@ void do_topic(const char *source, int ac, const char **av) */ if ((ac > 3) && *av[3] && ci && ci->last_topic && (strcmp(av[3], ci->last_topic) == 0) - && (strcmp(topicsetter, ci->last_topic_setter) == 0)) { + && (strcmp(topicsetter, ci->last_topic_setter.c_str()) == 0)) { delete [] topicsetter; return; } @@ -1809,7 +1808,7 @@ void do_topic(const char *source, int ac, const char **av) c->topic = sstrdup(av[3]); } - strscpy(c->topic_setter, topicsetter, sizeof(c->topic_setter)); + c->topic_setter = topicsetter; c->topic_time = topic_time; delete [] topicsetter; @@ -1848,20 +1847,20 @@ void chan_set_correct_modes(User * user, Channel * c, int give_modes) if (!c || !(ci = c->ci)) return; - if ((ci->HasFlag(CI_FORBIDDEN)) || (*(c->name) == '+')) + if ((ci->HasFlag(CI_FORBIDDEN)) || (*(c->name.c_str()) == '+')) return; status = chan_get_user_status(c, user); if (debug) - alog("debug: Setting correct user modes for %s on %s (current status: %d, %sgiving modes)", user->nick, c->name, status, (give_modes ? "" : "not ")); + alog("debug: Setting correct user modes for %s on %s (current status: %d, %sgiving modes)", user->nick.c_str(), c->name.c_str(), status, (give_modes ? "" : "not ")); /* Changed the second line of this if a bit, to make sure unregistered * users can always get modes (IE: they always have autoop enabled). Before * this change, you were required to have a registered nick to be able * to receive modes. I wonder who added that... *looks at Rob* ;) -GD */ - if (give_modes && (get_ignore(user->nick) == NULL) + if (give_modes && (get_ignore(user->nick.c_str()) == NULL) && (!user->nc || !user->nc->HasFlag(NI_AUTOOP))) { if (owner && check_access(user, ci, CA_AUTOOWNER)) add_modes |= CUS_OWNER; @@ -1986,21 +1985,21 @@ void chan_adduser2(User * user, Channel * c) u->ud = NULL; c->usercount++; - if (get_ignore(user->nick) == NULL) { + if (get_ignore(user->nick.c_str()) == NULL) { if (c->ci && (check_access(user, c->ci, CA_MEMO)) && (c->ci->memos.memos.size() > 0)) { if (c->ci->memos.memos.size() == 1) { notice_lang(Config.s_MemoServ, user, MEMO_X_ONE_NOTICE, - c->ci->memos.memos.size(), c->ci->name); + c->ci->memos.memos.size(), c->ci->name.c_str()); } else { notice_lang(Config.s_MemoServ, user, MEMO_X_MANY_NOTICE, - c->ci->memos.memos.size(), c->ci->name); + c->ci->memos.memos.size(), c->ci->name.c_str()); } } /* Added channelname to entrymsg - 30.03.2004, Certus */ /* Also, don't send the entrymsg when bursting -GD */ if (c->ci && c->ci->entry_message && is_sync(user->server)) - user->SendMessage(whosends(c->ci)->nick, "[%s] %s", c->name, c->ci->entry_message); + user->SendMessage(whosends(c->ci)->nick, "[%s] %s", c->name.c_str(), c->ci->entry_message); } /** @@ -2025,7 +2024,7 @@ void chan_adduser2(User * user, Channel * c) * recovers from a netsplit. -GD */ if (is_sync(user->server)) { - ircdproto->SendPrivmsg(c->ci->bi, c->name, "[%s] %s", + ircdproto->SendPrivmsg(c->ci->bi, c->name.c_str(), "[%s] %s", user->nc->display, user->nc->greet); c->ci->bi->lastmsg = time(NULL); } @@ -2075,7 +2074,7 @@ Channel *join_user_update(User * user, Channel * chan, const char *name, } if (debug) - alog("debug: %s joins %s", user->nick, chan->name); + alog("debug: %s joins %s", user->nick.c_str(), chan->name.c_str()); c = new u_chanlist; c->prev = NULL; @@ -2118,7 +2117,7 @@ void restore_unsynced_topics() for (c = firstchan(); c; c = nextchan()) { if (!(c->topic_sync)) - restore_topic(c->name); + restore_topic(c->name.c_str()); } } @@ -2479,11 +2478,11 @@ Entry *elist_match_user(EList * list, User * u) ip = str_is_ip(host); /* Match what we ve got against the lists.. */ - res = elist_match(list, u->nick, u->GetIdent().c_str(), u->host, ip); + res = elist_match(list, u->nick.c_str(), u->GetIdent().c_str(), u->host, ip); if (!res) - res = elist_match(list, u->nick, u->GetIdent().c_str(), u->GetDisplayedHost().c_str(), ip); + res = elist_match(list, u->nick.c_str(), u->GetIdent().c_str(), u->GetDisplayedHost().c_str(), ip); if (!res && !u->GetCloakedHost().empty() && u->GetCloakedHost() != u->GetDisplayedHost()) - res = elist_match(list, u->nick, u->GetIdent().c_str(), u->GetCloakedHost().c_str(), ip); + res = elist_match(list, u->nick.c_str(), u->GetIdent().c_str(), u->GetCloakedHost().c_str(), ip); if (host) delete [] host; diff --git a/src/chanserv.c b/src/chanserv.c index c0f8ac9bb..a9ab953fc 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -296,7 +296,7 @@ void chanserv(User * u, char *buf) if (!(s = strtok(NULL, ""))) { *s = 0; } - ircdproto->SendCTCP(findbot(Config.s_ChanServ), u->nick, "PING %s", s); + ircdproto->SendCTCP(findbot(Config.s_ChanServ), u->nick.c_str(), "PING %s", s); } else { mod_run_cmd(Config.s_ChanServ, u, CHANSERV, cmd); } @@ -330,8 +330,8 @@ void check_modes(Channel *c) /* Check for mode bouncing */ if (c->server_modecount >= 3 && c->chanserv_modecount >= 3) { - ircdproto->SendGlobops(NULL, "Warning: unable to set modes on channel %s. Are your servers' U:lines configured correctly?", c->name); - alog("%s: Bouncy modes on channel %s", Config.s_ChanServ, c->name); + ircdproto->SendGlobops(NULL, "Warning: unable to set modes on channel %s. Are your servers' U:lines configured correctly?", c->name.c_str()); + alog("%s: Bouncy modes on channel %s", Config.s_ChanServ, c->name.c_str()); c->bouncy_modes = 1; return; } @@ -669,7 +669,7 @@ int check_kick(User * user, const char *chan, time_t chants) && match_usermask(akick->mask.c_str(), user))) { if (debug >= 2) - alog("debug: %s matched akick %s", user->nick, akick->HasFlag(AK_ISNICK) ? akick->nc->display : akick->mask.c_str()); + alog("debug: %s matched akick %s", user->nick.c_str(), akick->HasFlag(AK_ISNICK) ? akick->nc->display : akick->mask.c_str()); if (akick->HasFlag(AK_ISNICK)) get_idealban(ci, user, mask, sizeof(mask)); else @@ -690,7 +690,7 @@ int check_kick(User * user, const char *chan, time_t chants) kick: if (debug) - alog("debug: channel: AutoKicking %s!%s@%s from %s", user->nick, + alog("debug: channel: AutoKicking %s!%s@%s from %s", user->nick.c_str(), user->GetIdent().c_str(), user->host, chan); /* Remember that the user has not been added to our channel user list @@ -750,7 +750,7 @@ void record_topic(const char *chan) else ci->last_topic = NULL; - strscpy(ci->last_topic_setter, c->topic_setter, NICKMAX); + ci->last_topic_setter = c->topic_setter; ci->last_topic_time = c->topic_time; } @@ -772,7 +772,7 @@ void restore_topic(const char *chan) * should be updated with a TOPIC from the IRCd soon. -GD */ ci->last_topic = NULL; - strscpy(ci->last_topic_setter, whosends(ci)->nick, NICKMAX); + ci->last_topic_setter = whosends(ci)->nick; ci->last_topic_time = time(NULL); return; } @@ -780,11 +780,11 @@ void restore_topic(const char *chan) delete [] c->topic; if (ci->last_topic) { c->topic = sstrdup(ci->last_topic); - strscpy(c->topic_setter, ci->last_topic_setter, NICKMAX); + c->topic_setter = ci->last_topic_setter; c->topic_time = ci->last_topic_time; } else { c->topic = NULL; - strscpy(c->topic_setter, whosends(ci)->nick, NICKMAX); + c->topic_setter = whosends(ci)->nick; } if (ircd->join2set) { if (whosends(ci) == findbot(Config.s_ChanServ)) { @@ -792,7 +792,7 @@ void restore_topic(const char *chan) c->SetMode(NULL, CMODE_OP, Config.s_ChanServ); } } - ircdproto->SendTopic(whosends(ci), c, c->topic_setter, c->topic ? c->topic : ""); + ircdproto->SendTopic(whosends(ci), c, c->topic_setter.c_str(), c->topic ? c->topic : ""); if (ircd->join2set) { if (whosends(ci) == findbot(Config.s_ChanServ)) { ircdproto->SendPart(findbot(Config.s_ChanServ), c, NULL); @@ -823,12 +823,12 @@ int check_topiclock(Channel * c, time_t topic_time) delete [] c->topic; if (ci->last_topic) { c->topic = sstrdup(ci->last_topic); - strscpy(c->topic_setter, ci->last_topic_setter, NICKMAX); + c->topic_setter = ci->last_topic_setter; } else { c->topic = NULL; /* Bot assigned & Symbiosis ON?, the bot will set the topic - doc */ /* Altough whosends() also checks for Config.BSMinUsers -GD */ - strscpy(c->topic_setter, whosends(ci)->nick, NICKMAX); + c->topic_setter = whosends(ci)->nick; } if (ircd->topictsforward) { @@ -849,12 +849,12 @@ int check_topiclock(Channel * c, time_t topic_time) if (ircd->join2set) { if (whosends(ci) == findbot(Config.s_ChanServ)) { - ircdproto->SendJoin(findbot(Config.s_ChanServ), c->name, c->creation_time); + ircdproto->SendJoin(findbot(Config.s_ChanServ), c->name.c_str(), c->creation_time); c->SetMode(NULL, CMODE_OP, Config.s_ChanServ); } } - ircdproto->SendTopic(whosends(ci), c, c->topic_setter, c->topic ? c->topic : ""); + ircdproto->SendTopic(whosends(ci), c, c->topic_setter.c_str(), c->topic ? c->topic : ""); if (ircd->join2set) { if (whosends(ci) == findbot(Config.s_ChanServ)) { @@ -887,8 +887,8 @@ void expire_chans() if (MOD_RESULT == EVENT_STOP) continue; - char *chname = sstrdup(ci->name); - alog("Expiring channel %s (founder: %s)", ci->name, + char *chname = sstrdup(ci->name.c_str()); + alog("Expiring channel %s (founder: %s)", ci->name.c_str(), (ci->founder ? ci->founder->display : "(none)")); delete ci; FOREACH_MOD(I_OnChanExpire, OnChanExpire(chname)); @@ -916,17 +916,17 @@ void cs_remove_nick(const NickCore * nc) if (ci->successor) { NickCore *nc2 = ci->successor; if (!nc2->IsServicesOper() && Config.CSMaxReg && nc2->channelcount >= Config.CSMaxReg) { - alog("%s: Successor (%s) of %s owns too many channels, " "deleting channel", Config.s_ChanServ, nc2->display, ci->name); + alog("%s: Successor (%s) of %s owns too many channels, " "deleting channel", Config.s_ChanServ, nc2->display, ci->name.c_str()); delete ci; continue; } else { - alog("%s: Transferring foundership of %s from deleted " "nick %s to successor %s", Config.s_ChanServ, ci->name, nc->display, nc2->display); + alog("%s: Transferring foundership of %s from deleted " "nick %s to successor %s", Config.s_ChanServ, ci->name.c_str(), nc->display, nc2->display); ci->founder = nc2; ci->successor = NULL; nc2->channelcount++; } } else { - alog("%s: Deleting channel %s owned by deleted nick %s", Config.s_ChanServ, ci->name, nc->display); + alog("%s: Deleting channel %s owned by deleted nick %s", Config.s_ChanServ, ci->name.c_str(), nc->display); if ((ModeManager::FindChannelModeByName(CMODE_REGISTERED))) { @@ -981,7 +981,7 @@ ChannelInfo *cs_findchan(const char *chan) for (ci = chanlists[static_cast<unsigned char>(tolower(chan[1]))]; ci; ci = ci->next) { - if (stricmp(ci->name, chan) == 0) + if (stricmp(ci->name.c_str(), chan) == 0) return ci; } return NULL; @@ -1035,7 +1035,6 @@ int check_access(User * user, ChannelInfo * ci, int what) void alpha_insert_chan(ChannelInfo * ci) { ChannelInfo *ptr, *prev; - char *chan; if (!ci) { if (debug) { @@ -1044,10 +1043,10 @@ void alpha_insert_chan(ChannelInfo * ci) return; } - chan = ci->name; + const char *chan = ci->name.c_str(); for (prev = NULL, ptr = chanlists[static_cast<unsigned char>(tolower(chan[1]))]; - ptr != NULL && stricmp(ptr->name, chan) < 0; + ptr != NULL && stricmp(ptr->name.c_str(), chan) < 0; prev = ptr, ptr = ptr->next); ci->prev = prev; ci->next = ptr; diff --git a/src/commands.c b/src/commands.c index 0bbf23ba6..553bc2442 100644 --- a/src/commands.c +++ b/src/commands.c @@ -71,7 +71,7 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char * if (!nick_identified(u)) { notice_lang(service, u, NICK_IDENTIFY_REQUIRED, Config.s_NickServ); - alog("Access denied for unregistered user %s with service %s and command %s", u->nick, service, cmd); + alog("Access denied for unregistered user %s with service %s and command %s", u->nick.c_str(), service, cmd); return; } } @@ -120,16 +120,16 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char * { if ((ci->HasFlag(CI_FORBIDDEN)) && (!c->HasFlag(CFLAG_ALLOW_FORBIDDEN))) { - notice_lang(service, u, CHAN_X_FORBIDDEN, ci->name); + notice_lang(service, u, CHAN_X_FORBIDDEN, ci->name.c_str()); alog("Access denied for user %s with service %s and command %s because of FORBIDDEN channel %s", - u->nick, service, cmd, ci->name); + u->nick.c_str(), service, cmd, ci->name.c_str()); return; } else if ((ci->HasFlag(CI_SUSPENDED)) && (!c->HasFlag(CFLAG_ALLOW_SUSPENDED))) { - notice_lang(service, u, CHAN_X_FORBIDDEN, ci->name); + notice_lang(service, u, CHAN_X_FORBIDDEN, ci->name.c_str()); alog("Access denied for user %s with service %s and command %s because of SUSPENDED channel %s", - u->nick, service, cmd, ci->name); + u->nick.c_str(), service, cmd, ci->name.c_str()); return; } } @@ -153,7 +153,7 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char * if (!u->nc->HasCommand(c->permission)) { notice_lang(service, u, ACCESS_DENIED); - alog("Access denied for user %s with service %s and command %s", u->nick, service, cmd); + alog("Access denied for user %s with service %s and command %s", u->nick.c_str(), service, cmd); return; } diff --git a/src/config.c b/src/config.c index 85eeed357..07001aea9 100644 --- a/src/config.c +++ b/src/config.c @@ -314,12 +314,12 @@ bool ValidateNickLen(ServerConfig *, const char *, const char *, ValueItem &data { alog("You have not defined the <networkinfo:nicklen> directive. It is strongly"); alog("adviced that you do configure this correctly in your services.conf"); - data.Set(NICKMAX - 1); + data.Set(31); } - else if (nicklen < 1 || nicklen >= NICKMAX) + else if (nicklen < 1) { - alog("<networkinfo:nicklen> has an invalid value; setting to %d", NICKMAX - 1); - data.Set(NICKMAX - 1); + alog("<networkinfo:nicklen> has an invalid value; setting to %d", 31); + data.Set(31); } return true; } diff --git a/src/core/bs_act.c b/src/core/bs_act.c index e321c37a9..a22748515 100644 --- a/src/core/bs_act.c +++ b/src/core/bs_act.c @@ -41,7 +41,7 @@ class CommandBSAct : public Command if (!ci->c || ci->c->usercount < Config.BSMinUsers) { - notice_lang(Config.s_BotServ, u, BOT_NOT_ON_CHANNEL, ci->name); + notice_lang(Config.s_BotServ, u, BOT_NOT_ON_CHANNEL, ci->name.c_str()); return MOD_CONT; } @@ -49,10 +49,10 @@ class CommandBSAct : public Command while ((i = message.find_first_of("\001"), i) && i != std::string::npos) message.erase(i, 1); - ircdproto->SendAction(ci->bi, ci->name, "%s", message.c_str()); + ircdproto->SendAction(ci->bi, ci->name.c_str(), "%s", message.c_str()); ci->bi->lastmsg = time(NULL); if (Config.LogBot && Config.LogChannel && LogChan && !debug && findchan(Config.LogChannel)) - ircdproto->SendPrivmsg(ci->bi, Config.LogChannel, "ACT %s %s %s", u->nick, ci->name, message.c_str()); + ircdproto->SendPrivmsg(ci->bi, Config.LogChannel, "ACT %s %s %s", u->nick.c_str(), ci->name.c_str(), message.c_str()); return MOD_CONT; } diff --git a/src/core/bs_assign.c b/src/core/bs_assign.c index 30b7ef647..56912559e 100644 --- a/src/core/bs_assign.c +++ b/src/core/bs_assign.c @@ -62,7 +62,7 @@ class CommandBSAssign : public Command } bi->Assign(u, ci); - notice_lang(Config.s_BotServ, u, BOT_ASSIGN_ASSIGNED, bi->nick, ci->name); + notice_lang(Config.s_BotServ, u, BOT_ASSIGN_ASSIGNED, bi->nick, ci->name.c_str()); return MOD_CONT; } diff --git a/src/core/bs_badwords.c b/src/core/bs_badwords.c index 06f4eedd0..89de294b8 100644 --- a/src/core/bs_badwords.c +++ b/src/core/bs_badwords.c @@ -28,7 +28,7 @@ class CommandBSBadwords : public Command if (!ci->GetBadWordCount()) { - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_LIST_EMPTY, ci->name); + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_LIST_EMPTY, ci->name.c_str()); return MOD_CONT; } if (!word.empty() && strspn(word.c_str(), "1234567890,-") == word.length()) @@ -48,7 +48,7 @@ class CommandBSBadwords : public Command } } if (!sent_header) - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_NO_MATCH, ci->name); + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_NO_MATCH, ci->name.c_str()); return MOD_CONT; } @@ -87,14 +87,14 @@ class CommandBSBadwords : public Command if (!bw->word.empty() && (Config.BSCaseSensitive && !stricmp(bw->word.c_str(), realword.c_str()) || (!Config.BSCaseSensitive && bw->word == realword.c_str()))) { - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_ALREADY_EXISTS, bw->word.c_str(), ci->name); + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_ALREADY_EXISTS, bw->word.c_str(), ci->name.c_str()); return MOD_CONT; } } ci->AddBadWord(realword.c_str(), type); - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_ADDED, realword.c_str(), ci->name); + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_ADDED, realword.c_str(), ci->name.c_str()); return MOD_CONT; } @@ -111,20 +111,20 @@ class CommandBSBadwords : public Command { if (count == 1) { - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_NO_SUCH_ENTRY, last, ci->name); + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_NO_SUCH_ENTRY, last, ci->name.c_str()); } else { - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_NO_MATCH, ci->name); + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_NO_MATCH, ci->name.c_str()); } } else if (deleted == 1) { - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_DELETED_ONE, ci->name); + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_DELETED_ONE, ci->name.c_str()); } else { - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_DELETED_SEVERAL, deleted, ci->name); + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_DELETED_SEVERAL, deleted, ci->name.c_str()); } if (deleted) @@ -145,13 +145,13 @@ class CommandBSBadwords : public Command if (i == ci->GetBadWordCount()) { - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_NOT_FOUND, word.c_str(), ci->name); + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_NOT_FOUND, word.c_str(), ci->name.c_str()); return MOD_CONT; } ci->EraseBadWord(badword); - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_DELETED, badword->word.c_str(), ci->name); + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_DELETED, badword->word.c_str(), ci->name.c_str()); } return MOD_CONT; @@ -261,7 +261,7 @@ int badwords_list(User * u, int index, ChannelInfo * ci, int *sent_header) if (!*sent_header) { - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_LIST_HEADER, ci->name); + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_LIST_HEADER, ci->name.c_str()); *sent_header = 1; } diff --git a/src/core/bs_bot.c b/src/core/bs_bot.c index 2c0195ee4..0d057849e 100644 --- a/src/core/bs_bot.c +++ b/src/core/bs_bot.c @@ -58,7 +58,7 @@ class CommandBSBot : public Command return MOD_CONT; } - for (ch = nick; *ch && (ch - nick) < NICKMAX; ch++) + for (ch = nick; *ch && (ch - nick) < Config.NickLen; ch++) { if (!isvalidnick(*ch)) { @@ -190,7 +190,7 @@ class CommandBSBot : public Command return MOD_CONT; } - for (ch = nick; *ch && (ch - nick) < NICKMAX; ch++) + for (ch = nick; *ch && (ch - nick) < Config.NickLen; ch++) { if (!isvalidnick(*ch)) { @@ -322,7 +322,7 @@ class CommandBSBot : public Command FOREACH_MOD(I_OnBotDelete, OnBotDelete(bi)); - ircdproto->SendQuit(bi, "Quit: Help! I'm being deleted by %s!", u->nick); + ircdproto->SendQuit(bi, "Quit: Help! I'm being deleted by %s!", u->nick.c_str()); ircdproto->SendSQLineDel(bi->nick); delete bi; diff --git a/src/core/bs_info.c b/src/core/bs_info.c index 2f2afb2d8..5cb89c673 100644 --- a/src/core/bs_info.c +++ b/src/core/bs_info.c @@ -30,14 +30,14 @@ class CommandBSInfo : public Command for (i = 0; i < 256; i++) { for (ci = chanlists[i]; ci; ci = ci->next) { if (ci->bi == bi) { - if (strlen(buf) + strlen(ci->name) > 300) { + if (strlen(buf) + strlen(ci->name.c_str()) > 300) { u->SendMessage(Config.s_BotServ, "%s", buf); *buf = 0; end = buf; } end += snprintf(end, sizeof(buf) - (end - buf), " %s ", - ci->name); + ci->name.c_str()); } } } @@ -86,7 +86,7 @@ class CommandBSInfo : public Command return MOD_CONT; } - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_HEADER, ci->name); + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_HEADER, ci->name.c_str()); if (ci->bi) notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_BOT, ci->bi->nick); else diff --git a/src/core/bs_say.c b/src/core/bs_say.c index 7143da298..c1021c79d 100644 --- a/src/core/bs_say.c +++ b/src/core/bs_say.c @@ -45,7 +45,7 @@ class CommandBSSay : public Command if (!ci->c || ci->c->usercount < Config.BSMinUsers) { - notice_lang(Config.s_BotServ, u, BOT_NOT_ON_CHANNEL, ci->name); + notice_lang(Config.s_BotServ, u, BOT_NOT_ON_CHANNEL, ci->name.c_str()); return MOD_CONT; } @@ -55,10 +55,10 @@ class CommandBSSay : public Command return MOD_CONT; } - ircdproto->SendPrivmsg(ci->bi, ci->name, "%s", text); + ircdproto->SendPrivmsg(ci->bi, ci->name.c_str(), "%s", text); ci->bi->lastmsg = time(NULL); if (Config.LogBot && Config.LogChannel && LogChan && !debug && findchan(Config.LogChannel)) - ircdproto->SendPrivmsg(ci->bi, Config.LogChannel, "SAY %s %s %s", u->nick, ci->name, text); + ircdproto->SendPrivmsg(ci->bi, Config.LogChannel, "SAY %s %s %s", u->nick.c_str(), ci->name.c_str(), text); return MOD_CONT; } diff --git a/src/core/bs_set.c b/src/core/bs_set.c index 91c69122b..deffc5833 100644 --- a/src/core/bs_set.c +++ b/src/core/bs_set.c @@ -70,11 +70,11 @@ class CommandBSSet : public Command if (value == "ON") { ci->botflags.SetFlag(BS_DONTKICKOPS); notice_lang(Config.s_BotServ, u, BOT_SET_DONTKICKOPS_ON, - ci->name); + ci->name.c_str()); } else if (value == "OFF") { ci->botflags.UnsetFlag(BS_DONTKICKOPS); notice_lang(Config.s_BotServ, u, BOT_SET_DONTKICKOPS_OFF, - ci->name); + ci->name.c_str()); } else { syntax_error(Config.s_BotServ, u, "SET DONTKICKOPS", BOT_SET_DONTKICKOPS_SYNTAX); @@ -83,11 +83,11 @@ class CommandBSSet : public Command if (value == "ON") { ci->botflags.SetFlag(BS_DONTKICKVOICES); notice_lang(Config.s_BotServ, u, BOT_SET_DONTKICKVOICES_ON, - ci->name); + ci->name.c_str()); } else if (value == "OFF") { ci->botflags.UnsetFlag(BS_DONTKICKVOICES); notice_lang(Config.s_BotServ, u, BOT_SET_DONTKICKVOICES_OFF, - ci->name); + ci->name.c_str()); } else { syntax_error(Config.s_BotServ, u, "SET DONTKICKVOICES", BOT_SET_DONTKICKVOICES_SYNTAX); @@ -95,10 +95,10 @@ class CommandBSSet : public Command } else if (option == "FANTASY") { if (value == "ON") { ci->botflags.SetFlag(BS_FANTASY); - notice_lang(Config.s_BotServ, u, BOT_SET_FANTASY_ON, ci->name); + notice_lang(Config.s_BotServ, u, BOT_SET_FANTASY_ON, ci->name.c_str()); } else if (value == "OFF") { ci->botflags.UnsetFlag(BS_FANTASY); - notice_lang(Config.s_BotServ, u, BOT_SET_FANTASY_OFF, ci->name); + notice_lang(Config.s_BotServ, u, BOT_SET_FANTASY_OFF, ci->name.c_str()); } else { syntax_error(Config.s_BotServ, u, "SET FANTASY", BOT_SET_FANTASY_SYNTAX); @@ -106,10 +106,10 @@ class CommandBSSet : public Command } else if (option == "GREET") { if (value == "ON") { ci->botflags.SetFlag(BS_GREET); - notice_lang(Config.s_BotServ, u, BOT_SET_GREET_ON, ci->name); + notice_lang(Config.s_BotServ, u, BOT_SET_GREET_ON, ci->name.c_str()); } else if (value == "OFF") { ci->botflags.UnsetFlag(BS_GREET); - notice_lang(Config.s_BotServ, u, BOT_SET_GREET_OFF, ci->name); + notice_lang(Config.s_BotServ, u, BOT_SET_GREET_OFF, ci->name.c_str()); } else { syntax_error(Config.s_BotServ, u, "SET GREET", BOT_SET_GREET_SYNTAX); @@ -119,10 +119,10 @@ class CommandBSSet : public Command ci->botflags.SetFlag(BS_NOBOT); if (ci->bi) ci->bi->UnAssign(u, ci); - notice_lang(Config.s_BotServ, u, BOT_SET_NOBOT_ON, ci->name); + notice_lang(Config.s_BotServ, u, BOT_SET_NOBOT_ON, ci->name.c_str()); } else if (value == "OFF") { ci->botflags.UnsetFlag(BS_NOBOT); - notice_lang(Config.s_BotServ, u, BOT_SET_NOBOT_OFF, ci->name); + notice_lang(Config.s_BotServ, u, BOT_SET_NOBOT_OFF, ci->name.c_str()); } else { syntax_error(Config.s_BotServ, u, "SET NOBOT", BOT_SET_NOBOT_SYNTAX); @@ -130,10 +130,10 @@ class CommandBSSet : public Command } else if (option == "SYMBIOSIS") { if (value == "ON") { ci->botflags.SetFlag(BS_SYMBIOSIS); - notice_lang(Config.s_BotServ, u, BOT_SET_SYMBIOSIS_ON, ci->name); + notice_lang(Config.s_BotServ, u, BOT_SET_SYMBIOSIS_ON, ci->name.c_str()); } else if (value == "OFF") { ci->botflags.UnsetFlag(BS_SYMBIOSIS); - notice_lang(Config.s_BotServ, u, BOT_SET_SYMBIOSIS_OFF, ci->name); + notice_lang(Config.s_BotServ, u, BOT_SET_SYMBIOSIS_OFF, ci->name.c_str()); } else { syntax_error(Config.s_BotServ, u, "SET SYMBIOSIS", BOT_SET_SYMBIOSIS_SYNTAX); diff --git a/src/core/bs_unassign.c b/src/core/bs_unassign.c index fcd2ee8f1..1d421fc5d 100644 --- a/src/core/bs_unassign.c +++ b/src/core/bs_unassign.c @@ -39,7 +39,7 @@ class CommandBSUnassign : public Command else { ci->bi->UnAssign(u, ci); - notice_lang(Config.s_BotServ, u, BOT_UNASSIGN_UNASSIGNED, ci->name); + notice_lang(Config.s_BotServ, u, BOT_UNASSIGN_UNASSIGNED, ci->name.c_str()); } return MOD_CONT; } diff --git a/src/core/cs_access.c b/src/core/cs_access.c index 5f875b1c9..1b9db83b9 100644 --- a/src/core/cs_access.c +++ b/src/core/cs_access.c @@ -57,7 +57,7 @@ static int access_list(User * u, int index, ChannelInfo * ci, int *sent_header) if (!*sent_header) { - notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_LIST_HEADER, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_LIST_HEADER, ci->name.c_str()); *sent_header = 1; } @@ -92,7 +92,7 @@ static int access_view(User *u, int index, ChannelInfo *ci, int *sent_header) if (!*sent_header) { - notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_LIST_HEADER, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_LIST_HEADER, ci->name.c_str()); *sent_header = 1; } @@ -227,7 +227,7 @@ 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, u->GetIdent().c_str(), u->host, ulev, access->level, na->nick, nc->display, ci->name); + 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()); notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_LEVEL_CHANGED, nc->display, chan, level); return MOD_CONT; } @@ -243,8 +243,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, u->GetIdent().c_str(), u->host, ulev, level, na->nick, nc->display, ci->name); - notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_ADDED, nc->display, ci->name, 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()); + notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_ADDED, nc->display, ci->name.c_str(), level); } else if (cmd == "DEL") { @@ -273,18 +273,18 @@ class CommandCSAccess : public Command else if (count == 1) { last = atoi(nick); - notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_NO_SUCH_ENTRY, last, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_NO_SUCH_ENTRY, last, ci->name.c_str()); } else - notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_NO_MATCH, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_NO_MATCH, ci->name.c_str()); } else { - alog("%s: %s!%s@%s (level %d) deleted access of user%s %s on %s", Config.s_ChanServ, u->nick, u->GetIdent().c_str(), u->host, get_access(u, ci), deleted == 1 ? "" : "s", nick, chan); + 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); if (deleted == 1) - notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_DELETED_ONE, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_DELETED_ONE, ci->name.c_str()); else - notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_DELETED_SEVERAL, deleted, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_DELETED_SEVERAL, deleted, ci->name.c_str()); } } else @@ -309,8 +309,8 @@ class CommandCSAccess : public Command } else { - notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_DELETED, access->nc->display, ci->name); - alog("%s: %s!%s@%s (level %d) deleted access of %s (group %s) on %s", Config.s_ChanServ, u->nick, u->GetIdent().c_str(), u->host, get_access(u, ci), na->nick, access->nc->display, chan); + 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); access->nc = NULL; access->in_use = 0; deleted = 1; @@ -356,7 +356,7 @@ class CommandCSAccess : public Command if (!sent_header) notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_NO_MATCH, chan); else - notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_LIST_FOOTER, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_LIST_FOOTER, ci->name.c_str()); } else if (cmd == "VIEW") { @@ -382,7 +382,7 @@ class CommandCSAccess : public Command if (!sent_header) notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_NO_MATCH, chan); else - notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_LIST_FOOTER, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_LIST_FOOTER, ci->name.c_str()); } else if (cmd == "CLEAR") { @@ -402,9 +402,9 @@ class CommandCSAccess : public Command FOREACH_MOD(I_OnAccessClear, OnAccessClear(ci, u)); - notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_CLEAR, ci->name); + 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, u->GetIdent().c_str(), u->host, + Config.s_ChanServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, get_access(u, ci), chan); } @@ -474,8 +474,8 @@ class CommandCSLevels : public Command ci->levels[levelinfo[i].what] = level; alog("%s: %s!%s@%s set level %s on channel %s to %d", - Config.s_ChanServ, u->nick, u->GetIdent().c_str(), u->host, - levelinfo[i].name, ci->name, level); + Config.s_ChanServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, + levelinfo[i].name, ci->name.c_str(), level); notice_lang(Config.s_ChanServ, u, CHAN_LEVELS_CHANGED, levelinfo[i].name, chan, level); return MOD_CONT; @@ -490,8 +490,8 @@ class CommandCSLevels : public Command ci->levels[levelinfo[i].what] = ACCESS_INVALID; alog("%s: %s!%s@%s disabled level %s on channel %s", - Config.s_ChanServ, u->nick, u->GetIdent().c_str(), u->host, - levelinfo[i].name, ci->name); + Config.s_ChanServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, + levelinfo[i].name, ci->name.c_str()); notice_lang(Config.s_ChanServ, u, CHAN_LEVELS_DISABLED, levelinfo[i].name, chan); return MOD_CONT; @@ -537,7 +537,7 @@ class CommandCSLevels : public Command reset_levels(ci); alog("%s: %s!%s@%s reset levels definitions on channel %s", - Config.s_ChanServ, u->nick, u->GetIdent().c_str(), u->host, ci->name); + Config.s_ChanServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, ci->name.c_str()); notice_lang(Config.s_ChanServ, u, CHAN_LEVELS_RESET, chan); } else { this->OnSyntaxError(u, ""); diff --git a/src/core/cs_akick.c b/src/core/cs_akick.c index fcc335cb8..625e226c6 100644 --- a/src/core/cs_akick.c +++ b/src/core/cs_akick.c @@ -68,7 +68,7 @@ int akick_list(User * u, int index, ChannelInfo * ci, int *sent_header) if (!akick->InUse) return 0; if (!*sent_header) { - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_LIST_HEADER, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_LIST_HEADER, ci->name.c_str()); *sent_header = 1; } @@ -98,7 +98,7 @@ int akick_view(User * u, int index, ChannelInfo * ci, int *sent_header) if (!akick->InUse) return 0; if (!*sent_header) { - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_LIST_HEADER, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_LIST_HEADER, ci->name.c_str()); *sent_header = 1; } @@ -174,7 +174,7 @@ class CommandCSAKick : public Command { if (is_excepted_mask(ci, mask.c_str())) { - notice_lang(Config.s_ChanServ, u, CHAN_EXCEPTED, mask.c_str(), ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_EXCEPTED, mask.c_str(), ci->name.c_str()); return; } } @@ -239,7 +239,7 @@ class CommandCSAKick : public Command continue; if ((akick->HasFlag(AK_ISNICK)) ? akick->nc == nc : akick->mask == mask) { - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_ALREADY_EXISTS, (akick->HasFlag(AK_ISNICK)) ? akick->nc->display : akick->mask.c_str(), ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_ALREADY_EXISTS, (akick->HasFlag(AK_ISNICK)) ? akick->nc->display : akick->mask.c_str(), ci->name.c_str()); return; } } @@ -256,7 +256,7 @@ class CommandCSAKick : public Command else akick = ci->AddAkick(u->nick, mask.c_str(), !reason.empty() ? reason.c_str() : ""); - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_ADDED, mask.c_str(), ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_ADDED, mask.c_str(), ci->name.c_str()); this->DoEnforce(u, ci, params); } @@ -271,7 +271,7 @@ class CommandCSAKick : public Command if (!ci->GetAkickCount()) { - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_LIST_EMPTY, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_LIST_EMPTY, ci->name.c_str()); return; } @@ -290,12 +290,12 @@ class CommandCSAKick : public Command if (i == ci->GetAkickCount()) { - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_NOT_FOUND, mask.c_str(), ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_NOT_FOUND, mask.c_str(), ci->name.c_str()); return; } akick->SetFlag(AK_STUCK); - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_STUCK, akick->mask.c_str(), ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_STUCK, akick->mask.c_str(), ci->name.c_str()); if (ci->c) stick_mask(ci, akick); @@ -311,7 +311,7 @@ class CommandCSAKick : public Command if (!ci->GetAkickCount()) { - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_LIST_EMPTY, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_LIST_EMPTY, ci->name.c_str()); return; } @@ -330,12 +330,12 @@ class CommandCSAKick : public Command if (i == ci->GetAkickCount()) { - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_NOT_FOUND, mask.c_str(), ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_NOT_FOUND, mask.c_str(), ci->name.c_str()); return; } akick->UnsetFlag(AK_STUCK); - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_UNSTUCK, akick->mask.c_str(), ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_UNSTUCK, akick->mask.c_str(), ci->name.c_str()); } void DoDel(User *u, ChannelInfo *ci, const std::vector<ci::string> ¶ms) @@ -346,7 +346,7 @@ class CommandCSAKick : public Command if (!ci->GetAkickCount()) { - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_LIST_EMPTY, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_LIST_EMPTY, ci->name.c_str()); return; } @@ -360,14 +360,14 @@ class CommandCSAKick : public Command if (!deleted) { if (count == 1) - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_NO_SUCH_ENTRY, last, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_NO_SUCH_ENTRY, last, ci->name.c_str()); else - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_NO_MATCH, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_NO_MATCH, ci->name.c_str()); } else if (deleted == 1) - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_DELETED_ONE, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_DELETED_ONE, ci->name.c_str()); else - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_DELETED_SEVERAL, deleted, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_DELETED_SEVERAL, deleted, ci->name.c_str()); if (deleted) ci->CleanAkick(); } @@ -390,13 +390,13 @@ class CommandCSAKick : public Command if (i == ci->GetAkickCount()) { - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_NOT_FOUND, mask.c_str(), ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_NOT_FOUND, mask.c_str(), ci->name.c_str()); return; } ci->EraseAkick(akick); - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_DELETED, mask.c_str(), ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_DELETED, mask.c_str(), ci->name.c_str()); } } @@ -409,7 +409,7 @@ class CommandCSAKick : public Command if (!ci->GetAkickCount()) { - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_LIST_EMPTY, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_LIST_EMPTY, ci->name.c_str()); return; } @@ -435,7 +435,7 @@ class CommandCSAKick : public Command } if (!sent_header) - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_NO_MATCH, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_NO_MATCH, ci->name.c_str()); } @@ -448,7 +448,7 @@ class CommandCSAKick : public Command if (!ci->GetAkickCount()) { - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_LIST_EMPTY, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_LIST_EMPTY, ci->name.c_str()); return; } @@ -473,7 +473,7 @@ class CommandCSAKick : public Command } } if (!sent_header) - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_NO_MATCH, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_NO_MATCH, ci->name.c_str()); } @@ -486,7 +486,7 @@ class CommandCSAKick : public Command if (!c) { - notice_lang(Config.s_ChanServ, u, CHAN_X_NOT_IN_USE, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_X_NOT_IN_USE, ci->name.c_str()); return; } @@ -495,10 +495,10 @@ class CommandCSAKick : public Command while (cu) { unext = cu->next; - if (check_kick(cu->user, c->name, c->creation_time)) + if (check_kick(cu->user, c->name.c_str(), c->creation_time)) { - argv[0] = sstrdup(c->name); - argv[1] = sstrdup(cu->user->nick); + argv[0] = sstrdup(c->name.c_str()); + argv[1] = sstrdup(cu->user->nick.c_str()); argv[2] = sstrdup(Config.CSAutokickReason); do_kick(Config.s_ChanServ, 3, argv); @@ -511,13 +511,13 @@ class CommandCSAKick : public Command cu = unext; } - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_ENFORCE_DONE, ci->name, count); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_ENFORCE_DONE, ci->name.c_str(), count); } void DoClear(User *u, ChannelInfo *ci, const std::vector<ci::string> ¶ms) { ci->ClearAkick(); - notice_lang(Config.s_ChanServ, u, CHAN_AKICK_CLEAR, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_AKICK_CLEAR, ci->name.c_str()); } public: diff --git a/src/core/cs_ban.c b/src/core/cs_ban.c index 62d69724e..aaf36ac27 100644 --- a/src/core/cs_ban.c +++ b/src/core/cs_ban.c @@ -42,7 +42,7 @@ class CommandCSBan : public Command if (!reason) reason = "Requested"; - is_same = (stricmp(target, u->nick) == 0); + is_same = (stricmp(target, u->nick.c_str()) == 0); if (c) ci = c->ci; @@ -62,7 +62,7 @@ class CommandCSBan : public Command * to prevent services <-> server wars. */ } else if (ModeManager::FindChannelModeByName(CMODE_EXCEPT) && is_excepted(ci, u2)) { - notice_lang(Config.s_ChanServ, u, CHAN_EXCEPTED, u2->nick, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_EXCEPTED, u2->nick.c_str(), ci->name.c_str()); } else if (is_protected(u2)) { notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); } else { @@ -78,12 +78,12 @@ class CommandCSBan : public Command if ((ci->HasFlag(CI_SIGNKICK)) || ((ci->HasFlag(CI_SIGNKICK_LEVEL)) && !check_access(u, ci, CA_SIGNKICK))) - ircdproto->SendKick(whosends(ci), ci->c, u2, "%s (%s)", reason, u->nick); + ircdproto->SendKick(whosends(ci), ci->c, u2, "%s (%s)", reason, u->nick.c_str()); else ircdproto->SendKick(whosends(ci), ci->c, u2, "%s", reason); const char *kav[4]; - kav[0] = ci->name; + kav[0] = ci->name.c_str(); kav[1] = target; kav[2] = reason; do_kick(Config.s_ChanServ, 3, kav); diff --git a/src/core/cs_clear.c b/src/core/cs_clear.c index cc8208829..1de6ca1ff 100644 --- a/src/core/cs_clear.c +++ b/src/core/cs_clear.c @@ -152,12 +152,12 @@ class CommandCSClear : public Command struct c_userlist *cu, *bnext; char buf[256]; - snprintf(buf, sizeof(buf), "CLEAR USERS command from %s", u->nick); + snprintf(buf, sizeof(buf), "CLEAR USERS command from %s", u->nick.c_str()); for (cu = c->users; cu; cu = bnext) { bnext = cu->next; av[0] = sstrdup(chan); - av[1] = sstrdup(cu->user->nick); + av[1] = sstrdup(cu->user->nick.c_str()); av[2] = sstrdup(buf); ircdproto->SendKick(whosends(ci), c, cu->user, av[2]); do_kick(Config.s_ChanServ, 3, av); diff --git a/src/core/cs_drop.c b/src/core/cs_drop.c index 82ffc2a1f..1cc1949d5 100644 --- a/src/core/cs_drop.c +++ b/src/core/cs_drop.c @@ -67,11 +67,11 @@ class CommandCSDrop : public Command if (ircd->chansqline && (ci->HasFlag(CI_FORBIDDEN))) { - ircdproto->SendSQLineDel(ci->name); + ircdproto->SendSQLineDel(ci->name.c_str()); } alog("%s: Channel %s dropped by %s!%s@%s (founder: %s)", - Config.s_ChanServ, ci->name, u->nick, u->GetIdent().c_str(), + Config.s_ChanServ, ci->name.c_str(), u->nick.c_str(), u->GetIdent().c_str(), u->host, (ci->founder ? ci->founder->display : "(none)")); delete ci; @@ -81,7 +81,7 @@ class CommandCSDrop : public Command */ if (Config.WallDrop) { if ((level < ACCESS_FOUNDER) || (!IsRealFounder(u, ci) && ci->HasFlag(CI_SECUREFOUNDER))) - ircdproto->SendGlobops(findbot(Config.s_ChanServ), "\2%s\2 used DROP on channel \2%s\2", u->nick, chan); + ircdproto->SendGlobops(findbot(Config.s_ChanServ), "\2%s\2 used DROP on channel \2%s\2", u->nick.c_str(), chan); } notice_lang(Config.s_ChanServ, u, CHAN_DROPPED, chan); diff --git a/src/core/cs_forbid.c b/src/core/cs_forbid.c index ae298d8d3..82b045b48 100644 --- a/src/core/cs_forbid.c +++ b/src/core/cs_forbid.c @@ -55,17 +55,17 @@ class CommandCSForbid : public Command ci = new ChannelInfo(chan); if (!ci) { - alog("%s: Valid FORBID for %s by %s failed", Config.s_ChanServ, ci->name, u->nick); + alog("%s: Valid FORBID for %s by %s failed", Config.s_ChanServ, ci->name.c_str(), u->nick.c_str()); notice_lang(Config.s_ChanServ, u, CHAN_FORBID_FAILED, chan); return MOD_CONT; } ci->SetFlag(CI_FORBIDDEN); - ci->forbidby = sstrdup(u->nick); + ci->forbidby = sstrdup(u->nick.c_str()); if (reason) ci->forbidreason = sstrdup(reason); - if ((c = findchan(ci->name))) + if ((c = findchan(ci->name.c_str()))) { struct c_userlist *cu, *nextu; const char *av[3]; @@ -82,8 +82,8 @@ class CommandCSForbid : public Command if (is_oper(cu->user)) continue; - av[0] = c->name; - av[1] = cu->user->nick; + av[0] = c->name.c_str(); + av[1] = cu->user->nick.c_str(); av[2] = reason ? reason : getstring(cu->user->nc, CHAN_FORBID_REASON); ircdproto->SendKick(findbot(Config.s_ChanServ), c, cu->user, av[2]); do_kick(Config.s_ChanServ, 3, av); @@ -91,14 +91,14 @@ class CommandCSForbid : public Command } if (Config.WallForbid) - ircdproto->SendGlobops(findbot(Config.s_ChanServ), "\2%s\2 used FORBID on channel \2%s\2", u->nick, ci->name); + ircdproto->SendGlobops(findbot(Config.s_ChanServ), "\2%s\2 used FORBID on channel \2%s\2", u->nick.c_str(), ci->name.c_str()); if (ircd->chansqline) { ircdproto->SendSQLine(ci->name, reason ? reason : "Forbidden"); } - alog("%s: %s set FORBID for channel %s", Config.s_ChanServ, u->nick, ci->name); + alog("%s: %s set FORBID for channel %s", Config.s_ChanServ, u->nick.c_str(), ci->name.c_str()); notice_lang(Config.s_ChanServ, u, CHAN_FORBID_SUCCEEDED, chan); FOREACH_MOD(I_OnChanForbidden, OnChanForbidden(ci)); diff --git a/src/core/cs_info.c b/src/core/cs_info.c index 3a74f0e06..ec6245d5e 100644 --- a/src/core/cs_info.c +++ b/src/core/cs_info.c @@ -89,7 +89,7 @@ class CommandCSInfo : public Command && (!ci->c || !(ci->c->HasMode(CMODE_SECRET))))) { notice_lang(Config.s_ChanServ, u, CHAN_INFO_LAST_TOPIC, ci->last_topic); - notice_lang(Config.s_ChanServ, u, CHAN_INFO_TOPIC_SET_BY, ci->last_topic_setter); + notice_lang(Config.s_ChanServ, u, CHAN_INFO_TOPIC_SET_BY, ci->last_topic_setter.c_str()); } if (ci->entry_message && show_all) @@ -145,7 +145,7 @@ class CommandCSInfo : public Command } if (!show_all && (check_access(u, ci, CA_INFO) || has_auspex)) - notice_lang(Config.s_ChanServ, u, NICK_INFO_FOR_MORE, Config.s_ChanServ, ci->name); + notice_lang(Config.s_ChanServ, u, NICK_INFO_FOR_MORE, Config.s_ChanServ, ci->name.c_str()); return MOD_CONT; } diff --git a/src/core/cs_invite.c b/src/core/cs_invite.c index 42278bb14..fe8d4f6f3 100644 --- a/src/core/cs_invite.c +++ b/src/core/cs_invite.c @@ -55,11 +55,11 @@ class CommandCSInvite : public Command } if (is_on_chan(c, u2)) - notice_lang(Config.s_ChanServ, u, CHAN_INVITE_ALREADY_IN, c->name); + notice_lang(Config.s_ChanServ, u, CHAN_INVITE_ALREADY_IN, c->name.c_str()); else { - ircdproto->SendInvite(whosends(ci), chan, u2->nick); - notice_lang(Config.s_ChanServ, u, CHAN_INVITE_SUCCESS, c->name); + ircdproto->SendInvite(whosends(ci), chan, u2->nick.c_str()); + notice_lang(Config.s_ChanServ, u, CHAN_INVITE_SUCCESS, c->name.c_str()); } return MOD_CONT; } diff --git a/src/core/cs_kick.c b/src/core/cs_kick.c index 93d42620a..898fb898b 100644 --- a/src/core/cs_kick.c +++ b/src/core/cs_kick.c @@ -43,7 +43,7 @@ class CommandCSKick : public Command reason = "Requested"; } - is_same = (target == u->nick) ? 1 : (stricmp(target, u->nick) == 0); + is_same = (target == u->nick.c_str()) ? 1 : (stricmp(target, u->nick.c_str()) == 0); if (c) ci = c->ci; @@ -53,7 +53,7 @@ class CommandCSKick : public Command } else if (is_same ? !(u2 = u) : !(u2 = finduser(target))) { notice_lang(Config.s_ChanServ, u, NICK_X_NOT_IN_USE, target); } else if (!is_on_chan(c, u2)) { - notice_lang(Config.s_ChanServ, u, NICK_X_NOT_ON_CHAN, u2->nick, c->name); + notice_lang(Config.s_ChanServ, u, NICK_X_NOT_ON_CHAN, u2->nick.c_str(), c->name.c_str()); } else if (!is_same ? !check_access(u, ci, CA_KICK) : !check_access(u, ci, CA_KICKME)) { notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); @@ -69,10 +69,10 @@ class CommandCSKick : public Command || ((ci->HasFlag(CI_SIGNKICK_LEVEL)) && !check_access(u, ci, CA_SIGNKICK))) ircdproto->SendKick(whosends(ci), ci->c, u2, "%s (%s)", - reason, u->nick); + reason, u->nick.c_str()); else ircdproto->SendKick(whosends(ci), ci->c, u2, "%s", reason); - av[0] = ci->name; + av[0] = ci->name.c_str(); av[1] = target; av[2] = reason; do_kick(Config.s_ChanServ, 3, av); diff --git a/src/core/cs_list.c b/src/core/cs_list.c index 7b83d6d9a..c13e2f9ef 100644 --- a/src/core/cs_list.c +++ b/src/core/cs_list.c @@ -126,8 +126,8 @@ public: else if (channoexpire && !ci->HasFlag(CI_NO_EXPIRE)) continue; - if ((stricmp(pattern, ci->name) == 0) - || (stricmp(spattern, ci->name) == 0) + if ((stricmp(pattern, ci->name.c_str()) == 0) + || (stricmp(spattern, ci->name.c_str()) == 0) || Anope::Match(ci->name, pattern, false) || Anope::Match(ci->name, spattern, false)) { @@ -142,17 +142,17 @@ public: if (ci->HasFlag(CI_FORBIDDEN)) { snprintf(buf, sizeof(buf), - "%-20s [Forbidden]", ci->name); + "%-20s [Forbidden]", ci->name.c_str()); } else if (ci->HasFlag(CI_SUSPENDED)) { snprintf(buf, sizeof(buf), - "%-20s [Suspended]", ci->name); + "%-20s [Suspended]", ci->name.c_str()); } else { snprintf(buf, sizeof(buf), "%-20s %s", - ci->name, ci->desc ? ci->desc : ""); + ci->name.c_str(), ci->desc ? ci->desc : ""); } u->SendMessage(Config.s_ChanServ, " %c%s", noexpire_char, buf); diff --git a/src/core/cs_modes.c b/src/core/cs_modes.c index 9dc76e10f..d696d641c 100644 --- a/src/core/cs_modes.c +++ b/src/core/cs_modes.c @@ -35,9 +35,9 @@ static CommandReturn do_util(User *u, ChannelMode *cm, const char *chan, const c int is_same; if (!nick) - nick = u->nick; + nick = u->nick.c_str(); - is_same = (nick == u->nick) ? 1 : (stricmp(nick, u->nick) == 0); + is_same = (nick == u->nick) ? 1 : (stricmp(nick, u->nick.c_str()) == 0); if (c) ci = c->ci; @@ -47,7 +47,7 @@ static CommandReturn do_util(User *u, ChannelMode *cm, const char *chan, const c else if (is_same ? !(u2 = u) : !(u2 = finduser(nick))) notice_lang(Config.s_ChanServ, u, NICK_X_NOT_IN_USE, nick); else if (!is_on_chan(c, u2)) - notice_lang(Config.s_ChanServ, u, NICK_X_NOT_ON_CHAN, u2->nick, c->name); + notice_lang(Config.s_ChanServ, u, NICK_X_NOT_ON_CHAN, u2->nick.c_str(), c->name.c_str()); else if (is_same ? !check_access(u, ci, levelself) : !check_access(u, ci, level)) notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); else if (!set && !is_same && (ci->HasFlag(CI_PEACE)) && (get_access(u2, ci) >= get_access(u, ci))) @@ -62,8 +62,8 @@ static CommandReturn do_util(User *u, ChannelMode *cm, const char *chan, const c c->RemoveMode(NULL, cm, u2->nick); if (notice && ci->HasFlag(notice)) - ircdproto->SendMessage(whosends(ci), c->name, "%s command used for %s by %s", - name.c_str(), u2->nick, u->nick); + ircdproto->SendMessage(whosends(ci), c->name.c_str(), "%s command used for %s by %s", + name.c_str(), u2->nick.c_str(), u->nick.c_str()); } return MOD_CONT; diff --git a/src/core/cs_register.c b/src/core/cs_register.c index fd4c38f70..7e59b0c26 100644 --- a/src/core/cs_register.c +++ b/src/core/cs_register.c @@ -68,15 +68,16 @@ class CommandCSRegister : public Command if (c->topic) { ci->last_topic = sstrdup(c->topic); - strscpy(ci->last_topic_setter, c->topic_setter, NICKMAX); + ci->last_topic_setter = c->topic_setter; ci->last_topic_time = c->topic_time; } - else strscpy(ci->last_topic_setter, Config.s_ChanServ, NICKMAX); /* Set this to something, otherwise it will maliform the topic */ + else + ci->last_topic_setter = Config.s_ChanServ; ci->bi = NULL; ++ci->founder->channelcount; - alog("%s: Channel '%s' registered by %s!%s@%s", Config.s_ChanServ, chan, u->nick, u->GetIdent().c_str(), u->host); - notice_lang(Config.s_ChanServ, u, CHAN_REGISTERED, chan, u->nick); + alog("%s: Channel '%s' registered by %s!%s@%s", Config.s_ChanServ, chan, u->nick.c_str(), u->GetIdent().c_str(), u->host); + notice_lang(Config.s_ChanServ, u, CHAN_REGISTERED, chan, u->nick.c_str()); /* Implement new mode lock */ check_modes(c); diff --git a/src/core/cs_set.c b/src/core/cs_set.c index d2c2d6845..0d409472f 100644 --- a/src/core/cs_set.c +++ b/src/core/cs_set.c @@ -43,7 +43,7 @@ class CommandCSSet : public Command } alog("%s: Changing founder of %s from %s to %s by %s!%s@%s", - Config.s_ChanServ, ci->name, ci->founder->display, nc->display, u->nick, + Config.s_ChanServ, ci->name.c_str(), ci->founder->display, nc->display, u->nick.c_str(), u->GetIdent().c_str(), u->host); /* Founder and successor must not be the same group */ @@ -54,7 +54,7 @@ class CommandCSSet : public Command ci->founder = nc; nc->channelcount++; - notice_lang(Config.s_ChanServ, u, CHAN_FOUNDER_CHANGED, ci->name, param.c_str()); + notice_lang(Config.s_ChanServ, u, CHAN_FOUNDER_CHANGED, ci->name.c_str(), param.c_str()); return MOD_CONT; } @@ -79,7 +79,7 @@ class CommandCSSet : public Command } if (na->nc == ci->founder) { - notice_lang(Config.s_ChanServ, u, CHAN_SUCCESSOR_IS_FOUNDER, param.c_str(), ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SUCCESSOR_IS_FOUNDER, param.c_str(), ci->name.c_str()); return MOD_CONT; } nc = na->nc; @@ -89,16 +89,16 @@ class CommandCSSet : public Command nc = NULL; alog("%s: Changing successor of %s from %s to %s by %s!%s@%s", - Config.s_ChanServ, ci->name, + Config.s_ChanServ, ci->name.c_str(), (ci->successor ? ci->successor->display : "none"), - (nc ? nc->display : "none"), u->nick, u->GetIdent().c_str(), u->host); + (nc ? nc->display : "none"), u->nick.c_str(), u->GetIdent().c_str(), u->host); ci->successor = nc; if (nc) - notice_lang(Config.s_ChanServ, u, CHAN_SUCCESSOR_CHANGED, ci->name, param.c_str()); + notice_lang(Config.s_ChanServ, u, CHAN_SUCCESSOR_CHANGED, ci->name.c_str(), param.c_str()); else - notice_lang(Config.s_ChanServ, u, CHAN_SUCCESSOR_UNSET, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SUCCESSOR_UNSET, ci->name.c_str()); return MOD_CONT; } @@ -108,7 +108,7 @@ class CommandCSSet : public Command if (ci->desc) delete [] ci->desc; ci->desc = sstrdup(param.c_str()); - notice_lang(Config.s_ChanServ, u, CHAN_DESC_CHANGED, ci->name, param.c_str()); + notice_lang(Config.s_ChanServ, u, CHAN_DESC_CHANGED, ci->name.c_str(), param.c_str()); return MOD_CONT; } @@ -119,12 +119,12 @@ class CommandCSSet : public Command if (!param.empty()) { ci->url = sstrdup(param.c_str()); - notice_lang(Config.s_ChanServ, u, CHAN_URL_CHANGED, ci->name, param.c_str()); + notice_lang(Config.s_ChanServ, u, CHAN_URL_CHANGED, ci->name.c_str(), param.c_str()); } else { ci->url = NULL; - notice_lang(Config.s_ChanServ, u, CHAN_URL_UNSET, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_URL_UNSET, ci->name.c_str()); } return MOD_CONT; } @@ -136,12 +136,12 @@ class CommandCSSet : public Command if (!param.empty()) { ci->email = sstrdup(param.c_str()); - notice_lang(Config.s_ChanServ, u, CHAN_EMAIL_CHANGED, ci->name, param.c_str()); + notice_lang(Config.s_ChanServ, u, CHAN_EMAIL_CHANGED, ci->name.c_str(), param.c_str()); } else { ci->email = NULL; - notice_lang(Config.s_ChanServ, u, CHAN_EMAIL_UNSET, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_EMAIL_UNSET, ci->name.c_str()); } return MOD_CONT; } @@ -153,12 +153,12 @@ class CommandCSSet : public Command if (!param.empty()) { ci->entry_message = sstrdup(param.c_str()); - notice_lang(Config.s_ChanServ, u, CHAN_ENTRY_MSG_CHANGED, ci->name, param.c_str()); + notice_lang(Config.s_ChanServ, u, CHAN_ENTRY_MSG_CHANGED, ci->name.c_str(), param.c_str()); } else { ci->entry_message = NULL; - notice_lang(Config.s_ChanServ, u, CHAN_ENTRY_MSG_UNSET, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_ENTRY_MSG_UNSET, ci->name.c_str()); } return MOD_CONT; } @@ -259,7 +259,7 @@ class CommandCSSet : public Command * mode lock at all. */ if (get_mlock_modes(ci, 0)) { - notice_lang(Config.s_ChanServ, u, CHAN_MLOCK_CHANGED, ci->name, + notice_lang(Config.s_ChanServ, u, CHAN_MLOCK_CHANGED, ci->name.c_str(), get_mlock_modes(ci, 0)); } @@ -279,7 +279,7 @@ class CommandCSSet : public Command notice_lang(Config.s_ChanServ, u, CHAN_SET_BANTYPE_INVALID, param); } else { ci->bantype = bantype; - notice_lang(Config.s_ChanServ, u, CHAN_SET_BANTYPE_CHANGED, ci->name, + notice_lang(Config.s_ChanServ, u, CHAN_SET_BANTYPE_CHANGED, ci->name.c_str(), ci->bantype); } return MOD_CONT; @@ -290,12 +290,12 @@ class CommandCSSet : public Command if (param == "ON") { ci->SetFlag(CI_KEEPTOPIC); - notice_lang(Config.s_ChanServ, u, CHAN_SET_KEEPTOPIC_ON, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_KEEPTOPIC_ON, ci->name.c_str()); } else if (param == "OFF") { ci->UnsetFlag(CI_KEEPTOPIC); - notice_lang(Config.s_ChanServ, u, CHAN_SET_KEEPTOPIC_OFF, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_KEEPTOPIC_OFF, ci->name.c_str()); } else this->OnSyntaxError(u, "KEEPTOPIC"); @@ -308,12 +308,12 @@ class CommandCSSet : public Command if (param == "ON") { ci->SetFlag(CI_TOPICLOCK); - notice_lang(Config.s_ChanServ, u, CHAN_SET_TOPICLOCK_ON, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_TOPICLOCK_ON, ci->name.c_str()); } else if (param == "OFF") { ci->UnsetFlag(CI_TOPICLOCK); - notice_lang(Config.s_ChanServ, u, CHAN_SET_TOPICLOCK_OFF, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_TOPICLOCK_OFF, ci->name.c_str()); } else this->OnSyntaxError(u, "TOPICLOCK"); @@ -326,12 +326,12 @@ class CommandCSSet : public Command if (param == "ON") { ci->SetFlag(CI_PRIVATE); - notice_lang(Config.s_ChanServ, u, CHAN_SET_PRIVATE_ON, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_PRIVATE_ON, ci->name.c_str()); } else if (param == "OFF") { ci->UnsetFlag(CI_PRIVATE); - notice_lang(Config.s_ChanServ, u, CHAN_SET_PRIVATE_OFF, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_PRIVATE_OFF, ci->name.c_str()); } else this->OnSyntaxError(u, "PRIVATE"); @@ -344,12 +344,12 @@ class CommandCSSet : public Command if (param == "ON") { ci->SetFlag(CI_SECUREOPS); - notice_lang(Config.s_ChanServ, u, CHAN_SET_SECUREOPS_ON, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_SECUREOPS_ON, ci->name.c_str()); } else if (param == "OFF") { ci->UnsetFlag(CI_SECUREOPS); - notice_lang(Config.s_ChanServ, u, CHAN_SET_SECUREOPS_OFF, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_SECUREOPS_OFF, ci->name.c_str()); } else this->OnSyntaxError(u, "SECUREOPS"); @@ -362,12 +362,12 @@ class CommandCSSet : public Command if (param == "ON") { ci->SetFlag(CI_SECUREFOUNDER); - notice_lang(Config.s_ChanServ, u, CHAN_SET_SECUREFOUNDER_ON, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_SECUREFOUNDER_ON, ci->name.c_str()); } else if (param == "OFF") { ci->UnsetFlag(CI_SECUREFOUNDER); - notice_lang(Config.s_ChanServ, u, CHAN_SET_SECUREFOUNDER_OFF, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_SECUREFOUNDER_OFF, ci->name.c_str()); } else this->OnSyntaxError(u, "SECUREFOUNDER"); @@ -382,14 +382,14 @@ class CommandCSSet : public Command ci->SetFlag(CI_RESTRICTED); if (ci->levels[CA_NOJOIN] < 0) ci->levels[CA_NOJOIN] = 0; - notice_lang(Config.s_ChanServ, u, CHAN_SET_RESTRICTED_ON, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_RESTRICTED_ON, ci->name.c_str()); } else if (param == "OFF") { ci->UnsetFlag(CI_RESTRICTED); if (ci->levels[CA_NOJOIN] >= 0) ci->levels[CA_NOJOIN] = -2; - notice_lang(Config.s_ChanServ, u, CHAN_SET_RESTRICTED_OFF, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_RESTRICTED_OFF, ci->name.c_str()); } else this->OnSyntaxError(u, "RESTRICTED"); @@ -402,12 +402,12 @@ class CommandCSSet : public Command if (param == "ON") { ci->SetFlag(CI_SECURE); - notice_lang(Config.s_ChanServ, u, CHAN_SET_SECURE_ON, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_SECURE_ON, ci->name.c_str()); } else if (param == "OFF") { ci->UnsetFlag(CI_SECURE); - notice_lang(Config.s_ChanServ, u, CHAN_SET_SECURE_OFF, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_SECURE_OFF, ci->name.c_str()); } else this->OnSyntaxError(u, "SECURE"); @@ -421,19 +421,19 @@ class CommandCSSet : public Command { ci->SetFlag(CI_SIGNKICK); ci->UnsetFlag(CI_SIGNKICK_LEVEL); - notice_lang(Config.s_ChanServ, u, CHAN_SET_SIGNKICK_ON, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_SIGNKICK_ON, ci->name.c_str()); } else if (param == "LEVEL") { ci->SetFlag(CI_SIGNKICK_LEVEL); ci->UnsetFlag(CI_SIGNKICK); - notice_lang(Config.s_ChanServ, u, CHAN_SET_SIGNKICK_LEVEL, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_SIGNKICK_LEVEL, ci->name.c_str()); } else if (param == "OFF") { ci->UnsetFlag(CI_SIGNKICK); ci->UnsetFlag(CI_SIGNKICK_LEVEL); - notice_lang(Config.s_ChanServ, u, CHAN_SET_SIGNKICK_OFF, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_SIGNKICK_OFF, ci->name.c_str()); } else this->OnSyntaxError(u, "SIGNKICK"); @@ -446,12 +446,12 @@ class CommandCSSet : public Command if (param == "ON") { ci->SetFlag(CI_OPNOTICE); - notice_lang(Config.s_ChanServ, u, CHAN_SET_OPNOTICE_ON, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_OPNOTICE_ON, ci->name.c_str()); } else if (param == "OFF") { ci->UnsetFlag(CI_OPNOTICE); - notice_lang(Config.s_ChanServ, u, CHAN_SET_OPNOTICE_OFF, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_OPNOTICE_OFF, ci->name.c_str()); } else this->OnSyntaxError(u, "OPNOTICE"); @@ -500,17 +500,17 @@ class CommandCSSet : public Command ci->SetFlag(CI_XOP); } - alog("%s: %s!%s@%s enabled XOP for %s", Config.s_ChanServ, u->nick, - u->GetIdent().c_str(), u->host, ci->name); - notice_lang(Config.s_ChanServ, u, CHAN_SET_XOP_ON, ci->name); + 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()); + 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, - u->GetIdent().c_str(), u->host, ci->name); - notice_lang(Config.s_ChanServ, u, CHAN_SET_XOP_OFF, ci->name); + 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()); + notice_lang(Config.s_ChanServ, u, CHAN_SET_XOP_OFF, ci->name.c_str()); } else this->OnSyntaxError(u, "XOP"); @@ -525,12 +525,12 @@ class CommandCSSet : public Command if (param == "ON") { ci->SetFlag(CI_PEACE); - notice_lang(Config.s_ChanServ, u, CHAN_SET_PEACE_ON, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_PEACE_ON, ci->name.c_str()); } else if (param == "OFF") { ci->UnsetFlag(CI_PEACE); - notice_lang(Config.s_ChanServ, u, CHAN_SET_PEACE_OFF, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_PEACE_OFF, ci->name.c_str()); } else this->OnSyntaxError(u, "PEACE"); @@ -572,7 +572,7 @@ class CommandCSSet : public Command } } - notice_lang(Config.s_ChanServ, u, CHAN_SET_PERSIST_ON, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_PERSIST_ON, ci->name.c_str()); } else if (param == "OFF") { @@ -599,7 +599,7 @@ class CommandCSSet : public Command delete ci->c; } - notice_lang(Config.s_ChanServ, u, CHAN_SET_PERSIST_OFF, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_PERSIST_OFF, ci->name.c_str()); } else this->OnSyntaxError(u, "PERSIST"); @@ -617,12 +617,12 @@ class CommandCSSet : public Command if (param == "ON") { ci->SetFlag(CI_NO_EXPIRE); - notice_lang(Config.s_ChanServ, u, CHAN_SET_NOEXPIRE_ON, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_NOEXPIRE_ON, ci->name.c_str()); } else if (param == "OFF") { ci->UnsetFlag(CI_NO_EXPIRE); - notice_lang(Config.s_ChanServ, u, CHAN_SET_NOEXPIRE_OFF, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_SET_NOEXPIRE_OFF, ci->name.c_str()); } else this->OnSyntaxError(u, "NOEXPIRE"); diff --git a/src/core/cs_suspend.c b/src/core/cs_suspend.c index 8976ba745..fdd40c796 100644 --- a/src/core/cs_suspend.c +++ b/src/core/cs_suspend.c @@ -56,11 +56,11 @@ class CommandCSSuspend : public Command if (ci) { ci->SetFlag(CI_SUSPENDED); - ci->forbidby = sstrdup(u->nick); + ci->forbidby = sstrdup(u->nick.c_str()); if (reason) ci->forbidreason = sstrdup(reason); - if ((c = findchan(ci->name))) + if ((c = findchan(ci->name.c_str()))) { struct c_userlist *cu, *nextu; const char *av[3]; @@ -72,8 +72,8 @@ class CommandCSSuspend : public Command if (is_oper(cu->user)) continue; - av[0] = c->name; - av[1] = cu->user->nick; + av[0] = c->name.c_str(); + av[1] = cu->user->nick.c_str(); av[2] = reason ? reason : getstring(cu->user->nc, CHAN_SUSPEND_REASON); ircdproto->SendKick(findbot(Config.s_ChanServ), c, cu->user, av[2]); do_kick(Config.s_ChanServ, 3, av); @@ -81,16 +81,16 @@ 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, ci->name); + 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, ci->name); + alog("%s: %s set SUSPEND for channel %s", Config.s_ChanServ, u->nick.c_str(), ci->name.c_str()); 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, u->nick); + alog("%s: Valid SUSPEND for %s by %s failed", Config.s_ChanServ, ci->name.c_str(), u->nick.c_str()); notice_lang(Config.s_ChanServ, u, CHAN_SUSPEND_FAILED, chan); } return MOD_CONT; @@ -151,16 +151,16 @@ 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, ci->name); + 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, ci->name); + alog("%s: %s set UNSUSPEND for channel %s", Config.s_ChanServ, u->nick.c_str(), ci->name.c_str()); 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); + alog("%s: Valid UNSUSPEND for %s by %s failed", Config.s_ChanServ, chan, u->nick.c_str()); 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 2da85af64..6acf09756 100644 --- a/src/core/cs_topic.c +++ b/src/core/cs_topic.c @@ -42,26 +42,26 @@ class CommandCSTopic : public Command if (ci->last_topic) delete [] ci->last_topic; ci->last_topic = topic ? sstrdup(topic) : NULL; - strscpy(ci->last_topic_setter, u->nick, NICKMAX); + ci->last_topic_setter = u->nick; ci->last_topic_time = time(NULL); if (c->topic) delete [] c->topic; c->topic = topic ? sstrdup(topic) : NULL; - strscpy(c->topic_setter, u->nick, NICKMAX); + c->topic_setter = u->nick; if (ircd->topictsbackward) c->topic_time = c->topic_time - 1; else 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, u->GetIdent().c_str(), u->host, c->name); + 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()); if (ircd->join2set && whosends(ci) == findbot(Config.s_ChanServ)) { - ircdproto->SendJoin(findbot(Config.s_ChanServ), c->name, c->creation_time); + ircdproto->SendJoin(findbot(Config.s_ChanServ), c->name.c_str(), c->creation_time); ircdproto->SendMode(NULL, c, "+o %s", Config.s_ChanServ); } - ircdproto->SendTopic(whosends(ci), c, u->nick, topic ? topic : ""); + ircdproto->SendTopic(whosends(ci), c, u->nick.c_str(), topic ? topic : ""); if (ircd->join2set && whosends(ci) == findbot(Config.s_ChanServ)) ircdproto->SendPart(findbot(Config.s_ChanServ), c, NULL); } diff --git a/src/core/cs_unban.c b/src/core/cs_unban.c index 2217bfa07..e25df3c8b 100644 --- a/src/core/cs_unban.c +++ b/src/core/cs_unban.c @@ -52,9 +52,9 @@ class CommandCSUnban : public Command common_unban(c->ci, u2->nick); if (u2 == u) - notice_lang(Config.s_ChanServ, u, CHAN_UNBANNED, c->name); + notice_lang(Config.s_ChanServ, u, CHAN_UNBANNED, c->name.c_str()); else - notice_lang(Config.s_ChanServ, u, CHAN_UNBANNED_OTHER, u2->nick, c->name); + notice_lang(Config.s_ChanServ, u, CHAN_UNBANNED_OTHER, u2->nick.c_str(), c->name.c_str()); return MOD_CONT; } diff --git a/src/core/cs_xop.c b/src/core/cs_xop.c index 01e84edac..ac2fea3f5 100644 --- a/src/core/cs_xop.c +++ b/src/core/cs_xop.c @@ -189,17 +189,17 @@ 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, u->GetIdent().c_str(), u->host, ulev, change ? "changed" : "set", level, na->nick, nc->display, ci->name); + 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()); if (!change) { FOREACH_MOD(I_OnAccessAdd, OnAccessAdd(ci, u, na->nick, level)); - notice_lang(Config.s_ChanServ, u, messages[XOP_ADDED], nc->display, ci->name); + notice_lang(Config.s_ChanServ, u, messages[XOP_ADDED], nc->display, ci->name.c_str()); } else { FOREACH_MOD(I_OnAccessChange, OnAccessChange(ci, u, na->nick, level)); - notice_lang(Config.s_ChanServ, u, messages[XOP_MOVED], nc->display, ci->name); + notice_lang(Config.s_ChanServ, u, messages[XOP_MOVED], nc->display, ci->name.c_str()); } return MOD_CONT; @@ -226,7 +226,7 @@ class XOPBase : public Command if (!ci->GetAccessCount()) { - notice_lang(Config.s_ChanServ, u, messages[XOP_LIST_EMPTY], ci->name); + notice_lang(Config.s_ChanServ, u, messages[XOP_LIST_EMPTY], ci->name.c_str()); return MOD_CONT; } @@ -250,15 +250,15 @@ class XOPBase : public Command else if (count == 1) { last = atoi(nick); - notice_lang(Config.s_ChanServ, u, messages[XOP_NO_SUCH_ENTRY], last, ci->name); + notice_lang(Config.s_ChanServ, u, messages[XOP_NO_SUCH_ENTRY], last, ci->name.c_str()); } else - notice_lang(Config.s_ChanServ, u, messages[XOP_NO_MATCH], ci->name); + notice_lang(Config.s_ChanServ, u, messages[XOP_NO_MATCH], ci->name.c_str()); } else if (deleted == 1) - notice_lang(Config.s_ChanServ, u, messages[XOP_DELETED_ONE], ci->name); + notice_lang(Config.s_ChanServ, u, messages[XOP_DELETED_ONE], ci->name.c_str()); else - notice_lang(Config.s_ChanServ, u, messages[XOP_DELETED_SEVERAL], deleted, ci->name); + notice_lang(Config.s_ChanServ, u, messages[XOP_DELETED_SEVERAL], deleted, ci->name.c_str()); } else { @@ -273,7 +273,7 @@ class XOPBase : public Command if (!access) { - notice_lang(Config.s_ChanServ, u, messages[XOP_NOT_FOUND], nick, ci->name); + notice_lang(Config.s_ChanServ, u, messages[XOP_NOT_FOUND], nick, ci->name.c_str()); return MOD_CONT; } @@ -284,7 +284,7 @@ class XOPBase : public Command } else { - notice_lang(Config.s_ChanServ, u, messages[XOP_DELETED], access->nc->display, ci->name); + notice_lang(Config.s_ChanServ, u, messages[XOP_DELETED], access->nc->display, ci->name.c_str()); access->nc = NULL; access->in_use = 0; @@ -317,7 +317,7 @@ class XOPBase : public Command if (!ci->GetAccessCount()) { - notice_lang(Config.s_ChanServ, u, messages[XOP_LIST_EMPTY], ci->name); + notice_lang(Config.s_ChanServ, u, messages[XOP_LIST_EMPTY], ci->name.c_str()); return MOD_CONT; } @@ -334,7 +334,7 @@ class XOPBase : public Command } } if (!sent_header) - notice_lang(Config.s_ChanServ, u, messages[XOP_NO_MATCH], ci->name); + notice_lang(Config.s_ChanServ, u, messages[XOP_NO_MATCH], ci->name.c_str()); return MOD_CONT; } @@ -349,7 +349,7 @@ class XOPBase : public Command if (!ci->GetAccessCount()) { - notice_lang(Config.s_ChanServ, u, messages[XOP_LIST_EMPTY], ci->name); + notice_lang(Config.s_ChanServ, u, messages[XOP_LIST_EMPTY], ci->name.c_str()); return MOD_CONT; } @@ -368,7 +368,7 @@ class XOPBase : public Command FOREACH_MOD(I_OnAccessClear, OnAccessClear(ci, u)); - notice_lang(Config.s_ChanServ, u, messages[XOP_CLEAR], ci->name); + notice_lang(Config.s_ChanServ, u, messages[XOP_CLEAR], ci->name.c_str()); return MOD_CONT; } @@ -609,7 +609,7 @@ int xop_list(User *u, int index, ChannelInfo *ci, int *sent_header, int xlev, in if (!*sent_header) { - notice_lang(Config.s_ChanServ, u, xmsg, ci->name); + notice_lang(Config.s_ChanServ, u, xmsg, ci->name.c_str()); *sent_header = 1; } diff --git a/src/core/db_plain.cpp b/src/core/db_plain.cpp index 5862e679c..0f4d6ccb5 100644 --- a/src/core/db_plain.cpp +++ b/src/core/db_plain.cpp @@ -456,7 +456,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); + alog("[db_plain]: loaded channel %s", ci->name.c_str()); } static void LoadOperInfo(const std::vector<std::string> ¶ms) @@ -486,7 +486,7 @@ static void LoadOperInfo(const std::vector<std::string> ¶ms) exceptions = static_cast<Exception *>(srealloc(exceptions, sizeof(Exception) * nexceptions)); exceptions[nexceptions - 1].mask = sstrdup(params[1].c_str()); exceptions[nexceptions - 1].limit = atol(params[2].c_str()); - strscpy(exceptions[nexceptions - 1].who, params[3].c_str(), NICKMAX); + exceptions[nexceptions - 1].who = params[3]; exceptions[nexceptions - 1].time = strtol(params[4].c_str(), NULL, 10); exceptions[nexceptions - 1].expires = strtol(params[5].c_str(), NULL, 10); exceptions[nexceptions - 1].reason = sstrdup(params[6].c_str()); @@ -572,7 +572,7 @@ class DBPlain : public Module Memo *m = new Memo; m->number = atoi(params[0].c_str()); m->time = strtol(params[1].c_str(), NULL, 10); - strscpy(m->sender, params[2].c_str(), NICKMAX); + m->sender = params[2]; unsigned j; for (j = 3; (params[j] == "UNREAD" || params[j] == "RECEIPT" || params[j] == "NOTIFYS"); ++j) { @@ -656,7 +656,7 @@ class DBPlain : public Module ci->founder = findcore(params[0].c_str()); if (!ci->founder) { - alog("[db_plain]: Deleting founderless channel %s", ci->name); + alog("[db_plain]: Deleting founderless channel %s", ci->name.c_str()); delete ci; ci = NULL; throw "no founder"; @@ -686,7 +686,7 @@ class DBPlain : public Module ci->email = sstrdup(params[0].c_str()); else if (key == "TOPIC") { - strscpy(ci->last_topic_setter, params[0].c_str(), NICKMAX); + ci->last_topic_setter = params[0]; ci->last_topic_time = strtol(params[1].c_str(), NULL, 10); ci->last_topic = sstrdup(params[2].c_str()); } @@ -749,7 +749,7 @@ class DBPlain : public Module Memo *m = new Memo; m->number = atoi(params[0].c_str()); m->time = strtol(params[1].c_str(), NULL, 10); - strscpy(m->sender, params[2].c_str(), NICKMAX); + m->sender = params[2]; unsigned j; for (j = 3; j < params.size() - 1 && (buf == "UNREAD" || buf == "RECEIPT" || buf == "NOTIFYS"); ++j) { diff --git a/src/core/hs_del.c b/src/core/hs_del.c index 69d9b8524..5d55f6eff 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); + alog("vHost for user \002%s\002 deleted by oper \002%s\002", nick, u->nick.c_str()); 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 89a227207..4c6771ac5 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); + alog("vHosts for all nicks in group \002%s\002 deleted by oper \002%s\002", nc->display, u->nick.c_str()); 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 cd5ce0552..3585546a9 100644 --- a/src/core/hs_set.c +++ b/src/core/hs_set.c @@ -119,9 +119,9 @@ class CommandHSSet : public Command 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); + 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); + alog("vHost for user \002%s\002 set to \002%s\002 by oper \002%s\002", nick, hostmask, u->nick.c_str()); 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 ab21075da..68fc4330c 100644 --- a/src/core/hs_setall.c +++ b/src/core/hs_setall.c @@ -117,9 +117,9 @@ 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); + 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); + 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()); na->hostinfo.SetVhost(vIdent ? vIdent : "", hostmask, u->nick); HostServSyncVhosts(na); FOREACH_MOD(I_OnSetVhost, OnSetVhost(na)); diff --git a/src/core/ms_cancel.c b/src/core/ms_cancel.c index 4c290f738..e2b9da939 100644 --- a/src/core/ms_cancel.c +++ b/src/core/ms_cancel.c @@ -46,7 +46,7 @@ class CommandMSCancel : public Command for (i = mi->memos.size() - 1; i >= 0; --i) { - if ((mi->memos[i]->HasFlag(MF_UNREAD)) && !stricmp(mi->memos[i]->sender, u->nc->display) && !mi->memos[i]->HasFlag(MF_NOTIFYS)) + if ((mi->memos[i]->HasFlag(MF_UNREAD)) && !stricmp(mi->memos[i]->sender.c_str(), u->nc->display) && !mi->memos[i]->HasFlag(MF_NOTIFYS)) { delmemo(mi, mi->memos[i]->number); notice_lang(Config.s_MemoServ, u, MEMO_CANCELLED, name); diff --git a/src/core/ms_check.c b/src/core/ms_check.c index c396aed17..1272eb60c 100644 --- a/src/core/ms_check.c +++ b/src/core/ms_check.c @@ -55,7 +55,7 @@ class CommandMSCheck : public Command for (i = mi->memos.size() - 1; i >= 0; --i) { - if (!stricmp(mi->memos[i]->sender, u->nc->display)) + if (!stricmp(mi->memos[i]->sender.c_str(), u->nc->display)) { found = 1; /* Yes, we've found the memo */ diff --git a/src/core/ms_list.c b/src/core/ms_list.c index 40c35d851..3e8688d7f 100644 --- a/src/core/ms_list.c +++ b/src/core/ms_list.c @@ -172,7 +172,7 @@ int list_memo(User *u, int index, MemoInfo *mi, int *sent_header, int newi, cons if (chan) notice_lang(Config.s_MemoServ, u, newi ? MEMO_LIST_CHAN_NEW_MEMOS : MEMO_LIST_CHAN_MEMOS, chan, Config.s_MemoServ, chan); else - notice_lang(Config.s_MemoServ, u, newi ? MEMO_LIST_NEW_MEMOS : MEMO_LIST_MEMOS, u->nick, Config.s_MemoServ); + notice_lang(Config.s_MemoServ, u, newi ? MEMO_LIST_NEW_MEMOS : MEMO_LIST_MEMOS, u->nick.c_str(), Config.s_MemoServ); notice_lang(Config.s_MemoServ, u, MEMO_LIST_HEADER); *sent_header = 1; } @@ -180,7 +180,7 @@ int list_memo(User *u, int index, MemoInfo *mi, int *sent_header, int newi, cons tm = *localtime(&m->time); strftime_lang(timebuf, sizeof(timebuf), u, STRFTIME_DATE_TIME_FORMAT, &tm); timebuf[sizeof(timebuf) - 1] = 0; /* just in case */ - notice_lang(Config.s_MemoServ, u, MEMO_LIST_FORMAT, (m->HasFlag(MF_UNREAD)) ? '*' : ' ', m->number, m->sender, timebuf); + notice_lang(Config.s_MemoServ, u, MEMO_LIST_FORMAT, (m->HasFlag(MF_UNREAD)) ? '*' : ' ', m->number, m->sender.c_str(), timebuf); return 1; } diff --git a/src/core/ms_read.c b/src/core/ms_read.c index 2c2418351..d6f0ca615 100644 --- a/src/core/ms_read.c +++ b/src/core/ms_read.c @@ -178,9 +178,9 @@ int read_memo(User *u, int index, MemoInfo *mi, const char *chan) strftime_lang(timebuf, sizeof(timebuf), u, STRFTIME_DATE_TIME_FORMAT, &tm); timebuf[sizeof(timebuf) - 1] = 0; if (chan) - notice_lang(Config.s_MemoServ, u, MEMO_CHAN_HEADER, m->number, m->sender, timebuf, Config.s_MemoServ, chan, m->number); + notice_lang(Config.s_MemoServ, u, MEMO_CHAN_HEADER, m->number, m->sender.c_str(), timebuf, Config.s_MemoServ, chan, m->number); else - notice_lang(Config.s_MemoServ, u, MEMO_HEADER, m->number, m->sender, timebuf, Config.s_MemoServ, m->number); + notice_lang(Config.s_MemoServ, u, MEMO_HEADER, m->number, m->sender.c_str(), timebuf, Config.s_MemoServ, m->number); notice_lang(Config.s_MemoServ, u, MEMO_TEXT, m->text); m->UnsetFlag(MF_UNREAD); diff --git a/src/core/ms_sendall.c b/src/core/ms_sendall.c index dac721af8..937bfe914 100644 --- a/src/core/ms_sendall.c +++ b/src/core/ms_sendall.c @@ -38,7 +38,7 @@ class CommandMSSendAll : public Command { for (nc = nclists[i]; nc; nc = nc->next) { - if (stricmp(u->nick, nc->display)) + if (stricmp(u->nick.c_str(), nc->display)) memo_send(u, nc->display, text, z); } /* /nc */ } /* /i */ diff --git a/src/core/ns_access.c b/src/core/ns_access.c index 636fb5b2f..f8bd8ff77 100644 --- a/src/core/ns_access.c +++ b/src/core/ns_access.c @@ -29,14 +29,6 @@ class CommandNSAccess : public Command return MOD_CONT; } -/* reinstate when forbidden is moved to a group flag - if (na->HasFlag(NS_FORBIDDEN)) - { - notice_lang(Config.s_NickServ, u, NICK_X_FORBIDDEN, na->nick); - return MOD_CONT; - } -*/ - if (nc->HasFlag(NI_SUSPENDED)) { notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, nc->display); @@ -107,7 +99,7 @@ class CommandNSAccess : public Command if (nc->access.empty()) { - notice_lang(Config.s_NickServ, u, NICK_ACCESS_LIST_EMPTY, u->nick); + notice_lang(Config.s_NickServ, u, NICK_ACCESS_LIST_EMPTY, u->nick.c_str()); return MOD_CONT; } diff --git a/src/core/ns_alist.c b/src/core/ns_alist.c index e56eb4c06..746dd5737 100644 --- a/src/core/ns_alist.c +++ b/src/core/ns_alist.c @@ -115,10 +115,10 @@ class CommandNSAList : public Command xop = get_xop_level(level); - notice_lang(Config.s_NickServ, u, NICK_ALIST_XOP_FORMAT, match_count, ci->HasFlag(CI_NO_EXPIRE) ? '!' : ' ', ci->name, xop, ci->desc ? ci->desc : ""); + notice_lang(Config.s_NickServ, u, NICK_ALIST_XOP_FORMAT, match_count, ci->HasFlag(CI_NO_EXPIRE) ? '!' : ' ', ci->name.c_str(), xop, ci->desc ? ci->desc : ""); } else - notice_lang(Config.s_NickServ, u, NICK_ALIST_ACCESS_FORMAT, match_count, ci->HasFlag(CI_NO_EXPIRE) ? '!' : ' ', ci->name, level, ci->desc ? ci->desc : ""); + notice_lang(Config.s_NickServ, u, NICK_ALIST_ACCESS_FORMAT, match_count, ci->HasFlag(CI_NO_EXPIRE) ? '!' : ' ', ci->name.c_str(), level, ci->desc ? ci->desc : ""); } } } diff --git a/src/core/ns_drop.c b/src/core/ns_drop.c index 064390cbd..37b43e4c0 100644 --- a/src/core/ns_drop.c +++ b/src/core/ns_drop.c @@ -43,8 +43,8 @@ class CommandNSDrop : public Command if ((nr = findrequestnick(nick)) && u->nc->IsServicesOper()) { if (Config.WallDrop) - ircdproto->SendGlobops(findbot(Config.s_NickServ), "\2%s\2 used DROP on \2%s\2", u->nick, nick); - alog("%s: %s!%s@%s dropped nickname %s (e-mail: %s)", Config.s_NickServ, u->nick, u->GetIdent().c_str(), u->host, nr->nick, nr->email); + 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); 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, u->GetIdent().c_str(), u->host, na->nick, na->nc->display, na->nc->email ? na->nc->email : "none"); + 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"); delete na; FOREACH_MOD(I_OnNickDrop, OnNickDrop(my_nick ? my_nick : nick)); @@ -80,7 +80,7 @@ class CommandNSDrop : public Command if (!is_mine) { if (Config.WallDrop) - ircdproto->SendGlobops(findbot(Config.s_NickServ), "\2%s\2 used DROP on \2%s\2", u->nick, nick); + ircdproto->SendGlobops(findbot(Config.s_NickServ), "\2%s\2 used DROP on \2%s\2", u->nick.c_str(), nick); notice_lang(Config.s_NickServ, u, NICK_X_DROPPED, nick); } else diff --git a/src/core/ns_forbid.c b/src/core/ns_forbid.c index c58dda380..e8d2a4417 100644 --- a/src/core/ns_forbid.c +++ b/src/core/ns_forbid.c @@ -56,7 +56,7 @@ class CommandNSForbid : public Command if (na) { na->SetFlag(NS_FORBIDDEN); - na->last_usermask = sstrdup(u->nick); + na->last_usermask = sstrdup(u->nick.c_str()); if (reason) na->last_realname = sstrdup(reason); @@ -73,16 +73,16 @@ class CommandNSForbid : public Command ircdproto->SendSQLine(na->nick, reason ? reason : "Forbidden"); if (Config.WallForbid) - ircdproto->SendGlobops(findbot(Config.s_NickServ), "\2%s\2 used FORBID on \2%s\2", u->nick, nick); + 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, nick); + alog("%s: %s set FORBID for nick %s", Config.s_NickServ, u->nick.c_str(), 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); + alog("%s: Valid FORBID for %s by %s failed", Config.s_NickServ, nick, u->nick.c_str()); 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 d45d35950..f84c7eac3 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, u->GetIdent().c_str(), u->host, email.c_str()); + 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()); 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 8f4600814..a56b32aba 100644 --- a/src/core/ns_getpass.c +++ b/src/core/ns_getpass.c @@ -33,9 +33,9 @@ class CommandNSGetPass : public Command { if ((nr = findrequestnick(nick))) { - alog("%s: %s!%s@%s used GETPASS on %s", Config.s_NickServ, u->nick, u->GetIdent().c_str(), u->host, nick); + alog("%s: %s!%s@%s used GETPASS on %s", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, nick); if (Config.WallGetpass) - ircdproto->SendGlobops(findbot(Config.s_NickServ), "\2%s\2 used GETPASS on \2%s\2", u->nick, nick); + 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); } else @@ -49,9 +49,9 @@ class CommandNSGetPass : public Command { if (enc_decrypt(na->nc->pass, tmp_pass, PASSMAX - 1) == 1) { - alog("%s: %s!%s@%s used GETPASS on %s", Config.s_NickServ, u->nick, u->GetIdent().c_str(), u->host, nick); + alog("%s: %s!%s@%s used GETPASS on %s", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, nick); if (Config.WallGetpass) - ircdproto->SendGlobops(findbot(Config.s_NickServ), "\2%s\2 used GETPASS on \2%s\2", u->nick, nick); + 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); } else diff --git a/src/core/ns_ghost.c b/src/core/ns_ghost.c index 35b56b57e..152e40d6d 100644 --- a/src/core/ns_ghost.c +++ b/src/core/ns_ghost.c @@ -37,16 +37,15 @@ class CommandNSGhost : public Command notice_lang(Config.s_NickServ, u, NICK_X_FORBIDDEN, na->nick); else if (na->nc->HasFlag(NI_SUSPENDED)) notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, na->nick); - else if (!stricmp(nick, u->nick)) + else if (!stricmp(nick, u->nick.c_str())) notice_lang(Config.s_NickServ, u, NICK_NO_GHOST_SELF); else if (pass) { int res = enc_check_password(pass, na->nc->pass); if (res == 1) { - char buf[NICKMAX + 32]; - snprintf(buf, sizeof(buf), "GHOST command used by %s", u->nick); - kill_user(Config.s_NickServ, nick, buf); + std::string buf = "GHOST command used by " + u->nick; + kill_user(Config.s_NickServ, nick, buf.c_str()); notice_lang(Config.s_NickServ, u, NICK_GHOST_KILLED, nick); } else @@ -54,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, u->GetIdent().c_str(), u->host); + 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); bad_password(u); } } @@ -63,9 +62,8 @@ class CommandNSGhost : public Command { if (u->nc == na->nc || (!(na->nc->HasFlag(NI_SECURE)) && is_on_access(u, na->nc))) { - char buf[NICKMAX + 32]; - snprintf(buf, sizeof(buf), "GHOST command used by %s", u->nick); - kill_user(Config.s_NickServ, nick, buf); + std::string buf = "GHOST command used by " + u->nick; + kill_user(Config.s_NickServ, nick, buf.c_str()); notice_lang(Config.s_NickServ, u, NICK_GHOST_KILLED, nick); } else diff --git a/src/core/ns_group.c b/src/core/ns_group.c index 435e6907b..e9ab9f35e 100644 --- a/src/core/ns_group.c +++ b/src/core/ns_group.c @@ -30,7 +30,7 @@ class CommandNSGroup : public Command const char *pass = params[1].c_str(); std::list<std::pair<std::string, std::string> >::iterator it; - if (Config.NSEmailReg && findrequestnick(u->nick)) + if (Config.NSEmailReg && findrequestnick(u->nick.c_str())) { notice_lang(Config.s_NickServ, u, NICK_REQUESTED); return MOD_CONT; @@ -42,9 +42,9 @@ class CommandNSGroup : public Command return MOD_CONT; } - if (!ircdproto->IsNickValid(u->nick)) + if (!ircdproto->IsNickValid(u->nick.c_str())) { - notice_lang(Config.s_NickServ, u, NICK_X_FORBIDDEN, u->nick); + notice_lang(Config.s_NickServ, u, NICK_X_FORBIDDEN, u->nick.c_str()); return MOD_CONT; } @@ -54,9 +54,9 @@ class CommandNSGroup : public Command { std::string nick = it->first; - if (stristr(u->nick, nick.c_str()) && !is_oper(u)) + if (stristr(u->nick.c_str(), nick.c_str()) && !is_oper(u)) { - notice_lang(Config.s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick); + notice_lang(Config.s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick.c_str()); return MOD_CONT; } } @@ -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, u->GetIdent().c_str(), u->host, target->nick); - notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, u->nick); + 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); + 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, u->GetIdent().c_str(), u->host, target->nick); + 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); 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, u->GetIdent().c_str(), u->host); + alog("%s: Failed GROUP for %s!%s@%s (invalid password)", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host); notice_lang(Config.s_NickServ, u, PASSWORD_INCORRECT); bad_password(u); } @@ -101,11 +101,11 @@ class CommandNSGroup : public Command else { int prefixlen = strlen(Config.NSGuestNickPrefix); - int nicklen = strlen(u->nick); + int nicklen = u->nick.length(); - if (nicklen <= prefixlen + 7 && nicklen >= prefixlen + 1 && stristr(u->nick, Config.NSGuestNickPrefix) == u->nick && strspn(u->nick + prefixlen, "1234567890") == nicklen - prefixlen) + if (nicklen <= prefixlen + 7 && nicklen >= prefixlen + 1 && stristr(u->nick.c_str(), Config.NSGuestNickPrefix) == u->nick.c_str() && strspn(u->nick.c_str() + prefixlen, "1234567890") == nicklen - prefixlen) { - notice_lang(Config.s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick); + notice_lang(Config.s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick.c_str()); return MOD_CONT; } } @@ -124,7 +124,7 @@ 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, u->GetIdent().c_str(), u->host, u->nick, target->nick, target->nc->display, (target->nc->email ? target->nc->email : "none")); + 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")); notice_lang(Config.s_NickServ, u, NICK_GROUP_JOINED, target->nick); u->lastnickreg = time(NULL); @@ -133,7 +133,7 @@ class CommandNSGroup : public Command } else { - alog("%s: makealias(%s) failed", Config.s_NickServ, u->nick); + alog("%s: makealias(%s) failed", Config.s_NickServ, u->nick.c_str()); notice_lang(Config.s_NickServ, u, NICK_GROUP_FAILED); } } @@ -166,12 +166,10 @@ class CommandNSGList : public Command NickCore *nc = u->nc; int i; - if (nick && (stricmp(nick, u->nick) && !u->nc->IsServicesOper())) + if (nick && (stricmp(nick, u->nick.c_str()) && !u->nc->IsServicesOper())) notice_lang(Config.s_NickServ, u, ACCESS_DENIED, Config.s_NickServ); else if (nick && (!findnick(nick) || !(nc = findnick(nick)->nc))) notice_lang(Config.s_NickServ, u, !nick ? NICK_NOT_REGISTERED : NICK_X_NOT_REGISTERED, nick); -/* else if (na->HasFlag(NS_FORBIDDEN)) - notice_lang(Config.s_NickServ, u, NICK_X_FORBIDDEN, na->nick);*/ else { time_t expt; diff --git a/src/core/ns_identify.c b/src/core/ns_identify.c index dc9e6a59e..937604ad8 100644 --- a/src/core/ns_identify.c +++ b/src/core/ns_identify.c @@ -33,9 +33,9 @@ class CommandNSIdentify : public Command NickRequest *nr; int res; - if (!(na = findnick(u->nick))) + if (!(na = findnick(u->nick.c_str()))) { - if ((nr = findrequestnick(u->nick))) + if ((nr = findrequestnick(u->nick.c_str()))) notice_lang(Config.s_NickServ, u, NICK_IS_PREREG); else notice_lang(Config.s_NickServ, u, NICK_NOT_REGISTERED); @@ -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, u->GetIdent().c_str(), u->host); + alog("%s: Failed IDENTIFY for %s!%s@%s", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), 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, u->GetIdent().c_str(), u->host, u->nc->display); + 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); } 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, u->GetIdent().c_str(), u->host, u->nick); + 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()); 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 ed85370a5..52d27a5ce 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, u->GetIdent().c_str(), u->host, u2->nick); + 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()); /* 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 f20855c1d..c2b8a15aa 100644 --- a/src/core/ns_recover.c +++ b/src/core/ns_recover.c @@ -38,7 +38,7 @@ class CommandNSRecover : public Command notice_lang(Config.s_NickServ, u, NICK_X_FORBIDDEN, na->nick); else if (na->nc->HasFlag(NI_SUSPENDED)) notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, na->nick); - else if (!stricmp(nick, u->nick)) + else if (!stricmp(nick, u->nick.c_str())) notice_lang(Config.s_NickServ, u, NICK_NO_RECOVER_SELF); else if (pass) { @@ -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, u->GetIdent().c_str(), u->host); + 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); bad_password(u); } } diff --git a/src/core/ns_register.c b/src/core/ns_register.c index 6b8eb9457..5f603219d 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); + alog("%s: makenick(%s) failed", Config.s_NickServ, u->nick.c_str()); notice_lang(Config.s_NickServ, u, NICK_REGISTRATION_FAILED); return MOD_CONT; } @@ -61,11 +61,11 @@ 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, u->GetIdent().c_str(), u->host, nr->email ? nr->email : "none"); + 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"); if (Config.NSAddAccessOnReg) - notice_lang(Config.s_NickServ, u, NICK_REGISTERED, u->nick, na->nc->GetAccess(0).c_str()); + notice_lang(Config.s_NickServ, u, NICK_REGISTERED, u->nick.c_str(), na->nc->GetAccess(0).c_str()); else - notice_lang(Config.s_NickServ, u, NICK_REGISTERED_NO_MASK, u->nick); + notice_lang(Config.s_NickServ, u, NICK_REGISTERED_NO_MASK, u->nick.c_str()); delete nr; ircdproto->SendAccountLogin(u, u->nc); @@ -78,7 +78,7 @@ class CommandNSConfirm : public Command } else { - alog("%s: '%s' confirmed by %s!%s@%s (email: %s)", Config.s_NickServ, nr->nick, u->nick, u->GetIdent().c_str(), u->host, nr->email ? nr->email : "none"); + 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"); notice_lang(Config.s_NickServ, u, NICK_FORCE_REG, nr->nick); @@ -99,7 +99,7 @@ class CommandNSConfirm : public Command NickRequest *nr = NULL; const char *passcode = !params.empty() ? params[0].c_str() : NULL; - nr = findrequestnick(u->nick); + nr = findrequestnick(u->nick.c_str()); if (Config.NSEmailReg) { @@ -182,7 +182,7 @@ class CommandNSRegister : public CommandNSConfirm NickRequest *nr = NULL, *anr = NULL; NickAlias *na; int prefixlen = strlen(Config.NSGuestNickPrefix); - int nicklen = strlen(u->nick); + int nicklen = u->nick.length(); const char *pass = params[0].c_str(); const char *email = params.size() > 1 ? params[1].c_str() : NULL; char passcode[11]; @@ -208,7 +208,7 @@ class CommandNSRegister : public CommandNSConfirm return MOD_CONT; } - if ((anr = findrequestnick(u->nick))) + if ((anr = findrequestnick(u->nick.c_str()))) { notice_lang(Config.s_NickServ, u, NICK_REQUESTED); return MOD_CONT; @@ -219,15 +219,15 @@ class CommandNSRegister : public CommandNSConfirm /* Guest nick can now have a series of between 1 and 7 digits. * --lara */ - if (nicklen <= prefixlen + 7 && nicklen >= prefixlen + 1 && stristr(u->nick, Config.NSGuestNickPrefix) == u->nick && strspn(u->nick + prefixlen, "1234567890") == nicklen - prefixlen) + if (nicklen <= prefixlen + 7 && nicklen >= prefixlen + 1 && stristr(u->nick.c_str(), Config.NSGuestNickPrefix) == u->nick.c_str() && strspn(u->nick.c_str() + prefixlen, "1234567890") == nicklen - prefixlen) { - notice_lang(Config.s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick); + notice_lang(Config.s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick.c_str()); return MOD_CONT; } - if (!ircdproto->IsNickValid(u->nick)) + if (!ircdproto->IsNickValid(u->nick.c_str())) { - notice_lang(Config.s_NickServ, u, NICK_X_FORBIDDEN, u->nick); + notice_lang(Config.s_NickServ, u, NICK_X_FORBIDDEN, u->nick.c_str()); return MOD_CONT; } @@ -237,9 +237,9 @@ class CommandNSRegister : public CommandNSConfirm { std::string nick = it->first; - if (stristr(u->nick, nick.c_str()) && !is_oper(u)) + if (stristr(u->nick.c_str(), nick.c_str()) && !is_oper(u)) { - notice_lang(Config.s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick); + notice_lang(Config.s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick.c_str()); return MOD_CONT; } } @@ -249,18 +249,18 @@ class CommandNSRegister : public CommandNSConfirm this->OnSyntaxError(u, ""); else if (time(NULL) < u->lastnickreg + Config.NSRegDelay) notice_lang(Config.s_NickServ, u, NICK_REG_PLEASE_WAIT, (u->lastnickreg + Config.NSRegDelay) - time(NULL)); - else if ((na = findnick(u->nick))) + else if ((na = findnick(u->nick.c_str()))) { /* 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); - notice_lang(Config.s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick); + alog("%s: %s@%s tried to register FORBIDden nick %s", Config.s_NickServ, u->GetIdent().c_str(), u->host, u->nick.c_str()); + notice_lang(Config.s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick.c_str()); } else - notice_lang(Config.s_NickServ, u, NICK_ALREADY_REGISTERED, u->nick); + notice_lang(Config.s_NickServ, u, NICK_ALREADY_REGISTERED, u->nick.c_str()); } - else if (!stricmp(u->nick, pass) || (Config.StrictPasswords && strlen(pass) < 5)) + else if (!stricmp(u->nick.c_str(), pass) || (Config.StrictPasswords && strlen(pass) < 5)) notice_lang(Config.s_NickServ, u, MORE_OBSCURE_PASSWORD); else if (enc_encrypt_check_len(strlen(pass), PASSMAX - 1)) notice_lang(Config.s_NickServ, u, PASSWORD_TOO_LONG); @@ -332,7 +332,7 @@ class CommandNSResend : public Command NickRequest *nr = NULL; if (Config.NSEmailReg) { - if ((nr = findrequestnick(u->nick))) + if ((nr = findrequestnick(u->nick.c_str()))) { if (time(NULL) < nr->lastmail + Config.NSResendDelay) { diff --git a/src/core/ns_release.c b/src/core/ns_release.c index f36f2b8f7..c5f33cf65 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, u->GetIdent().c_str(), u->host); + 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); bad_password(u); } } diff --git a/src/core/ns_resetpass.c b/src/core/ns_resetpass.c index e8396398c..32958a5e4 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, u->GetIdent().c_str(), u->host, na->nick, na->nc->display); + 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); notice_lang(Config.s_NickServ, u, NICK_RESETPASS_COMPLETE, na->nick); } @@ -144,7 +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, u->GetIdent().c_str(), u->host, na->nick); + 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); notice_lang(Config.s_NickServ, u, NICK_CONFIRM_SUCCESS, Config.s_NickServ); @@ -156,7 +156,7 @@ class NSResetPass : public Module } else { - alog("%s: Invalid CONFIRM passcode for %s from %s!%s@%s", Config.s_NickServ, na->nick, u->nick, u->GetIdent().c_str(), u->host); + 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); 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 28ba915bd..a4207a27b 100644 --- a/src/core/ns_saset.c +++ b/src/core/ns_saset.c @@ -93,9 +93,9 @@ 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, u->GetIdent().c_str(), u->host, nc->display, nc->email ? nc->email : "none"); + 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"); if (Config.WallSetpass) - ircdproto->SendGlobops(findbot(Config.s_NickServ), "\2%s\2 used SASET PASSWORD on \2%s\2", u->nick, nc->display); + 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, u->GetIdent().c_str(), u->host, nc->display, nc->email ? nc->email : "none"); + 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"); if (nc->email) delete [] nc->email; diff --git a/src/core/ns_sendpass.c b/src/core/ns_sendpass.c index 549435bcd..1b4e10839 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, u->GetIdent().c_str(), u->host, nick); + alog("%s: %s!%s@%s used SENDPASS on %s", Config.s_NickServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, 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 d27d87a2d..0e1051e3e 100644 --- a/src/core/ns_set.c +++ b/src/core/ns_set.c @@ -89,7 +89,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, u->GetIdent().c_str(), u->host, nc->email ? nc->email : "none"); + 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"); return MOD_CONT; } @@ -157,7 +157,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, u->GetIdent().c_str(), u->host, nc->email ? nc->email : "none", param ? param : "none"); + 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"); if (nc->email) delete [] nc->email; diff --git a/src/core/ns_status.c b/src/core/ns_status.c index 8f828e645..f86c0845a 100644 --- a/src/core/ns_status.c +++ b/src/core/ns_status.c @@ -27,34 +27,27 @@ class CommandNSStatus : public Command { User *u2; NickAlias *na = NULL; - unsigned i = 0; - const char *nick = params.size() ? params[0].c_str() : NULL; + std::string nick = params.size() ? params[0].c_str() : u->nick; + spacesepstream sep(nick); + std::string nickbuf; - /* If no nickname is given, we assume that the user - * is asking for himself */ - if (!nick) - nick = u->nick; - - while (nick && i++ < 16) + while (sep.GetToken(nickbuf)) { na = findnick(nick); - if (!(u2 = finduser(nick))) /* Nick is not online */ - notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nick, 0, ""); + if (!(u2 = finduser(nickbuf))) /* Nick is not online */ + notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nickbuf.c_str(), 0, ""); else if (nick_identified(u2) && na && na->nc == u2->nc) /* Nick is identified */ - notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nick, 3, u2->nc->display); + notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nickbuf.c_str(), 3, u2->nc->display); else if (u2->IsRecognized()) /* Nick is recognised, but NOT identified */ - notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nick, 2, (u2->nc ? u2->nc->display : "")); + notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nickbuf.c_str(), 2, (u2->nc ? u2->nc->display : "")); else if (!na) /* Nick is online, but NOT a registered */ - notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nick, 0, ""); + notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nickbuf.c_str(), 0, ""); else /* Nick is not identified for the nick, but they could be logged into an account, * so we tell the user about it */ - notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nick, 1, (u2->nc ? u2->nc->display : "")); - - /* Get the next nickname */ - nick = params.size() > i ? params[i].c_str() : NULL; + notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nickbuf.c_str(), 1, (u2->nc ? u2->nc->display : "")); } return MOD_CONT; } diff --git a/src/core/ns_suspend.c b/src/core/ns_suspend.c index 330e96222..5e4407b89 100644 --- a/src/core/ns_suspend.c +++ b/src/core/ns_suspend.c @@ -79,16 +79,16 @@ class CommandNSSuspend : public Command } if (Config.WallForbid) - ircdproto->SendGlobops(findbot(Config.s_NickServ), "\2%s\2 used SUSPEND on \2%s\2", u->nick, nick); + 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, nick); + alog("%s: %s set SUSPEND for nick %s", Config.s_NickServ, u->nick.c_str(), 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); + alog("%s: Valid SUSPEND for %s by %s failed", Config.s_NickServ, nick, u->nick.c_str()); notice_lang(Config.s_NickServ, u, NICK_SUSPEND_FAILED, nick); } return MOD_CONT; @@ -147,16 +147,16 @@ class CommandNSUnSuspend : public Command na->nc->UnsetFlag(NI_SUSPENDED); if (Config.WallForbid) - ircdproto->SendGlobops(findbot(Config.s_NickServ), "\2%s\2 used UNSUSPEND on \2%s\2", u->nick, nick); + 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, nick); + alog("%s: %s set UNSUSPEND for nick %s", Config.s_NickServ, u->nick.c_str(), 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); + alog("%s: Valid UNSUSPEND for %s by %s failed", Config.s_NickServ, nick, u->nick.c_str()); notice_lang(Config.s_NickServ, u, NICK_UNSUSPEND_FAILED, nick); } return MOD_CONT; diff --git a/src/core/os_akill.c b/src/core/os_akill.c index 7561cb0e6..87bc8743b 100644 --- a/src/core/os_akill.c +++ b/src/core/os_akill.c @@ -28,7 +28,7 @@ class CommandOSAKill : public Command int deleted = 0; unsigned last_param = 2; const char *expiry, *mask; - char reason[BUFSIZE], realreason[BUFSIZE]; + char reason[BUFSIZE]; time_t expires; mask = params.size() > 1 ? params[1].c_str() : NULL; @@ -82,17 +82,13 @@ class CommandOSAKill : public Command return MOD_CONT; } - /** - * Changed sprintf() to snprintf()and increased the size of - * breason to match bufsize - * -Rob - **/ + std::string realreason; if (Config.AddAkiller) - snprintf(realreason, sizeof(realreason), "[%s] %s", u->nick, reason); + realreason = "[" + u->nick + "] " + std::string(reason); else - snprintf(realreason, sizeof(realreason), "%s", reason); + realreason = reason; - deleted = add_akill(u, mask, u->nick, expires, realreason); + deleted = add_akill(u, mask, u->nick.c_str(), expires, realreason.c_str()); if (deleted < 0) return MOD_CONT; else if (deleted) @@ -129,7 +125,7 @@ class CommandOSAKill : public Command snprintf(buf, sizeof(buf), "expires in %d %s%s", wall_expiry, s, wall_expiry == 1 ? "" : "s"); } - ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s added an AKILL for %s (%s) (%s)", u->nick, mask, realreason, buf); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s added an AKILL for %s (%s) (%s)", u->nick.c_str(), mask, realreason.c_str(), buf); } if (readonly) diff --git a/src/core/os_chankill.c b/src/core/os_chankill.c index d4003412f..67d84d635 100644 --- a/src/core/os_chankill.c +++ b/src/core/os_chankill.c @@ -25,7 +25,7 @@ class CommandOSChanKill : public Command CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) { const char *expiry, *channel; - char reason[BUFSIZE], realreason[BUFSIZE]; + char reason[BUFSIZE]; time_t expires; char mask[USERMAX + HOSTMAX + 2]; struct c_userlist *cu, *cunext; @@ -62,10 +62,11 @@ class CommandOSChanKill : public Command if (*reason) { + std::string realreason; if (Config.AddAkiller) - snprintf(realreason, sizeof(realreason), "[%s] %s", u->nick, reason); + realreason = "[" + u->nick + "] " + std::string(reason); else - snprintf(realreason, sizeof(realreason), "%s", reason); + realreason = reason; if ((c = findchan(channel))) { @@ -76,11 +77,11 @@ class CommandOSChanKill : public Command continue; strlcpy(mask, "*@", sizeof(mask)); /* Use *@" for the akill's, */ strlcat(mask, cu->user->host, sizeof(mask)); - add_akill(NULL, mask, Config.s_OperServ, expires, realreason); - check_akill(cu->user->nick, cu->user->GetIdent().c_str(), cu->user->host, NULL, NULL); + add_akill(NULL, mask, Config.s_OperServ, expires, realreason.c_str()); + check_akill(cu->user->nick.c_str(), cu->user->GetIdent().c_str(), cu->user->host, NULL, NULL); } if (Config.WallOSAkill) - ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s used CHANKILL on %s (%s)", u->nick, channel, realreason); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s used CHANKILL on %s (%s)", u->nick.c_str(), channel, realreason.c_str()); } else notice_lang(Config.s_OperServ, u, CHAN_X_NOT_IN_USE, channel); diff --git a/src/core/os_chanlist.c b/src/core/os_chanlist.c index 7adaf8c42..6f2c1bee3 100644 --- a/src/core/os_chanlist.c +++ b/src/core/os_chanlist.c @@ -39,7 +39,7 @@ class CommandOSChanList : public Command { struct u_chanlist *uc; - notice_lang(Config.s_OperServ, u, OPER_CHANLIST_HEADER_USER, u2->nick); + notice_lang(Config.s_OperServ, u, OPER_CHANLIST_HEADER_USER, u2->nick.c_str()); for (uc = u2->chans; uc; uc = uc->next) { @@ -52,7 +52,7 @@ class CommandOSChanList : public Command } } - notice_lang(Config.s_OperServ, u, OPER_CHANLIST_RECORD, uc->chan->name, uc->chan->usercount, chan_get_modes(uc->chan, 1, 1), uc->chan->topic ? uc->chan->topic : ""); + notice_lang(Config.s_OperServ, u, OPER_CHANLIST_RECORD, uc->chan->name.c_str(), uc->chan->usercount, chan_get_modes(uc->chan, 1, 1), uc->chan->topic ? uc->chan->topic : ""); } } else @@ -76,7 +76,7 @@ class CommandOSChanList : public Command continue; } } - notice_lang(Config.s_OperServ, u, OPER_CHANLIST_RECORD, c->name, c->usercount, chan_get_modes(c, 1, 1), c->topic ? c->topic : ""); + notice_lang(Config.s_OperServ, u, OPER_CHANLIST_RECORD, c->name.c_str(), c->usercount, chan_get_modes(c, 1, 1), c->topic ? c->topic : ""); } } } diff --git a/src/core/os_clearmodes.c b/src/core/os_clearmodes.c index d35faa3ae..b1a5a893a 100644 --- a/src/core/os_clearmodes.c +++ b/src/core/os_clearmodes.c @@ -54,7 +54,7 @@ class CommandOSClearModes : public Command } if (Config.WallOSClearmodes) - ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s used CLEARMODES%s on %s", u->nick, all ? " ALL" : "", chan); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s used CLEARMODES%s on %s", u->nick.c_str(), all ? " ALL" : "", chan); if (all) { /* Clear mode +o */ diff --git a/src/core/os_defcon.c b/src/core/os_defcon.c index e336ad6fa..46aa64131 100644 --- a/src/core/os_defcon.c +++ b/src/core/os_defcon.c @@ -95,8 +95,8 @@ 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); - ircdproto->SendGlobops(findbot(Config.s_OperServ), getstring(OPER_DEFCON_WALL), u->nick, newLevel); + alog("Defcon level changed to %d by Oper %s", newLevel, u->nick.c_str()); + 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. */ if (Config.GlobalOnDefcon) @@ -296,9 +296,9 @@ class OSDEFCON : public Module if (session && session->count > Config.DefConSessionLimit) { if (Config.SessionLimitExceeded) - ircdproto->SendMessage(findbot(Config.s_OperServ), u->nick, Config.SessionLimitExceeded, u->host); + ircdproto->SendMessage(findbot(Config.s_OperServ), u->nick.c_str(), Config.SessionLimitExceeded, u->host); if (Config.SessionLimitDetailsLoc) - ircdproto->SendMessage(findbot(Config.s_OperServ), u->nick, "%s", Config.SessionLimitDetailsLoc); + ircdproto->SendMessage(findbot(Config.s_OperServ), u->nick.c_str(), "%s", Config.SessionLimitDetailsLoc); kill_user(Config.s_OperServ, u->nick, "Session limit exceeded"); session->hits++; diff --git a/src/core/os_global.c b/src/core/os_global.c index c311f0809..425ace3d9 100644 --- a/src/core/os_global.c +++ b/src/core/os_global.c @@ -27,8 +27,8 @@ class CommandOSGlobal : public Command const char *msg = params[0].c_str(); if (Config.WallOSGlobal) - ircdproto->SendGlobops(findbot(Config.s_OperServ), "\2%s\2 just used GLOBAL command.", u->nick); - oper_global(u->nick, "%s", msg); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "\2%s\2 just used GLOBAL command.", u->nick.c_str()); + oper_global(const_cast<char *>(u->nick.c_str()), "%s", msg); return MOD_CONT; } diff --git a/src/core/os_jupe.c b/src/core/os_jupe.c index 63274e4fc..cebe3f5dc 100644 --- a/src/core/os_jupe.c +++ b/src/core/os_jupe.c @@ -34,14 +34,14 @@ class CommandOSJupe : public Command notice_lang(Config.s_OperServ, u, OPER_JUPE_INVALID_SERVER); else { char rbuf[256]; - snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", u->nick, reason ? ": " : "", reason ? reason : ""); + snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", u->nick.c_str(), reason ? ": " : "", reason ? reason : ""); if (findserver(servlist, jserver)) ircdproto->SendSquit(jserver, rbuf); Server *juped_server = new_server(me_server, jserver, rbuf, SERVER_JUPED, ircd->ts6 ? ts6_sid_retrieve() : NULL); ircdproto->SendServer(juped_server); if (Config.WallOSJupe) - ircdproto->SendGlobops(findbot(Config.s_OperServ), "\2%s\2 used JUPE on \2%s\2", u->nick, jserver); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "\2%s\2 used JUPE on \2%s\2", u->nick.c_str(), jserver); } return MOD_CONT; } diff --git a/src/core/os_kick.c b/src/core/os_kick.c index ea2b529de..096e81c4c 100644 --- a/src/core/os_kick.c +++ b/src/core/os_kick.c @@ -45,11 +45,11 @@ class CommandOSKick : public Command return MOD_CONT; } - ircdproto->SendKick(findbot(Config.s_OperServ), c, u2, "%s (%s)", u->nick, s); + ircdproto->SendKick(findbot(Config.s_OperServ), c, u2, "%s (%s)", u->nick.c_str(), s); if (Config.WallOSKick) - ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s used KICK on %s/%s", u->nick, u2->nick, chan); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s used KICK on %s/%s", u->nick.c_str(), u2->nick.c_str(), chan); argv[0] = sstrdup(chan); - argv[1] = sstrdup(u2->nick); + argv[1] = sstrdup(u2->nick.c_str()); argv[2] = sstrdup(s); do_kick(Config.s_OperServ, 3, argv); delete [] argv[2]; diff --git a/src/core/os_mode.c b/src/core/os_mode.c index beb225a0c..d02217f6b 100644 --- a/src/core/os_mode.c +++ b/src/core/os_mode.c @@ -36,7 +36,7 @@ class CommandOSMode : public Command c->SetModes(findbot(Config.s_OperServ), false, modes); if (Config.WallOSMode) - ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s used MODE %s on %s", u->nick, modes, chan); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s used MODE %s on %s", u->nick.c_str(), modes, chan); } return MOD_CONT; } diff --git a/src/core/os_news.c b/src/core/os_news.c index 877dd71d6..ed33e010f 100644 --- a/src/core/os_news.c +++ b/src/core/os_news.c @@ -146,7 +146,7 @@ static int add_newsitem(User * u, const char *text, NewsType type) news->num = num + 1; news->Text = text; news->time = time(NULL); - strscpy(news->who, u->nick, NICKMAX); + news->who = u->nick; News.push_back(news); @@ -199,7 +199,7 @@ class NewsBase : public Command notice_lang(Config.s_OperServ, u, msgs[MSG_LIST_HEADER]); tm = localtime(&News[i]->time); strftime_lang(timebuf, sizeof(timebuf), u, STRFTIME_DATE_TIME_FORMAT, tm); - notice_lang(Config.s_OperServ, u, msgs[MSG_LIST_ENTRY], News[i]->num, timebuf, *News[i]->who ? News[i]->who : "<unknown>", News[i]->Text.c_str()); + notice_lang(Config.s_OperServ, u, msgs[MSG_LIST_ENTRY], News[i]->num, timebuf, !News[i]->who.empty() ? News[i]->who.c_str() : "<unknown>", News[i]->Text.c_str()); ++count; } } @@ -440,7 +440,7 @@ class OSNews : public Module NewsItem *n = new NewsItem; n->num = atoi(params[2].c_str()); n->time = strtol(params[3].c_str(), NULL, 10); - strscpy(n->who, params[4].c_str(), NICKMAX); + n->who = params[4]; if (params[5] == "LOGON") n->type = NEWS_LOGON; else if (params[5] == "RANDOM") @@ -469,7 +469,7 @@ class OSNews : public Module 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, 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_noop.c b/src/core/os_noop.c index 86d454d3b..48ab97f90 100644 --- a/src/core/os_noop.c +++ b/src/core/os_noop.c @@ -31,14 +31,14 @@ class CommandOSNOOP : public Command { User *u2; User *u3 = NULL; - char reason[NICKMAX + 32]; + std::string reason; /* Remove the O:lines */ ircdproto->SendSVSNOOP(server, 1); - snprintf(reason, sizeof(reason), "NOOP command used by %s", u->nick); + reason = "NOOP command used by " + u->nick; if (Config.WallOSNoOp) - ircdproto->SendGlobops(findbot(Config.s_OperServ), "\2%s\2 used NOOP on \2%s\2", u->nick, server); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "\2%s\2 used NOOP on \2%s\2", u->nick.c_str(), server); notice_lang(Config.s_OperServ, u, OPER_NOOP_SET, server); /* Kill all the IRCops of the server */ @@ -46,7 +46,7 @@ class CommandOSNOOP : public Command { u3 = nextuser(); if (u2 && is_oper(u2) && u2->server->name && Anope::Match(u2->server->name, server, true)) - kill_user(Config.s_OperServ, u2->nick, reason); + kill_user(Config.s_OperServ, u2->nick.c_str(), reason.c_str()); } } else if (cmd == "REVOKE") diff --git a/src/core/os_oline.c b/src/core/os_oline.c index 4e13388c5..f64534315 100644 --- a/src/core/os_oline.c +++ b/src/core/os_oline.c @@ -37,13 +37,13 @@ class CommandOSOLine : public Command u2->SetMode(findbot(Config.s_OperServ), UMODE_OPER); notice_lang(Config.s_OperServ, u2, OPER_OLINE_IRCOP); notice_lang(Config.s_OperServ, u, OPER_OLINE_SUCCESS, flag, nick); - ircdproto->SendGlobops(findbot(Config.s_OperServ), "\2%s\2 used OLINE for %s", u->nick, nick); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "\2%s\2 used OLINE for %s", u->nick.c_str(), nick); } else if (u2 && flag[0] == '-') { ircdproto->SendSVSO(Config.s_OperServ, nick, flag); notice_lang(Config.s_OperServ, u, OPER_OLINE_SUCCESS, flag, nick); - ircdproto->SendGlobops(findbot(Config.s_OperServ), "\2%s\2 used OLINE for %s", u->nick, nick); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "\2%s\2 used OLINE for %s", u->nick.c_str(), nick); } else this->OnSyntaxError(u, ""); diff --git a/src/core/os_quit.c b/src/core/os_quit.c index 825208a41..9e9e05980 100644 --- a/src/core/os_quit.c +++ b/src/core/os_quit.c @@ -25,11 +25,11 @@ class CommandOSQuit : public Command CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) { - quitmsg = new char[28 + strlen(u->nick)]; + quitmsg = new char[28 + u->nick.length()]; if (!quitmsg) quitmsg = "QUIT command received, but out of memory!"; else - sprintf(const_cast<char *>(quitmsg), "QUIT command received from %s", u->nick); // XXX we know this is safe, but.. + sprintf(const_cast<char *>(quitmsg), "QUIT command received from %s", u->nick.c_str()); // XXX we know this is safe, but.. if (Config.GlobalOnCycle) oper_global(NULL, "%s", Config.GlobalOnCycleMessage); diff --git a/src/core/os_reload.c b/src/core/os_reload.c index 52479023a..fab60b5db 100644 --- a/src/core/os_reload.c +++ b/src/core/os_reload.c @@ -26,7 +26,7 @@ class CommandOSReload : public Command { if (!read_config(1)) { - quitmsg = new char[28 + strlen(u->nick)]; + quitmsg = new char[28 + u->nick.length()]; if (!quitmsg) quitmsg = "Error during the reload of the configuration file, but out of memory!"; else diff --git a/src/core/os_restart.c b/src/core/os_restart.c index 716bd16d6..8be71237f 100644 --- a/src/core/os_restart.c +++ b/src/core/os_restart.c @@ -24,11 +24,11 @@ class CommandOSRestart : public Command CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) { - quitmsg = new char[31 + strlen(u->nick)]; + quitmsg = new char[31 + u->nick.length()]; if (!quitmsg) quitmsg = "RESTART command received, but out of memory!"; else - sprintf(const_cast<char *>(quitmsg), /* XXX */ "RESTART command received from %s", u->nick); + sprintf(const_cast<char *>(quitmsg), /* XXX */ "RESTART command received from %s", u->nick.c_str()); if (Config.GlobalOnCycle) oper_global(NULL, "%s", Config.GlobalOnCycleMessage); diff --git a/src/core/os_session.c b/src/core/os_session.c index 7c515cd0b..db7579ee1 100644 --- a/src/core/os_session.c +++ b/src/core/os_session.c @@ -167,7 +167,7 @@ static int exception_view(User *u, const int index, int *sent_header) expire_left(u->nc, expirebuf, sizeof(expirebuf), exceptions[index].expires); - notice_lang(Config.s_OperServ, u, OPER_EXCEPTION_VIEW_FORMAT, index + 1, exceptions[index].mask, *exceptions[index].who ? exceptions[index].who : "<unknown>", timebuf, expirebuf, exceptions[index].limit, exceptions[index].reason); + notice_lang(Config.s_OperServ, u, OPER_EXCEPTION_VIEW_FORMAT, index + 1, exceptions[index].mask, !exceptions[index].who.empty() ? exceptions[index].who.c_str() : "<unknown>", timebuf, expirebuf, exceptions[index].limit, exceptions[index].reason); return 1; } @@ -243,7 +243,7 @@ class CommandOSException : public Command return MOD_CONT; } - x = exception_add(u, mask, limit, reason, u->nick, expires); + x = exception_add(u, mask, limit, reason, u->nick.c_str(), expires); if (x == 1) notice_lang(Config.s_OperServ, u, OPER_EXCEPTION_ADDED, mask, limit); diff --git a/src/core/os_set.c b/src/core/os_set.c index 745da0e47..a81de7716 100644 --- a/src/core/os_set.c +++ b/src/core/os_set.c @@ -155,15 +155,15 @@ 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); - ircdproto->SendGlobops(findbot(Config.s_OperServ), getstring(OPER_SUPER_ADMIN_WALL_ON), u->nick); + alog("%s: %s is a SuperAdmin ", Config.s_OperServ, u->nick.c_str()); + 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); - ircdproto->SendGlobops(findbot(Config.s_OperServ), getstring(OPER_SUPER_ADMIN_WALL_OFF), u->nick); + alog("%s: %s is no longer a SuperAdmin", Config.s_OperServ, u->nick.c_str()); + ircdproto->SendGlobops(findbot(Config.s_OperServ), getstring(OPER_SUPER_ADMIN_WALL_OFF), u->nick.c_str()); } else notice_lang(Config.s_OperServ, u, OPER_SUPER_ADMIN_SYNTAX); diff --git a/src/core/os_sgline.c b/src/core/os_sgline.c index a8563e1b2..1824d8fa0 100644 --- a/src/core/os_sgline.c +++ b/src/core/os_sgline.c @@ -92,7 +92,7 @@ class CommandOSSGLine : public Command return MOD_CONT; } - deleted = add_sgline(u, cmask, u->nick, expires, reason.c_str()); + deleted = add_sgline(u, cmask, u->nick.c_str(), expires, reason.c_str()); if (deleted < 0) return MOD_CONT; else if (deleted) @@ -129,7 +129,7 @@ class CommandOSSGLine : public Command snprintf(buf, sizeof(buf), "expires in %d %s%s", wall_expiry, s, wall_expiry == 1 ? "" : "s"); } - ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s added an SGLINE for %s (%s)", u->nick, cmask, buf); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s added an SGLINE for %s (%s)", u->nick.c_str(), cmask, buf); } if (readonly) diff --git a/src/core/os_shutdown.c b/src/core/os_shutdown.c index e2039c498..d86252fb5 100644 --- a/src/core/os_shutdown.c +++ b/src/core/os_shutdown.c @@ -25,11 +25,11 @@ class CommandOSShutdown : public Command CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) { - quitmsg = new char[32 + strlen(u->nick)]; + quitmsg = new char[32 + u->nick.length()]; if (!quitmsg) quitmsg = "SHUTDOWN command received, but out of memory!"; else - sprintf(const_cast<char *>(quitmsg), /* XXX */ "SHUTDOWN command received from %s", u->nick); + sprintf(const_cast<char *>(quitmsg), /* XXX */ "SHUTDOWN command received from %s", u->nick.c_str()); if (Config.GlobalOnCycle) oper_global(NULL, "%s", Config.GlobalOnCycleMessage); diff --git a/src/core/os_sqline.c b/src/core/os_sqline.c index 9fe786d36..0be47a60a 100644 --- a/src/core/os_sqline.c +++ b/src/core/os_sqline.c @@ -78,7 +78,7 @@ class CommandOSSQLine : public Command return MOD_CONT; } - deleted = add_sqline(u, mask, u->nick, expires, reason); + deleted = add_sqline(u, mask, u->nick.c_str(), expires, reason); if (deleted < 0) return MOD_CONT; else if (deleted) @@ -115,7 +115,7 @@ class CommandOSSQLine : public Command snprintf(buf, sizeof(buf), "expires in %d %s%s", wall_expiry, s, wall_expiry == 1 ? "" : "s"); } - ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s added an SQLINE for %s (%s)", u->nick, mask, buf); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s added an SQLINE for %s (%s)", u->nick.c_str(), mask, buf); } if (readonly) diff --git a/src/core/os_staff.c b/src/core/os_staff.c index 161022490..2b3661d75 100644 --- a/src/core/os_staff.c +++ b/src/core/os_staff.c @@ -54,7 +54,7 @@ class CommandOSStaff : public Command if ((au = finduser(na->nick))) { found = 1; - notice_lang(Config.s_OperServ, u, OPER_STAFF_AFORMAT, '*', type.c_str(), nick.c_str(), u->nick); + notice_lang(Config.s_OperServ, u, OPER_STAFF_AFORMAT, '*', type.c_str(), nick.c_str(), u->nick.c_str()); } } } diff --git a/src/core/os_svsnick.c b/src/core/os_svsnick.c index 67059fb80..8d3cf146f 100644 --- a/src/core/os_svsnick.c +++ b/src/core/os_svsnick.c @@ -31,10 +31,10 @@ class CommandOSSVSNick : public Command NickAlias *na; /* Truncate long nicknames to NICKMAX-2 characters */ - if (newnick.length() > NICKMAX - 2) + if (newnick.length() > Config.NickLen) { - notice_lang(Config.s_OperServ, u, NICK_X_TRUNCATED, newnick.c_str(), NICKMAX - 2, newnick.c_str()); - newnick = params[1].substr(0, NICKMAX - 2); + notice_lang(Config.s_OperServ, u, NICK_X_TRUNCATED, newnick.c_str(), Config.NickLen, newnick.c_str()); + newnick = params[1].substr(0, Config.NickLen); } /* Check for valid characters */ @@ -62,7 +62,7 @@ class CommandOSSVSNick : public Command else { notice_lang(Config.s_OperServ, u, OPER_SVSNICK_NEWNICK, nick, newnick.c_str()); - ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s used SVSNICK to change %s to %s", u->nick, nick, newnick.c_str()); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s used SVSNICK to change %s to %s", u->nick.c_str(), nick, newnick.c_str()); ircdproto->SendForceNickChange(u2, newnick.c_str(), time(NULL)); } return MOD_CONT; diff --git a/src/core/os_szline.c b/src/core/os_szline.c index 4b1661077..07e560747 100644 --- a/src/core/os_szline.c +++ b/src/core/os_szline.c @@ -78,7 +78,7 @@ class CommandOSSZLine : public Command return MOD_CONT; } - deleted = add_szline(u, mask, u->nick, expires, reason); + deleted = add_szline(u, mask, u->nick.c_str(), expires, reason); if (deleted < 0) return MOD_CONT; else if (deleted) @@ -115,7 +115,7 @@ class CommandOSSZLine : public Command snprintf(buf, sizeof(buf), "expires in %d %s%s", wall_expiry, s, wall_expiry == 1 ? "" : "s"); } - ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s added an SZLINE for %s (%s)", u->nick, mask, buf); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s added an SZLINE for %s (%s)", u->nick.c_str(), mask, buf); } if (readonly) diff --git a/src/core/os_umode.c b/src/core/os_umode.c index 70edf8ddc..a5ae9cb80 100644 --- a/src/core/os_umode.c +++ b/src/core/os_umode.c @@ -45,10 +45,10 @@ class CommandOSUMode : public Command u2->SetModes(findbot(Config.s_OperServ), modes); notice_lang(Config.s_OperServ, u, OPER_UMODE_SUCCESS, nick); - notice_lang(Config.s_OperServ, u2, OPER_UMODE_CHANGED, u->nick); + notice_lang(Config.s_OperServ, u2, OPER_UMODE_CHANGED, u->nick.c_str()); if (Config.WallOSMode) - ircdproto->SendGlobops(findbot(Config.s_OperServ), "\2%s\2 used UMODE on %s", u->nick, nick); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "\2%s\2 used UMODE on %s", u->nick.c_str(), nick); } return MOD_CONT; } diff --git a/src/core/os_userlist.c b/src/core/os_userlist.c index 681d8ece3..c157ca97b 100644 --- a/src/core/os_userlist.c +++ b/src/core/os_userlist.c @@ -50,7 +50,7 @@ class CommandOSUserList : public Command continue; } } - notice_lang(Config.s_OperServ, u, OPER_USERLIST_RECORD, cu->user->nick, cu->user->GetIdent().c_str(), cu->user->GetDisplayedHost().c_str()); + notice_lang(Config.s_OperServ, u, OPER_USERLIST_RECORD, cu->user->nick.c_str(), cu->user->GetIdent().c_str(), cu->user->GetDisplayedHost().c_str()); } } else @@ -67,7 +67,7 @@ class CommandOSUserList : public Command { if (pattern) { - snprintf(mask, sizeof(mask), "%s!%s@%s", u2->nick, u2->GetIdent().c_str(), u2->GetDisplayedHost().c_str()); + snprintf(mask, sizeof(mask), "%s!%s@%s", u2->nick.c_str(), u2->GetIdent().c_str(), u2->GetDisplayedHost().c_str()); if (!Anope::Match(mask, pattern, false)) continue; if (!Modes.empty()) @@ -79,7 +79,7 @@ class CommandOSUserList : public Command } } } - notice_lang(Config.s_OperServ, u, OPER_USERLIST_RECORD, u2->nick, u2->GetIdent().c_str(), u2->GetDisplayedHost().c_str()); + notice_lang(Config.s_OperServ, u, OPER_USERLIST_RECORD, u2->nick.c_str(), u2->GetIdent().c_str(), u2->GetDisplayedHost().c_str()); } } } diff --git a/src/core/ss_main.c b/src/core/ss_main.c index a24525d46..258effa18 100644 --- a/src/core/ss_main.c +++ b/src/core/ss_main.c @@ -26,7 +26,7 @@ class CommandSSHelp : public Command CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) { - ircdproto->SendMessage(statserv, u->nick, "This is a test of the emergency StatServ system."); + ircdproto->SendMessage(statserv, u->nick.c_str(), "This is a test of the emergency StatServ system."); return MOD_CONT; } }; diff --git a/src/hostserv.c b/src/hostserv.c index 55a6abb27..5202e50e7 100644 --- a/src/hostserv.c +++ b/src/hostserv.c @@ -95,7 +95,7 @@ void hostserv(User * u, char *buf) if (!(s = strtok(NULL, ""))) { s = ""; } - ircdproto->SendCTCP(findbot(Config.s_HostServ), u->nick, "PING %s", s); + ircdproto->SendCTCP(findbot(Config.s_HostServ), u->nick.c_str(), "PING %s", s); } else { if (ircd->vhost) { mod_run_cmd(Config.s_HostServ, u, HOSTSERV, cmd); diff --git a/src/memoserv.c b/src/memoserv.c index 2ea19763f..6f3aa2add 100644 --- a/src/memoserv.c +++ b/src/memoserv.c @@ -63,7 +63,7 @@ void memoserv(User * u, char *buf) if (!(s = strtok(NULL, ""))) { s = ""; } - ircdproto->SendCTCP(findbot(Config.s_MemoServ), u->nick, "PING %s", s); + ircdproto->SendCTCP(findbot(Config.s_MemoServ), u->nick.c_str(), "PING %s", s); } else { mod_run_cmd(Config.s_MemoServ, u, MEMOSERV, cmd); } @@ -247,7 +247,7 @@ void memo_send(User * u, const char *name, const char *text, int z) u->lastmemosend = now; m = new Memo; mi->memos.push_back(m); - strscpy(m->sender, source, NICKMAX); + m->sender = source; if (mi->memos.size() > 1) { m->number = mi->memos[mi->memos.size() - 2]->number + 1; if (m->number < 1) { @@ -308,11 +308,11 @@ void memo_send(User * u, const char *name, const char *text, int z) if (check_access(cu->user, c->ci, CA_MEMO)) { if (cu->user->nc && (cu->user->nc->HasFlag(NI_MEMO_RECEIVE)) - && get_ignore(cu->user->nick) == NULL) { + && get_ignore(cu->user->nick.c_str()) == NULL) { notice_lang(Config.s_MemoServ, cu->user, MEMO_NEW_X_MEMO_ARRIVED, - c->ci->name, Config.s_MemoServ, - c->ci->name, m->number); + c->ci->name.c_str(), Config.s_MemoServ, + c->ci->name.c_str(), m->number); } } } @@ -362,7 +362,7 @@ static void new_memo_mail(NickCore * nc, Memo * m) } fprintf(mail->pipe, getstring(MEMO_MAIL_TEXT1), nc->display); fprintf(mail->pipe, "\n"); - fprintf(mail->pipe, getstring(MEMO_MAIL_TEXT2), m->sender, + fprintf(mail->pipe, getstring(MEMO_MAIL_TEXT2), m->sender.c_str(), m->number); fprintf(mail->pipe, "\n\n"); fprintf(mail->pipe, "%s", getstring(MEMO_MAIL_TEXT3)); @@ -413,7 +413,7 @@ void rsend_notify(User * u, Memo * m, const char *chan) } /* Send notification */ - memo_send(u, m->sender, text, 2); + memo_send(u, m->sender.c_str(), text, 2); /* Notify recepient of the memo that a notification has been sent to the sender */ diff --git a/src/messages.c b/src/messages.c index 44447ff87..f0df5fb6c 100644 --- a/src/messages.c +++ b/src/messages.c @@ -174,7 +174,7 @@ int m_privmsg(const char *source, const char *receiver, const char *msg) { notice_lang(Config.s_OperServ, u, ACCESS_DENIED); if (Config.WallBadOS) - ircdproto->SendGlobops(findbot(Config.s_OperServ), "Denied access to %s from %s!%s@%s (non-oper)", Config.s_OperServ, u->nick, u->GetIdent().c_str(), u->host); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "Denied access to %s from %s!%s@%s (non-oper)", Config.s_OperServ, u->nick.c_str(), u->GetIdent().c_str(), u->host); } else operserv(u, const_cast<char *>(msg)); // XXX Unsafe cast, this needs reviewing -- CyberBotX diff --git a/src/misc.c b/src/misc.c index 16a7abfe7..7f0c090c0 100644 --- a/src/misc.c +++ b/src/misc.c @@ -758,9 +758,9 @@ void EnforceQlinedNick(const char *nick, const char *killer) User *u2; if ((u2 = finduser(nick))) { - alog("Killed Q-lined nick: %s!%s@%s", u2->nick, u2->GetIdent().c_str(), + alog("Killed Q-lined nick: %s!%s@%s", u2->nick.c_str(), u2->GetIdent().c_str(), u2->host); - kill_user(killer, u2->nick, + kill_user(killer, u2->nick.c_str(), "This nick is reserved for Services. Please use a non Q-Lined nick."); } } diff --git a/src/modes.cpp b/src/modes.cpp index 9fed6da55..8d4f99d05 100644 --- a/src/modes.cpp +++ b/src/modes.cpp @@ -250,7 +250,7 @@ void ChannelModeBan::AddMask(Channel *chan, const char *mask) } if (debug) - alog("debug: Added ban %s to channel %s", mask, chan->name); + alog("debug: Added ban %s to channel %s", mask, chan->name.c_str()); } /** Remove a ban from the channel @@ -273,8 +273,7 @@ void ChannelModeBan::DelMask(Channel *chan, const char *mask) entry_delete(chan->bans, ban); if (debug) - alog("debug: Deleted ban %s from channel %s", mask, - chan->name); + alog("debug: Deleted ban %s from channel %s", mask, chan->name.c_str()); } if (chan->ci && (akick = is_stuck(chan->ci, mask))) @@ -306,7 +305,7 @@ void ChannelModeExcept::AddMask(Channel *chan, const char *mask) fatal("Creating new exception entry failed"); if (debug) - alog("debug: Added except %s to channel %s", mask, chan->name); + alog("debug: Added except %s to channel %s", mask, chan->name.c_str()); } /** Remove an except from the channel @@ -328,7 +327,7 @@ void ChannelModeExcept::DelMask(Channel *chan, const char *mask) entry_delete(chan->excepts, exception); if (debug) - alog("debug: Deleted except %s to channel %s", mask, chan->name); + alog("debug: Deleted except %s to channel %s", mask, chan->name.c_str()); } } @@ -357,7 +356,7 @@ void ChannelModeInvite::AddMask(Channel *chan, const char *mask) fatal("Creating new exception entry failed"); if (debug) - alog("debug: Added invite %s to channel %s", mask, chan->name); + alog("debug: Added invite %s to channel %s", mask, chan->name.c_str()); } @@ -380,8 +379,7 @@ void ChannelModeInvite::DelMask(Channel *chan, const char *mask) entry_delete(chan->invites, invite); if (debug) - alog("debug: Deleted invite %s to channel %s", mask, - chan->name); + alog("debug: Deleted invite %s to channel %s", mask, chan->name.c_str()); } } diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index 085f9f848..e9d63b12e 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -246,7 +246,7 @@ int ModuleManager::LoadModule(const std::string &modname, User * u) if (u) { - ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s loaded module %s", u->nick, modname.c_str()); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s loaded module %s", u->nick.c_str(), modname.c_str()); notice_lang(Config.s_OperServ, u, OPER_MODULE_LOADED, modname.c_str()); /* If a user is loading this module, then the core databases have already been loaded @@ -278,7 +278,7 @@ int ModuleManager::UnloadModule(Module *m, User *u) if (u) { - ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s unloaded module %s", u->nick, m->name.c_str()); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s unloaded module %s", u->nick.c_str(), m->name.c_str()); notice_lang(Config.s_OperServ, u, OPER_MODULE_UNLOADED, m->name.c_str()); } diff --git a/src/modules/cs_appendtopic.c b/src/modules/cs_appendtopic.c index 5a0194a42..2b21a3096 100644 --- a/src/modules/cs_appendtopic.c +++ b/src/modules/cs_appendtopic.c @@ -83,29 +83,29 @@ class CommandCSAppendTopic : public Command strscpy(topic, newtopic, sizeof(topic)); ci->last_topic = *topic ? sstrdup(topic) : NULL; - strscpy(ci->last_topic_setter, u->nick, NICKMAX); + ci->last_topic_setter = u->nick; ci->last_topic_time = time(NULL); if (c->topic) delete [] c->topic; c->topic = *topic ? sstrdup(topic) : NULL; - strscpy(c->topic_setter, u->nick, NICKMAX); + c->topic_setter = u->nick; if (ircd->topictsbackward) c->topic_time = c->topic_time - 1; else 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, u->GetIdent().c_str(), u->host, c->name); + 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()); if (ircd->join2set) { if (whosends(ci) == findbot(Config.s_ChanServ)) { - ircdproto->SendJoin(findbot(Config.s_ChanServ), c->name, c->creation_time); + ircdproto->SendJoin(findbot(Config.s_ChanServ), c->name.c_str(), c->creation_time); ircdproto->SendMode(NULL, c, "+o %s", Config.s_ChanServ); } } - ircdproto->SendTopic(whosends(ci), c, u->nick, topic); + ircdproto->SendTopic(whosends(ci), c, u->nick.c_str(), topic); if (ircd->join2set) { if (whosends(ci) == findbot(Config.s_ChanServ)) diff --git a/src/modules/cs_enforce.c b/src/modules/cs_enforce.c index 55cc6f5a3..32f2c85c2 100644 --- a/src/modules/cs_enforce.c +++ b/src/modules/cs_enforce.c @@ -62,7 +62,7 @@ class CommandCSEnforce : public Command return; if (debug) - alog("debug: cs_enforce: Enforcing SECUREOPS on %s", c->name); + alog("debug: cs_enforce: Enforcing SECUREOPS on %s", c->name.c_str()); /* Dirty hack to allow chan_set_correct_modes to work ok. * We pretend like SECUREOPS is on so it doesn't ignore that @@ -105,7 +105,7 @@ class CommandCSEnforce : public Command return; if (debug) - alog("debug: cs_enforce: Enforcing RESTRICTED on %s", c->name); + alog("debug: cs_enforce: Enforcing RESTRICTED on %s", c->name.c_str()); old_nojoin_level = ci->levels[CA_NOJOIN]; if (ci->levels[CA_NOJOIN] < 0) @@ -122,8 +122,8 @@ class CommandCSEnforce : public Command reason = getstring(u, CHAN_NOT_ALLOWED_TO_JOIN); c->SetMode(NULL, CMODE_BAN, mask); ircdproto->SendKick(whosends(ci), ci->c, u, "%s", reason); - av[0] = ci->name; - av[1] = u->nick; + av[0] = ci->name.c_str(); + av[1] = u->nick.c_str(); av[2] = reason; do_kick(Config.s_ChanServ, 3, av); } @@ -147,7 +147,7 @@ class CommandCSEnforce : public Command return; if (debug) - alog("debug: cs_enforce: Enforcing mode +R on %s", c->name); + alog("debug: cs_enforce: Enforcing mode +R on %s", c->name.c_str()); user = c->users; do @@ -163,8 +163,8 @@ class CommandCSEnforce : public Command c->SetMode(NULL, CMODE_BAN, mask); } ircdproto->SendKick(whosends(ci), ci->c, u, "%s", reason); - av[0] = ci->name; - av[1] = u->nick; + av[0] = ci->name.c_str(); + av[1] = u->nick.c_str(); av[2] = reason; do_kick(Config.s_ChanServ, 3, av); } diff --git a/src/modules/cs_tban.c b/src/modules/cs_tban.c index 7f84f3e85..65aa88374 100644 --- a/src/modules/cs_tban.c +++ b/src/modules/cs_tban.c @@ -73,7 +73,7 @@ class CommandCSTBan : public Command bool OnHelp(User *u, const ci::string &subcommand) { this->OnSyntaxError(u, ""); - ircdproto->SendMessage(findbot(Config.s_ChanServ), u->nick, " "); + u->SendMessage(Config.s_ChanServ, " "); me->NoticeLang(Config.s_ChanServ, u, TBAN_HELP_DETAIL); return true; @@ -202,7 +202,7 @@ int canBanUser(Channel * c, User * u, User * u2) if (!check_access(u, ci, CA_BAN)) notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); else if (is_excepted(ci, u2)) - notice_lang(Config.s_ChanServ, u, CHAN_EXCEPTED, u2->nick, ci->name); + notice_lang(Config.s_ChanServ, u, CHAN_EXCEPTED, u2->nick.c_str(), ci->name.c_str()); else if (is_protected(u2)) notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); else diff --git a/src/modules/hs_request.c b/src/modules/hs_request.c index ba317bb20..70be073ec 100644 --- a/src/modules/hs_request.c +++ b/src/modules/hs_request.c @@ -78,7 +78,7 @@ class CommandHSRequest : public Command CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) { - char *nick; + const char *nick; const char *rawhostmask = params[0].c_str(); char hostmask[HOSTMAX]; NickAlias *na; @@ -86,7 +86,7 @@ class CommandHSRequest : public Command char *vIdent = NULL; time_t now = time(NULL); - nick = u->nick; + nick = u->nick.c_str(); vIdent = myStrGetOnlyToken(rawhostmask, '@', 0); /* Get the first substring, @ as delimiter */ if (vIdent) @@ -166,7 +166,7 @@ class CommandHSRequest : public Command return MOD_CONT; } } - my_add_host_request(nick, vIdent, hostmask, u->nick, now); + my_add_host_request(const_cast<char *>(nick), vIdent, hostmask, const_cast<char *>(u->nick.c_str()), now); me->NoticeLang(Config.s_HostServ, u, LNG_REQUESTED); req_send_memos(u, vIdent, hostmask); @@ -223,7 +223,7 @@ class CommandHSActivate : public Command my_memo_lang(u, na->nick, 2, LNG_ACTIVATE_MEMO); me->NoticeLang(Config.s_HostServ, u, LNG_ACTIVATED, nick); - alog("Host Request for %s activated by %s", nick, u->nick); + alog("Host Request for %s activated by %s", nick, u->nick.c_str()); } else me->NoticeLang(Config.s_HostServ, u, LNG_NO_REQUEST, nick); @@ -275,7 +275,7 @@ class CommandHSReject : public Command } me->NoticeLang(Config.s_HostServ, u, LNG_REJECTED, nick); - alog("Host Request for %s rejected by %s (%s)", nick, u->nick, reason ? reason : ""); + alog("Host Request for %s rejected by %s (%s)", nick, u->nick.c_str(), reason ? reason : ""); } else me->NoticeLang(Config.s_HostServ, u, LNG_NO_REQUEST, nick); diff --git a/src/nickserv.c b/src/nickserv.c index 81b210d97..7e3219fae 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -249,7 +249,7 @@ void nickserv(User * u, char *buf) { s = ""; } - ircdproto->SendCTCP(findbot(Config.s_NickServ), u->nick, "PING %s", s); + ircdproto->SendCTCP(findbot(Config.s_NickServ), u->nick.c_str(), "PING %s", s); } else { @@ -274,7 +274,7 @@ int validate_user(User * u) NickRequest *nr; NickServCollide *t; - if ((nr = findrequestnick(u->nick))) + if ((nr = findrequestnick(u->nick.c_str()))) { notice_lang(Config.s_NickServ, u, NICK_IS_PREREG); } @@ -291,7 +291,7 @@ int validate_user(User * u) if (na->nc->HasFlag(NI_SUSPENDED)) { - notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, u->nick); + notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, u->nick.c_str()); collide(na, 0); return 0; } @@ -361,7 +361,7 @@ void cancel_user(User * u) else if (ircd->svsnick) { uid = ts6_uid_retrieve(); - ircdproto->SendClientIntroduction(u->nick, Config.NSEnforcerUser, Config.NSEnforcerHost, "Services Enforcer", "+", uid.c_str()); + ircdproto->SendClientIntroduction(u->nick.c_str(), Config.NSEnforcerUser, Config.NSEnforcerHost, "Services Enforcer", "+", uid.c_str()); t = new NickServRelease(na, Config.NSReleaseTimeout); t->uid = uid; } @@ -764,7 +764,7 @@ void change_core_display(NickCore * nc) void collide(NickAlias * na, int from_timeout) { - char guestnick[NICKMAX]; + std::string guestnick; if (!from_timeout) NickServCollide::ClearTimers(na); @@ -786,12 +786,13 @@ void collide(NickAlias * na, int from_timeout) /* We need to make sure the guestnick is free -- heinz */ do { - snprintf(guestnick, sizeof(guestnick), "%s%d", - Config.NSGuestNickPrefix, getrandom16()); + char randbuf[17]; + guestnick = Config.NSGuestNickPrefix; + guestnick += randbuf; } - while (finduser(guestnick)); - notice_lang(Config.s_NickServ, finduser(na->nick), FORCENICKCHANGE_CHANGING, guestnick); - ircdproto->SendForceNickChange(u, guestnick, time(NULL)); + while (finduser(guestnick.c_str())); + notice_lang(Config.s_NickServ, finduser(na->nick), FORCENICKCHANGE_CHANGING, guestnick.c_str()); + ircdproto->SendForceNickChange(u, guestnick.c_str(), time(NULL)); na->SetFlag(NS_GUESTED); } else diff --git a/src/operserv.c b/src/operserv.c index d2711aaec..18b98785e 100644 --- a/src/operserv.c +++ b/src/operserv.c @@ -128,7 +128,7 @@ void operserv(User * u, char *buf) const char *cmd; const char *s; - alog("%s: %s: %s", Config.s_OperServ, u->nick, buf); + alog("%s: %s: %s", Config.s_OperServ, u->nick.c_str(), buf); cmd = strtok(buf, " "); if (!cmd) { @@ -137,7 +137,7 @@ void operserv(User * u, char *buf) if (!(s = strtok(NULL, ""))) { s = ""; } - ircdproto->SendCTCP(findbot(Config.s_OperServ), u->nick, "PING %s", s); + ircdproto->SendCTCP(findbot(Config.s_OperServ), u->nick.c_str(), "PING %s", s); } else { mod_run_cmd(Config.s_OperServ, u, OPERSERV, cmd); } diff --git a/src/protocol.cpp b/src/protocol.cpp index c7d8a8eab..3afe44bd6 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -29,9 +29,9 @@ void IRCDProto::SendQuitInternal(BotInfo *bi, const char *buf) void IRCDProto::SendPartInternal(BotInfo *bi, Channel *chan, const char *buf) { if (buf) - send_cmd(ircd->ts6 ? bi->uid : bi->nick, "PART %s :%s", chan->name, buf); + send_cmd(ircd->ts6 ? bi->uid : bi->nick, "PART %s :%s", chan->name.c_str(), buf); else - send_cmd(ircd->ts6 ? bi->uid : bi->nick, "PART %s", chan->name); + send_cmd(ircd->ts6 ? bi->uid : bi->nick, "PART %s", chan->name.c_str()); } void IRCDProto::SendGlobopsInternal(BotInfo *source, const char *buf) @@ -230,7 +230,7 @@ void IRCDProto::SendChangeBotNick(BotInfo *bi, const char *newnick) } void IRCDProto::SendForceNickChange(User *u, const char *newnick, time_t when) { - send_cmd(NULL, "SVSNICK %s %s :%ld", u->nick, newnick, static_cast<long>(when)); + send_cmd(NULL, "SVSNICK %s %s :%ld", u->nick.c_str(), newnick, static_cast<long>(when)); } void IRCDProto::SendCTCP(BotInfo *bi, const char *dest, const char *fmt, ...) diff --git a/src/protocol/bahamut.c b/src/protocol/bahamut.c index f00982d6b..5ac0fe006 100644 --- a/src/protocol/bahamut.c +++ b/src/protocol/bahamut.c @@ -144,14 +144,14 @@ class BahamutIRCdProto : public IRCDProto void SendModeInternal(BotInfo *source, Channel *dest, const char *buf) { if (!buf) return; - if (ircdcap->tsmode && (uplink_capab & ircdcap->tsmode)) send_cmd(source->nick, "MODE %s 0 %s", dest->name, buf); - else send_cmd(source->nick, "MODE %s %s", dest->name, buf); + if (ircdcap->tsmode && (uplink_capab & ircdcap->tsmode)) send_cmd(source->nick, "MODE %s 0 %s", dest->name.c_str(), buf); + else send_cmd(source->nick, "MODE %s %s", dest->name.c_str(), buf); } void SendModeInternal(BotInfo *bi, User *u, const char *buf) { if (!buf) return; - send_cmd(bi ? bi->nick : Config.ServerName, "SVSMODE %s %ld %s", u->nick, static_cast<long>(u->timestamp), buf); + send_cmd(bi ? bi->nick : Config.ServerName, "SVSMODE %s %ld %s", u->nick.c_str(), static_cast<long>(u->timestamp), buf); } /* SVSHOLD - set */ @@ -175,8 +175,8 @@ class BahamutIRCdProto : public IRCDProto /* SVSMODE channel modes */ void SendSVSModeChan(Channel *c, const char *mode, const char *nick) { - if (nick) send_cmd(Config.ServerName, "SVSMODE %s %s %s", c->name, mode, nick); - else send_cmd(Config.ServerName, "SVSMODE %s %s", c->name, mode); + if (nick) send_cmd(Config.ServerName, "SVSMODE %s %s %s", c->name.c_str(), mode, nick); + else send_cmd(Config.ServerName, "SVSMODE %s %s", c->name.c_str(), mode); } /* SQLINE */ @@ -232,7 +232,7 @@ class BahamutIRCdProto : public IRCDProto /* TOPIC */ void SendTopic(BotInfo *whosets, Channel *c, const char *whosetit, const char *topic) { - send_cmd(whosets->nick, "TOPIC %s %s %lu :%s", c->name, whosetit, static_cast<unsigned long>(c->topic_time), topic); + send_cmd(whosets->nick, "TOPIC %s %s %lu :%s", c->name.c_str(), whosetit, static_cast<unsigned long>(c->topic_time), topic); } /* UNSQLINE */ @@ -260,7 +260,7 @@ class BahamutIRCdProto : public IRCDProto */ void SendSVSKillInternal(BotInfo *source, User *user, const char *buf) { - send_cmd(source ? source->nick : NULL, "SVSKILL %s :%s", user->nick, buf); + send_cmd(source ? source->nick : NULL, "SVSKILL %s :%s", user->nick.c_str(), buf); } /* SVSMODE */ @@ -283,13 +283,13 @@ class BahamutIRCdProto : public IRCDProto void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const char *buf) { if (!buf) return; - send_cmd(NULL, "NOTICE @%s :%s", dest->name, buf); + send_cmd(NULL, "NOTICE @%s :%s", dest->name.c_str(), buf); } void SendKickInternal(BotInfo *source, Channel *chan, User *user, const char *buf) { - if (buf) send_cmd(source->nick, "KICK %s %s :%s", chan->name, user->nick, buf); - else send_cmd(source->nick, "KICK %s %s", chan->name, user->nick); + if (buf) send_cmd(source->nick, "KICK %s %s :%s", chan->name.c_str(), user->nick.c_str(), buf); + else send_cmd(source->nick, "KICK %s %s", chan->name.c_str(), user->nick.c_str()); } void SendClientIntroduction(const char *nick, const char *user, const char *host, const char *real, const char *modes, const char *uid) diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.c index eb2718a7a..659d1aaa9 100644 --- a/src/protocol/inspircd11.c +++ b/src/protocol/inspircd11.c @@ -165,19 +165,19 @@ class InspIRCdProto : public IRCDProto void SendTopic(BotInfo *whosets, Channel *c, const char *whosetit, const char *topic) { - send_cmd(whosets->nick, "FTOPIC %s %lu %s :%s", c->name, static_cast<unsigned long>(c->topic_time), whosetit, topic); + send_cmd(whosets->nick, "FTOPIC %s %lu %s :%s", c->name.c_str(), static_cast<unsigned long>(c->topic_time), whosetit, topic); } void SendVhostDel(User *u) { if (u->HasMode(UMODE_CLOAK)) - inspircd_cmd_chghost(u->nick, u->chost.c_str()); + inspircd_cmd_chghost(u->nick.c_str(), u->chost.c_str()); else - inspircd_cmd_chghost(u->nick, u->host); + inspircd_cmd_chghost(u->nick.c_str(), u->host); if (has_chgidentmod && u->GetIdent() != u->GetVIdent()) { - inspircd_cmd_chgident(u->nick, u->GetIdent().c_str()); + inspircd_cmd_chgident(u->nick.c_str(), u->GetIdent().c_str()); } } @@ -192,7 +192,7 @@ class InspIRCdProto : public IRCDProto void SendSVSKillInternal(BotInfo *source, User *user, const char *buf) { - send_cmd(source ? source->nick : Config.ServerName, "KILL %s :%s", user->nick, buf); + send_cmd(source ? source->nick : Config.ServerName, "KILL %s :%s", user->nick.c_str(), buf); } void SendSVSMode(User *u, int ac, const char **av) @@ -213,13 +213,13 @@ class InspIRCdProto : public IRCDProto void SendModeInternal(BotInfo *source, Channel *dest, const char *buf) { if (!buf) return; - send_cmd(source ? source->nick : Config.s_OperServ, "FMODE %s %u %s", dest->name, static_cast<unsigned>(dest->creation_time), buf); + send_cmd(source ? source->nick : Config.s_OperServ, "FMODE %s %u %s", dest->name.c_str(), static_cast<unsigned>(dest->creation_time), buf); } void SendModeInternal(BotInfo *bi, User *u, const char *buf) { if (!buf) return; - send_cmd(bi ? bi->nick : Config.ServerName, "MODE %s %s", u->nick, buf); + send_cmd(bi ? bi->nick : Config.ServerName, "MODE %s %s", u->nick.c_str(), buf); } void SendClientIntroduction(const char *nick, const char *user, const char *host, const char *real, const char *modes, const char *uid) @@ -230,14 +230,14 @@ class InspIRCdProto : public IRCDProto void SendKickInternal(BotInfo *source, Channel *chan, User *user, const char *buf) { - if (buf) send_cmd(source->nick, "KICK %s %s :%s", chan->name, user->nick, buf); - else send_cmd(source->nick, "KICK %s %s :%s", chan->name, user->nick, user->nick); + if (buf) send_cmd(source->nick, "KICK %s %s :%s", chan->name.c_str(), user->nick.c_str(), buf); + else send_cmd(source->nick, "KICK %s %s :%s", chan->name.c_str(), user->nick.c_str(), user->nick.c_str()); } void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const char *buf) { if (!buf) return; - send_cmd(Config.ServerName, "NOTICE @%s :%s", dest->name, buf); + send_cmd(Config.ServerName, "NOTICE @%s :%s", dest->name.c_str(), buf); } /* SERVER services-dev.chatspike.net password 0 :Description here */ @@ -278,8 +278,8 @@ class InspIRCdProto : public IRCDProto void SendVhost(User *u, const char *vIdent, const char *vhost) { - if (vIdent) inspircd_cmd_chgident(u->nick, vIdent); - inspircd_cmd_chghost(u->nick, vhost); + if (vIdent) inspircd_cmd_chgident(u->nick.c_str(), vIdent); + inspircd_cmd_chghost(u->nick.c_str(), vhost); } void SendConnect() @@ -568,7 +568,7 @@ int anope_event_topic(const char *source, int ac, const char **av) if (ac > 1 && *av[1]) c->topic = sstrdup(av[1]); - strscpy(c->topic_setter, source, sizeof(c->topic_setter)); + c->topic_setter = source; c->topic_time = topic_time; record_topic(av[0]); diff --git a/src/protocol/inspircd12.cpp b/src/protocol/inspircd12.cpp index 0af116070..b791ca71f 100644 --- a/src/protocol/inspircd12.cpp +++ b/src/protocol/inspircd12.cpp @@ -171,19 +171,19 @@ class InspIRCdProto : public IRCDProto void SendTopic(BotInfo *whosets, Channel *c, const char *whosetit, const char *topic) { - send_cmd(whosets->uid, "FTOPIC %s %lu %s :%s", c->name, static_cast<unsigned long>(c->topic_time), whosetit, topic); + send_cmd(whosets->uid, "FTOPIC %s %lu %s :%s", c->name.c_str(), static_cast<unsigned long>(c->topic_time), whosetit, topic); } void SendVhostDel(User *u) { if (u->HasMode(UMODE_CLOAK)) - inspircd_cmd_chghost(u->nick, u->chost.c_str()); + inspircd_cmd_chghost(u->nick.c_str(), u->chost.c_str()); else - inspircd_cmd_chghost(u->nick, u->host); + inspircd_cmd_chghost(u->nick.c_str(), u->host); if (has_chgidentmod && u->GetIdent() != u->GetVIdent()) { - inspircd_cmd_chgident(u->nick, u->GetIdent().c_str()); + inspircd_cmd_chgident(u->nick.c_str(), u->GetIdent().c_str()); } } @@ -219,7 +219,7 @@ class InspIRCdProto : public IRCDProto void SendModeInternal(BotInfo *source, Channel *dest, const char *buf) { - send_cmd(source ? source->uid : TS6SID, "FMODE %s %u %s", dest->name, static_cast<unsigned>(dest->creation_time), buf); + send_cmd(source ? source->uid : TS6SID, "FMODE %s %u %s", dest->name.c_str(), static_cast<unsigned>(dest->creation_time), buf); } void SendModeInternal(BotInfo *bi, User *u, const char *buf) @@ -236,14 +236,14 @@ class InspIRCdProto : public IRCDProto void SendKickInternal(BotInfo *source, Channel *chan, User *user, const char *buf) { if (buf) - send_cmd(source->uid, "KICK %s %s :%s", chan->name, user->GetUID().c_str(), buf); + send_cmd(source->uid, "KICK %s %s :%s", chan->name.c_str(), user->GetUID().c_str(), buf); else - send_cmd(source->uid, "KICK %s %s :%s", chan->name, user->GetUID().c_str(), user->nick); + send_cmd(source->uid, "KICK %s %s :%s", chan->name.c_str(), user->GetUID().c_str(), user->nick.c_str()); } void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const char *buf) { - send_cmd(TS6SID, "NOTICE @%s :%s", dest->name, buf); + send_cmd(TS6SID, "NOTICE @%s :%s", dest->name.c_str(), buf); } /* SERVER services-dev.chatspike.net password 0 :Description here */ @@ -283,8 +283,8 @@ class InspIRCdProto : public IRCDProto void SendVhost(User *u, const char *vIdent, const char *vhost) { if (vIdent) - inspircd_cmd_chgident(u->nick, vIdent); - inspircd_cmd_chghost(u->nick, vhost); + inspircd_cmd_chgident(u->nick.c_str(), vIdent); + inspircd_cmd_chghost(u->nick.c_str(), vhost); } void SendConnect() @@ -446,8 +446,8 @@ int anope_event_mode(const char *source, int ac, const char **av) if (u == NULL) return MOD_CONT; - av[0] = u2->nick; - do_umode(u->nick, ac, av); + av[0] = u2->nick.c_str(); + do_umode(u->nick.c_str(), ac, av); } return MOD_CONT; } @@ -660,7 +660,7 @@ int anope_event_topic(const char *source, int ac, const char **av) if (ac > 1 && *av[1]) c->topic = sstrdup(av[1]); - strscpy(c->topic_setter, u ? u->nick : source, sizeof(c->topic_setter)); + c->topic_setter = u ? u->nick : source; c->topic_time = topic_time; record_topic(av[0]); @@ -698,7 +698,7 @@ int anope_event_kill(const char *source, int ac, const char **av) { User *u = find_byuid(av[0]); BotInfo *bi = findbot(av[0]); - m_kill(u ? u->nick : (bi ? bi->nick : av[0]), av[1]); + m_kill(u ? u->nick.c_str() : (bi ? bi->nick : av[0]), av[1]); return MOD_CONT; } @@ -908,7 +908,7 @@ int anope_event_privmsg(const char *source, int ac, const char **av) if (!u) return MOD_CONT; // likely a message from a server, which can happen. - m_privmsg(u->nick, bi ? bi->nick: av[0], av[1]); + m_privmsg(u->nick.c_str(), bi ? bi->nick: av[0], av[1]); return MOD_CONT; } diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c index 78be63723..a9e2c9027 100644 --- a/src/protocol/ratbox.c +++ b/src/protocol/ratbox.c @@ -265,26 +265,26 @@ class RatboxProto : public IRCDTS6Proto { if (bi) { - send_cmd(bi->uid, "MODE %s %s", dest->name, buf); + send_cmd(bi->uid, "MODE %s %s", dest->name.c_str(), buf); } - else send_cmd(TS6SID, "MODE %s %s", dest->name, buf); + else send_cmd(TS6SID, "MODE %s %s", dest->name.c_str(), buf); } void SendModeInternal(BotInfo *bi, User *u, const char *buf) { if (!buf) return; - send_cmd(bi ? bi->uid : TS6SID, "SVSMODE %s %s", u->nick, buf); + send_cmd(bi ? bi->uid : TS6SID, "SVSMODE %s %s", u->nick.c_str(), buf); } void SendKickInternal(BotInfo *bi, Channel *chan, User *user, const char *buf) { - if (buf) send_cmd(bi->uid, "KICK %s %s :%s", chan->name, user->GetUID().c_str(), buf); - else send_cmd(bi->uid, "KICK %s %s", chan->name, user->GetUID().c_str()); + if (buf) send_cmd(bi->uid, "KICK %s %s :%s", chan->name.c_str(), user->GetUID().c_str(), buf); + else send_cmd(bi->uid, "KICK %s %s", chan->name.c_str(), user->GetUID().c_str()); } void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const char *buf) { - send_cmd(NULL, "NOTICE @%s :%s", dest->name, buf); + send_cmd(NULL, "NOTICE @%s :%s", dest->name.c_str(), buf); } /* QUIT */ @@ -320,7 +320,7 @@ class RatboxProto : public IRCDTS6Proto void SendTopic(BotInfo *bi, Channel *c, const char *whosetit, const char *topic) { - send_cmd(bi->uid, "TOPIC %s :%s", c->name, topic); + send_cmd(bi->uid, "TOPIC %s :%s", c->name.c_str(), topic); } void SetAutoIdentificationToken(User *u) @@ -430,11 +430,7 @@ int anope_event_topic(const char *source, int ac, const char **av) c->topic = sstrdup(av[1]); u = find_byuid(source); - if (u) { - strscpy(c->topic_setter, u->nick, sizeof(c->topic_setter)); - } else { - strscpy(c->topic_setter, source, sizeof(c->topic_setter)); - } + c->topic_setter = u ? u->nick : source; c->topic_time = topic_time; record_topic(av[0]); @@ -487,7 +483,7 @@ int anope_event_tburst(const char *source, int ac, const char **av) if (ac > 1 && *av[3]) c->topic = sstrdup(av[3]); - strscpy(c->topic_setter, setter, sizeof(c->topic_setter)); + c->topic_setter = setter; c->topic_time = topic_time; record_topic(av[0]); @@ -519,7 +515,7 @@ int anope_event_away(const char *source, int ac, const char **av) User *u = NULL; u = find_byuid(source); - m_away(u ? u->nick : source, (ac ? av[0] : NULL)); + m_away(u ? u->nick.c_str() : source, (ac ? av[0] : NULL)); return MOD_CONT; } @@ -586,7 +582,7 @@ int anope_event_part(const char *source, int ac, const char **av) } u = find_byuid(source); - do_part(u ? u->nick : source, ac, av); + do_part(u ? u->nick.c_str() : source, ac, av); return MOD_CONT; } @@ -648,7 +644,7 @@ int anope_event_quit(const char *source, int ac, const char **av) u = find_byuid(source); - do_quit(u ? u->nick : source, ac, av); + do_quit(u ? u->nick.c_str() : source, ac, av); return MOD_CONT; } @@ -665,8 +661,8 @@ int anope_event_mode(const char *source, int ac, const char **av) } else { u = find_byuid(source); u2 = find_byuid(av[0]); - av[0] = u2->nick; - do_umode(u->nick, ac, av); + av[0] = u2->nick.c_str(); + do_umode(u->nick.c_str(), ac, av); } return MOD_CONT; } diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c index 7e8d0985b..81229930c 100644 --- a/src/protocol/unreal32.c +++ b/src/protocol/unreal32.c @@ -181,7 +181,7 @@ class UnrealIRCdProto : public IRCDProto void SendTopic(BotInfo *whosets, Channel *c, const char *whosetit, const char *topic) { - send_cmd(whosets->nick, ") %s %s %lu :%s", c->name, whosetit, static_cast<unsigned long>(c->topic_time), topic); + send_cmd(whosets->nick, ") %s %s %lu :%s", c->name.c_str(), whosetit, static_cast<unsigned long>(c->topic_time), topic); } void SendVhostDel(User *u) @@ -204,7 +204,7 @@ class UnrealIRCdProto : public IRCDProto void SendSVSKillInternal(BotInfo *source, User *user, const char *buf) { - send_cmd(source ? source->nick : Config.ServerName, "h %s :%s", user->nick, buf); + send_cmd(source ? source->nick : Config.ServerName, "h %s :%s", user->nick.c_str(), buf); } /* @@ -225,13 +225,13 @@ class UnrealIRCdProto : public IRCDProto void SendModeInternal(BotInfo *source, Channel *dest, const char *buf) { if (!buf) return; - send_cmd(source->nick, "G %s %s", dest->name, buf); + send_cmd(source->nick, "G %s %s", dest->name.c_str(), buf); } void SendModeInternal(BotInfo *bi, User *u, const char *buf) { if (!buf) return; - send_cmd(bi ? bi->nick : Config.ServerName, "v %s %s", u->nick, buf); + send_cmd(bi ? bi->nick : Config.ServerName, "v %s %s", u->nick.c_str(), buf); } void SendClientIntroduction(const char *nick, const char *user, const char *host, const char *real, const char *modes, const char *uid) @@ -244,14 +244,14 @@ class UnrealIRCdProto : public IRCDProto void SendKickInternal(BotInfo *source, Channel *chan, User *user, const char *buf) { - if (buf) send_cmd(source->nick, "H %s %s :%s", chan->name, user->nick, buf); - else send_cmd(source->nick, "H %s %s", chan->name, user->nick); + if (buf) send_cmd(source->nick, "H %s %s :%s", chan->name.c_str(), user->nick.c_str(), buf); + else send_cmd(source->nick, "H %s %s", chan->name.c_str(), user->nick.c_str()); } void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const char *buf) { if (!buf) return; - send_cmd(source->nick, "B @%s :%s", dest->name, buf); + send_cmd(source->nick, "B @%s :%s", dest->name.c_str(), buf); } /* SERVER name hop descript */ @@ -320,8 +320,8 @@ class UnrealIRCdProto : public IRCDProto void SendVhost(User *u, const char *vIdent, const char *vhost) { - if (vIdent) unreal_cmd_chgident(u->nick, vIdent); - unreal_cmd_chghost(u->nick, vhost); + if (vIdent) unreal_cmd_chgident(u->nick.c_str(), vIdent); + unreal_cmd_chghost(u->nick.c_str(), vhost); } void SendConnect() @@ -392,8 +392,8 @@ class UnrealIRCdProto : public IRCDProto void SendSVSModeChan(Channel *c, const char *mode, const char *nick) { - if (nick) send_cmd(Config.ServerName, "n %s %s %s", c->name, mode, nick); - else send_cmd(Config.ServerName, "n %s %s", c->name, mode); + if (nick) send_cmd(Config.ServerName, "n %s %s %s", c->name.c_str(), mode, nick); + else send_cmd(Config.ServerName, "n %s %s", c->name.c_str(), mode); } /* svsjoin diff --git a/src/regchannel.cpp b/src/regchannel.cpp index bbb63a13e..df4d18db6 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -36,7 +36,7 @@ ChannelInfo::ChannelInfo(const std::string &chname) repeattimes = 0; bi = NULL; - strscpy(this->name, chname.c_str(), CHANMAX); + this->name = chname; mlock_on = DefMLockOn; mlock_off = DefMLockOff; @@ -80,7 +80,7 @@ ChannelInfo::~ChannelInfo() } if (debug) - alog("debug: Deleting channel %s", this->name); + alog("debug: Deleting channel %s", this->name.c_str()); if (this->bi) this->bi->chancount--; diff --git a/src/sessions.c b/src/sessions.c index d2814e4e0..64db5dae0 100644 --- a/src/sessions.c +++ b/src/sessions.c @@ -341,7 +341,7 @@ int exception_add(User * u, const char *mask, const int limit, exceptions[nexceptions - 1].limit = limit; exceptions[nexceptions - 1].reason = sstrdup(reason); exceptions[nexceptions - 1].time = time(NULL); - strscpy(exceptions[nexceptions - 1].who, who, NICKMAX); + exceptions[nexceptions - 1].who = who; exceptions[nexceptions - 1].expires = expires; exceptions[nexceptions - 1].num = nexceptions - 1; diff --git a/src/users.c b/src/users.c index 52fcaf799..f49929d7e 100644 --- a/src/users.c +++ b/src/users.c @@ -46,7 +46,7 @@ User::User(const std::string &snick, const std::string &suid) invalid_pw_count = timestamp = my_signon = invalid_pw_time = lastmemosend = lastnickreg = lastmail = 0; OnAccess = false; - strscpy(this->nick, snick.c_str(), NICKMAX); + this->nick = snick; this->uid = suid; list = &userlist[HASH(this->nick)]; this->next = *list; @@ -82,7 +82,7 @@ void User::SetNewNick(const std::string &newnick) } if (debug) - alog("debug: %s changed nick to %s", this->nick, newnick.c_str()); + alog("debug: %s changed nick to %s", this->nick.c_str(), newnick.c_str()); if (this->prev) this->prev->next = this->next; @@ -92,7 +92,7 @@ void User::SetNewNick(const std::string &newnick) if (this->next) this->next->prev = this->prev; - strscpy(this->nick, newnick.c_str(), NICKMAX); + this->nick = newnick; list = &userlist[HASH(this->nick)]; this->next = *list; this->prev = NULL; @@ -117,7 +117,7 @@ void User::SetDisplayedHost(const std::string &shost) this->vhost = sstrdup(shost.c_str()); if (debug) - alog("debug: %s changed vhost to %s", this->nick, shost.c_str()); + alog("debug: %s changed vhost to %s", this->nick.c_str(), shost.c_str()); this->UpdateHost(); } @@ -146,7 +146,7 @@ void User::SetCloakedHost(const std::string &newhost) chost = newhost; if (debug) - alog("debug: %s changed cloaked host to %s", this->nick, newhost.c_str()); + alog("debug: %s changed cloaked host to %s", this->nick.c_str(), newhost.c_str()); this->UpdateHost(); } @@ -170,7 +170,7 @@ void User::SetVIdent(const std::string &sident) this->vident = sident; if (debug) - alog("debug: %s changed ident to %s", this->nick, sident.c_str()); + alog("debug: %s changed ident to %s", this->nick.c_str(), sident.c_str()); this->UpdateHost(); } @@ -190,7 +190,7 @@ void User::SetIdent(const std::string &sident) this->ident = sident; if (debug) - alog("debug: %s changed real ident to %s", this->nick, sident.c_str()); + alog("debug: %s changed real ident to %s", this->nick.c_str(), sident.c_str()); this->UpdateHost(); } @@ -218,7 +218,7 @@ void User::SetRealname(const std::string &srealname) } if (debug) - alog("debug: %s changed realname to %s", this->nick, srealname.c_str()); + alog("debug: %s changed realname to %s", this->nick.c_str(), srealname.c_str()); } User::~User() @@ -233,13 +233,13 @@ User::~User() if (ircd->vhost) { alog("LOGUSERS: %s (%s@%s => %s) (%s) left the network (%s).", - this->nick, this->GetIdent().c_str(), this->host, + this->nick.c_str(), this->GetIdent().c_str(), this->host, this->GetDisplayedHost().c_str(), srealname, this->server->name); } else { alog("LOGUSERS: %s (%s@%s) (%s) left the network (%s).", - this->nick, this->GetIdent().c_str(), this->host, + this->nick.c_str(), this->GetIdent().c_str(), this->host, srealname, this->server->name); } @@ -327,11 +327,11 @@ void User::SendMessage(const char *source, const std::string &msg) if (Config.UsePrivmsg && ((!this->nc && Config.NSDefFlags.HasFlag(NI_MSG)) || (this->nc && this->nc->HasFlag(NI_MSG)))) { - ircdproto->SendPrivmsg(findbot(source), this->nick, "%s", msg.c_str()); + ircdproto->SendPrivmsg(findbot(source), this->nick.c_str(), "%s", msg.c_str()); } else { - ircdproto->SendNotice(findbot(source), this->nick, "%s", msg.c_str()); + ircdproto->SendNotice(findbot(source), this->nick.c_str(), "%s", msg.c_str()); } } @@ -638,7 +638,7 @@ User *firstuser() current = userlist[next_index++]; if (debug) alog("debug: firstuser() returning %s", - current ? current->nick : "NULL (end of list)"); + current ? current->nick.c_str() : "NULL (end of list)"); return current; } @@ -652,7 +652,7 @@ User *nextuser() } if (debug) alog("debug: nextuser() returning %s", - current ? current->nick : "NULL (end of list)"); + current ? current->nick.c_str() : "NULL (end of list)"); return current; } @@ -684,7 +684,7 @@ User *first_uid() } if (debug >= 2) { alog("debug: first_uid() returning %s %s", - current_uid ? current_uid->nick : "NULL (end of list)", + current_uid ? current_uid->nick.c_str() : "NULL (end of list)", current_uid ? current_uid->GetUID().c_str() : ""); } return current_uid; @@ -700,7 +700,7 @@ User *next_uid() } if (debug >= 2) { alog("debug: next_uid() returning %s %s", - current_uid ? current_uid->nick : "NULL (end of list)", + current_uid ? current_uid->nick.c_str() : "NULL (end of list)", current_uid ? current_uid->GetUID().c_str() : ""); } return current_uid; @@ -842,10 +842,10 @@ User *do_nick(const char *source, const char *nick, const char *username, const if (Config.LogUsers) { logrealname = normalizeBuffer(user->realname); if (ircd->vhost) { - alog("LOGUSERS: %s (%s@%s => %s) (%s) changed nick to %s (%s).", user->nick, user->GetIdent().c_str(), user->host, user->GetDisplayedHost().c_str(), logrealname, nick, user->server->name); + alog("LOGUSERS: %s (%s@%s => %s) (%s) changed nick to %s (%s).", user->nick.c_str(), user->GetIdent().c_str(), user->host, user->GetDisplayedHost().c_str(), logrealname, nick, user->server->name); } else { alog("LOGUSERS: %s (%s@%s) (%s) changed nick to %s (%s).", - user->nick, user->GetIdent().c_str(), user->host, logrealname, + user->nick.c_str(), user->GetIdent().c_str(), user->host, logrealname, nick, user->server->name); } if (logrealname) { @@ -855,7 +855,7 @@ User *do_nick(const char *source, const char *nick, const char *username, const user->timestamp = ts; - if (stricmp(nick, user->nick) == 0) { + if (stricmp(nick, user->nick.c_str()) == 0) { /* No need to redo things */ user->SetNewNick(nick); nc_changed = 0; @@ -898,7 +898,7 @@ User *do_nick(const char *source, const char *nick, const char *username, const if (ircd->sqline) { - if (!is_oper(user) && check_sqline(user->nick, 1)) + if (!is_oper(user) && check_sqline(user->nick.c_str(), 1)) return NULL; } @@ -925,7 +925,7 @@ User *do_nick(const char *source, const char *nick, const char *username, const ntmp->last_seen = time(NULL); user->UpdateHost(); ircdproto->SetAutoIdentificationToken(user); - alog("%s: %s!%s@%s automatically identified for nick %s", Config.s_NickServ, user->nick, user->GetIdent().c_str(), user->host, user->nick); + alog("%s: %s!%s@%s automatically identified for nick %s", Config.s_NickServ, user->nick.c_str(), user->GetIdent().c_str(), user->host, user->nick.c_str()); } /* Bahamut sets -r on every nick changes, so we must test it even if nc_changed == 0 */ @@ -1202,7 +1202,7 @@ void UserSetInternalModes(User *user, int ac, const char **av) return; if (debug) - alog("debug: Changing user modes for %s to %s", user->nick, merge_args(ac, av)); + alog("debug: Changing user modes for %s to %s", user->nick.c_str(), merge_args(ac, av)); for (; *modes; *modes++) { @@ -1246,7 +1246,7 @@ void UserSetInternalModes(User *user, int ac, const char **av) { ++opcnt; if (Config.WallOper) - ircdproto->SendGlobops(findbot(Config.s_OperServ), "\2%s\2 is now an IRC operator.", user->nick); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "\2%s\2 is now an IRC operator.", user->nick.c_str()); } else --opcnt; |