mirror of
https://github.com/anope/anope.git
synced 2026-07-07 15:03:14 +02:00
Convert 'const char *' and 'char *' function arguments to 'const std::string &' instead, done in actions.c along with chain reactions in other files.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2723 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
+8
-8
@@ -35,10 +35,10 @@ E IRCDProto *ircdproto;
|
||||
|
||||
/**** actions.c ****/
|
||||
|
||||
E void kill_user(const char *source, const char *user, const char *reason);
|
||||
E void bad_password(User * u);
|
||||
E void sqline(char *mask, char *reason);
|
||||
E void common_unban(ChannelInfo * ci, char *nick);
|
||||
E void kill_user(const std::string &source, const std::string &user, const std::string &reason);
|
||||
E void bad_password(User *u);
|
||||
E void sqline(const std::string &mask, const std::string &reason);
|
||||
E void common_unban(ChannelInfo *ci, const std::string &nick);
|
||||
|
||||
/**** botserv.c ****/
|
||||
|
||||
@@ -49,7 +49,7 @@ E void bs_init();
|
||||
E void botserv(User *u, char *buf);
|
||||
E void botmsgs(User *u, BotInfo *bi, char *buf);
|
||||
E void botchanmsgs(User *u, ChannelInfo *ci, char *buf);
|
||||
E BotInfo *findbot(const char *nick);
|
||||
E BotInfo *findbot(const std::string &nick);
|
||||
|
||||
/** Finds a pseudoclient, given a UID. Useful for TS6 protocol modules.
|
||||
* @param uid The UID to search for
|
||||
@@ -596,11 +596,11 @@ E uint32 maxusercnt, usercnt;
|
||||
E time_t maxusertime;
|
||||
|
||||
E void get_user_stats(long *nusers, long *memuse);
|
||||
E User *finduser(const char *nick);
|
||||
E User *finduser(const std::string &nick);
|
||||
E User *firstuser();
|
||||
E User *nextuser();
|
||||
|
||||
E User *find_byuid(const char *uid);
|
||||
E User *find_byuid(const std::string &uid);
|
||||
E User *first_uid();
|
||||
E User *next_uid();
|
||||
E Server *findserver_uid(Server * s, const char *name);
|
||||
@@ -612,7 +612,7 @@ E User *do_nick(const char *source, const char *nick, const char *username, cons
|
||||
|
||||
E void do_umode(const char *source, int ac, const char **av);
|
||||
E void do_quit(const char *source, int ac, const char **av);
|
||||
E void do_kill(const char *source, const char *reason);
|
||||
E void do_kill(const std::string &source, const std::string &reason);
|
||||
|
||||
E int is_oper(User * user);
|
||||
E int is_protected(User * user);
|
||||
|
||||
+2
-2
@@ -1258,7 +1258,7 @@ class CoreExport IRCDProto
|
||||
virtual void SendInvite(BotInfo *bi, const char *chan, const char *nick);
|
||||
virtual void SendPart(BotInfo *bi, Channel *chan, const char *fmt, ...);
|
||||
virtual void SendGlobops(BotInfo *source, const char *fmt, ...);
|
||||
virtual void SendSQLine(const char *, const char *) = 0;
|
||||
virtual void SendSQLine(const std::string &, const std::string &) = 0;
|
||||
virtual void SendSquit(const char *servname, const char *message);
|
||||
virtual void SendSVSO(const char *, const char *, const char *) { }
|
||||
virtual void SendChangeBotNick(BotInfo *bi, const char *newnick);
|
||||
@@ -1271,7 +1271,7 @@ class CoreExport IRCDProto
|
||||
virtual void SendSZLineDel(SXLine *) { }
|
||||
virtual void SendSZLine(SXLine *) { }
|
||||
virtual void SendSGLine(SXLine *) { }
|
||||
virtual void SendBanDel(Channel *, const char *) { }
|
||||
virtual void SendBanDel(Channel *, const std::string &) { }
|
||||
virtual void SendSVSModeChan(Channel *, const char *, const char *) { }
|
||||
virtual void SendUnregisteredNick(User *) { }
|
||||
virtual void SendCTCP(BotInfo *bi, const char *dest, const char *fmt, ...);
|
||||
|
||||
+44
-54
@@ -22,22 +22,19 @@
|
||||
* @param u the User to check
|
||||
* @return void
|
||||
*/
|
||||
void bad_password(User * u)
|
||||
void bad_password(User *u)
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
|
||||
if (!u || !Config.BadPassLimit) {
|
||||
if (!u || !Config.BadPassLimit)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.BadPassTimeout > 0 && u->invalid_pw_time > 0
|
||||
&& u->invalid_pw_time < now - Config.BadPassTimeout)
|
||||
if (Config.BadPassTimeout > 0 && u->invalid_pw_time > 0 && u->invalid_pw_time < now - Config.BadPassTimeout)
|
||||
u->invalid_pw_count = 0;
|
||||
u->invalid_pw_count++;
|
||||
++u->invalid_pw_count;
|
||||
u->invalid_pw_time = now;
|
||||
if (u->invalid_pw_count >= Config.BadPassLimit) {
|
||||
kill_user(NULL, u->nick, "Too many invalid passwords");
|
||||
}
|
||||
if (u->invalid_pw_count >= Config.BadPassLimit)
|
||||
kill_user("", u->nick, "Too many invalid passwords");
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -49,27 +46,21 @@ void bad_password(User * u)
|
||||
* @param reason for the kill
|
||||
* @return void
|
||||
*/
|
||||
void kill_user(const char *source, const char *user, const char *reason)
|
||||
void kill_user(const std::string &source, const std::string &user, const std::string &reason)
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
|
||||
if (!user || !*user) {
|
||||
if (user.empty())
|
||||
return;
|
||||
}
|
||||
if (!source || !*source) {
|
||||
source = Config.ServerName;
|
||||
}
|
||||
if (!reason) {
|
||||
reason = "";
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s (%s)", source, reason);
|
||||
std::string real_source = source.empty() ? Config.ServerName : source;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s (%s)", source.c_str(), reason.c_str());
|
||||
|
||||
ircdproto->SendSVSKill(findbot(source), finduser(user), buf);
|
||||
|
||||
if (!ircd->quitonkill && finduser(user)) {
|
||||
if (!ircd->quitonkill && finduser(user))
|
||||
do_kill(user, buf);
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -80,43 +71,46 @@ void kill_user(const char *source, const char *user, const char *reason)
|
||||
* @param reason for the sqline
|
||||
* @return void
|
||||
*/
|
||||
void sqline(char *mask, char *reason)
|
||||
void sqline(const std::string &mask, const std::string &reason)
|
||||
{
|
||||
int i;
|
||||
Channel *c, *next;
|
||||
const char *av[3];
|
||||
struct c_userlist *cu, *cunext;
|
||||
|
||||
if (ircd->chansqline) {
|
||||
if (*mask == '#') {
|
||||
if (ircd->chansqline)
|
||||
{
|
||||
if (mask[0] == '#')
|
||||
{
|
||||
ircdproto->SendSQLine(mask, reason);
|
||||
|
||||
for (i = 0; i < 1024; i++) {
|
||||
for (c = chanlist[i]; c; c = next) {
|
||||
for (i = 0; i < 1024; ++i)
|
||||
{
|
||||
for (c = chanlist[i]; c; c = next)
|
||||
{
|
||||
next = c->next;
|
||||
|
||||
if (!Anope::Match(c->name, mask, false)) {
|
||||
if (!Anope::Match(c->name, mask, false))
|
||||
continue;
|
||||
}
|
||||
for (cu = c->users; cu; cu = cunext) {
|
||||
for (cu = c->users; cu; cu = cunext)
|
||||
{
|
||||
cunext = cu->next;
|
||||
if (is_oper(cu->user)) {
|
||||
if (is_oper(cu->user))
|
||||
continue;
|
||||
}
|
||||
av[0] = c->name;
|
||||
av[1] = cu->user->nick;
|
||||
av[2] = reason;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ircdproto->SendSQLine(mask, reason);
|
||||
}
|
||||
} else {
|
||||
ircdproto->SendSQLine(mask, reason);
|
||||
else
|
||||
ircdproto->SendSQLine(mask, reason);
|
||||
}
|
||||
else
|
||||
ircdproto->SendSQLine(mask, reason);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -127,34 +121,32 @@ void sqline(char *mask, char *reason)
|
||||
* @param nick to remove the ban for
|
||||
* @return void
|
||||
*/
|
||||
void common_unban(ChannelInfo * ci, char *nick)
|
||||
void common_unban(ChannelInfo *ci, const std::string &nick)
|
||||
{
|
||||
char *host = NULL;
|
||||
uint32 ip = 0;
|
||||
User *u;
|
||||
Entry *ban, *next;
|
||||
|
||||
if (!ci || !ci->c || !nick) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(u = finduser(nick))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ci->c->bans || (ci->c->bans->count == 0))
|
||||
if (!ci || !ci->c || nick.empty())
|
||||
return;
|
||||
|
||||
if (u->hostip == NULL) {
|
||||
if (!(u = finduser(nick)))
|
||||
return;
|
||||
|
||||
if (!ci->c->bans || !ci->c->bans->count)
|
||||
return;
|
||||
|
||||
if (u->hostip == NULL)
|
||||
{
|
||||
host = host_resolve(u->host);
|
||||
/* we store the just resolved hostname so we don't
|
||||
* need to do this again */
|
||||
if (host) {
|
||||
if (host)
|
||||
u->hostip = sstrdup(host);
|
||||
}
|
||||
} else {
|
||||
host = sstrdup(u->hostip);
|
||||
}
|
||||
else
|
||||
host = sstrdup(u->hostip);
|
||||
/* Convert the host to an IP.. */
|
||||
if (host)
|
||||
ip = str_is_ip(host);
|
||||
@@ -166,8 +158,7 @@ void common_unban(ChannelInfo * ci, char *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, u->GetIdent().c_str(), u->host, ip) || entry_match(ban, u->nick, u->GetIdent().c_str(), u->GetDisplayedHost().c_str(), ip))
|
||||
ci->c->RemoveMode(NULL, CMODE_BAN, ban->mask);
|
||||
}
|
||||
}
|
||||
@@ -177,4 +168,3 @@ void common_unban(ChannelInfo * ci, char *nick)
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
+6
-4
@@ -483,13 +483,15 @@ void insert_bot(BotInfo * bi)
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
BotInfo *findbot(const char *nick)
|
||||
BotInfo *findbot(const std::string &nick)
|
||||
{
|
||||
BotInfo *bi;
|
||||
|
||||
if (!nick || !*nick)
|
||||
if (nick.empty())
|
||||
return NULL;
|
||||
|
||||
ci::string ci_nick(nick.c_str());
|
||||
|
||||
/*
|
||||
* XXX Less than efficient, but we need to do this for good TS6 support currently. This *will* improve. -- w00t
|
||||
*/
|
||||
@@ -497,10 +499,10 @@ BotInfo *findbot(const char *nick)
|
||||
{
|
||||
for (bi = botlists[i]; bi; bi = bi->next)
|
||||
{
|
||||
if (!stricmp(nick, bi->nick))
|
||||
if (ci_nick == bi->nick)
|
||||
return bi;
|
||||
|
||||
if (nick == bi->uid)
|
||||
if (ci_nick == bi->uid)
|
||||
return bi;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -153,10 +153,10 @@ void Channel::SetModeInternal(ChannelMode *cm, const std::string ¶m, bool En
|
||||
}
|
||||
|
||||
/* We don't track bots */
|
||||
if (findbot(param.c_str()))
|
||||
if (findbot(param))
|
||||
return;
|
||||
|
||||
User *u = finduser(param.c_str());
|
||||
User *u = finduser(param);
|
||||
if (!u)
|
||||
{
|
||||
if (debug)
|
||||
@@ -285,10 +285,10 @@ void Channel::RemoveModeInternal(ChannelMode *cm, const std::string ¶m, bool
|
||||
}
|
||||
|
||||
/* We don't track bots */
|
||||
if (findbot(param.c_str()))
|
||||
if (findbot(param))
|
||||
return;
|
||||
|
||||
User *u = finduser(param.c_str());
|
||||
User *u = finduser(param);
|
||||
if (!u)
|
||||
{
|
||||
alog("Channel::RemoveModeInternal() MODE %s +%c for nonexistant user %s", this->name, cm->ModeChar, param.c_str());
|
||||
@@ -354,7 +354,7 @@ void Channel::RemoveModeInternal(ChannelMode *cm, const std::string ¶m, bool
|
||||
/* Non registered channel, no mlock */
|
||||
if (!ci || !EnforceMLock || MOD_RESULT == EVENT_STOP)
|
||||
return;
|
||||
|
||||
|
||||
/* This channel has this the mode locked on */
|
||||
if (ci->HasMLock(cm->Name, true))
|
||||
{
|
||||
@@ -656,7 +656,7 @@ void ChanSetInternalModes(Channel *c, int ac, const char **av)
|
||||
{
|
||||
if (!ac)
|
||||
return;
|
||||
|
||||
|
||||
int k = 0, j = 0, add = -1;
|
||||
for (unsigned int i = 0; i < strlen(av[0]); ++i)
|
||||
{
|
||||
|
||||
@@ -70,7 +70,7 @@ class CommandCSForbid : public Command
|
||||
struct c_userlist *cu, *nextu;
|
||||
const char *av[3];
|
||||
|
||||
/* Before banning everyone, it might be prudent to clear +e and +I lists..
|
||||
/* Before banning everyone, it might be prudent to clear +e and +I lists..
|
||||
* to prevent ppl from rejoining.. ~ Viper */
|
||||
c->ClearExcepts();
|
||||
c->ClearInvites();
|
||||
@@ -95,7 +95,7 @@ class CommandCSForbid : public Command
|
||||
|
||||
if (ircd->chansqline)
|
||||
{
|
||||
ircdproto->SendSQLine(ci->name, ((reason) ? reason : "Forbidden"));
|
||||
ircdproto->SendSQLine(ci->name, reason ? reason : "Forbidden");
|
||||
}
|
||||
|
||||
alog("%s: %s set FORBID for channel %s", Config.s_ChanServ, u->nick, ci->name);
|
||||
|
||||
@@ -78,7 +78,7 @@ static void ReadDatabase(Module *m = NULL)
|
||||
}
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
continue;
|
||||
|
||||
|
||||
std::string mdbuf;
|
||||
NickCore *nc;
|
||||
NickAlias *na;
|
||||
@@ -98,7 +98,7 @@ static void ReadDatabase(Module *m = NULL)
|
||||
}
|
||||
else if (params[0] == "BI")
|
||||
{
|
||||
bi = findbot(params[1].c_str());
|
||||
bi = findbot(params[1]);
|
||||
Type = MD_BI;
|
||||
}
|
||||
else if (params[0] == "CH")
|
||||
@@ -731,7 +731,7 @@ class DBPlain : public Module
|
||||
ak->SetFlag(AK_STUCK);
|
||||
if (Nick)
|
||||
ak->SetFlag(AK_ISNICK);
|
||||
|
||||
|
||||
}
|
||||
else if (key == "MLOCK_ON" || buf == "MLOCK_OFF")
|
||||
{
|
||||
@@ -773,7 +773,7 @@ class DBPlain : public Module
|
||||
else if (key == "BI")
|
||||
{
|
||||
if (params[0] == "NAME")
|
||||
ci->bi = findbot(params[1].c_str());
|
||||
ci->bi = findbot(params[1]);
|
||||
else if (params[0] == "FLAGS")
|
||||
{
|
||||
for (unsigned j = 1; j < params.size(); ++j)
|
||||
@@ -1082,7 +1082,7 @@ class DBPlain : public Module
|
||||
FOREACH_MOD(I_OnDatabaseWriteMetadata, OnDatabaseWriteMetadata(WriteMetadata, ci));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HostCore *hc;
|
||||
for (hc = hostCoreListHead(); hc; hc = hc->next)
|
||||
{
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ class CommandOSStaff : public Command
|
||||
found = 0;
|
||||
std::string nick = it->first, type = it->second;
|
||||
|
||||
if ((au = finduser(nick.c_str())))
|
||||
if ((au = finduser(nick)))
|
||||
{
|
||||
found = 1;
|
||||
notice_lang(Config.s_OperServ, u, OPER_STAFF_FORMAT, '*', type.c_str(), nick.c_str());
|
||||
|
||||
@@ -167,9 +167,9 @@ class BahamutIRCdProto : public IRCDProto
|
||||
}
|
||||
|
||||
/* SVSMODE -b */
|
||||
void SendBanDel(Channel *c, const char *nick)
|
||||
void SendBanDel(Channel *c, const std::string &nick)
|
||||
{
|
||||
SendSVSModeChan(c, "-b", nick);
|
||||
SendSVSModeChan(c, "-b", nick.empty() ? NULL : nick.c_str());
|
||||
}
|
||||
|
||||
/* SVSMODE channel modes */
|
||||
@@ -180,10 +180,11 @@ class BahamutIRCdProto : public IRCDProto
|
||||
}
|
||||
|
||||
/* SQLINE */
|
||||
void SendSQLine(const char *mask, const char *reason)
|
||||
void SendSQLine(const std::string &mask, const std::string &reason)
|
||||
{
|
||||
if (!mask || !reason) return;
|
||||
send_cmd(NULL, "SQLINE %s :%s", mask, reason);
|
||||
if (mask.empty() || reason.empty())
|
||||
return;
|
||||
send_cmd(NULL, "SQLINE %s :%s", mask.c_str(), reason.c_str());
|
||||
}
|
||||
|
||||
/* UNSGLINE */
|
||||
|
||||
@@ -135,7 +135,7 @@ void inspircd_cmd_chghost(const char *nick, const char *vhost)
|
||||
return;
|
||||
send_cmd(Config.s_OperServ, "CHGHOST %s %s", nick, vhost);
|
||||
}
|
||||
else
|
||||
else
|
||||
ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGHOST not loaded!");
|
||||
}
|
||||
|
||||
@@ -260,10 +260,11 @@ class InspIRCdProto : public IRCDProto
|
||||
}
|
||||
|
||||
/* SQLINE */
|
||||
void SendSQLine(const char *mask, const char *reason)
|
||||
void SendSQLine(const std::string &mask, const std::string &reason)
|
||||
{
|
||||
if (!mask || !reason) return;
|
||||
send_cmd(Config.ServerName, "ADDLINE Q %s %s %ld 0 :%s", mask, Config.s_OperServ, static_cast<long>(time(NULL)), reason);
|
||||
if (mask.empty() || reason.empty())
|
||||
return;
|
||||
send_cmd(Config.ServerName, "ADDLINE Q %s %s %ld 0 :%s", mask.c_str(), Config.s_OperServ, static_cast<long>(time(NULL)), reason.c_str());
|
||||
}
|
||||
|
||||
/* SQUIT */
|
||||
|
||||
@@ -265,9 +265,11 @@ class InspIRCdProto : public IRCDProto
|
||||
}
|
||||
|
||||
/* SQLINE */
|
||||
void SendSQLine(const char *mask, const char *reason)
|
||||
void SendSQLine(const std::string &mask, const std::string &reason)
|
||||
{
|
||||
send_cmd(TS6SID, "ADDLINE Q %s %s %ld 0 :%s", mask, Config.s_OperServ, static_cast<long>(time(NULL)), reason);
|
||||
if (mask.empty() || reason.empty())
|
||||
return;
|
||||
send_cmd(TS6SID, "ADDLINE Q %s %s %ld 0 :%s", mask.c_str(), Config.s_OperServ, static_cast<long>(time(NULL)), reason.c_str());
|
||||
}
|
||||
|
||||
/* SQUIT */
|
||||
|
||||
@@ -173,9 +173,11 @@ class RatboxProto : public IRCDTS6Proto
|
||||
send_cmd(TS6SID, "OPERWALL :%s", buf);
|
||||
}
|
||||
|
||||
void SendSQLine(const char *mask, const char *reason)
|
||||
void SendSQLine(const std::string &mask, const std::string &reason)
|
||||
{
|
||||
send_cmd(TS6SID, "RESV * %s :%s", mask, reason);
|
||||
if (mask.empty() || reason.empty())
|
||||
return;
|
||||
send_cmd(TS6SID, "RESV * %s :%s", mask.c_str(), reason.c_str());
|
||||
}
|
||||
|
||||
void SendSGLineDel(SXLine *sx)
|
||||
|
||||
@@ -290,10 +290,11 @@ class UnrealIRCdProto : public IRCDProto
|
||||
** - Unreal will translate this to TKL for us
|
||||
**
|
||||
*/
|
||||
void SendSQLine(const char *mask, const char *reason)
|
||||
void SendSQLine(const std::string &mask, const std::string &reason)
|
||||
{
|
||||
if (!mask || !reason) return;
|
||||
send_cmd(NULL, "c %s :%s", mask, reason);
|
||||
if (mask.empty() || reason.empty())
|
||||
return;
|
||||
send_cmd(NULL, "c %s :%s", mask.c_str(), reason.c_str());
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -381,9 +382,9 @@ class UnrealIRCdProto : public IRCDProto
|
||||
}
|
||||
|
||||
/* SVSMODE -b */
|
||||
void SendBanDel(Channel *c, const char *nick)
|
||||
void SendBanDel(Channel *c, const std::string &nick)
|
||||
{
|
||||
SendSVSModeChan(c, "-b", nick);
|
||||
SendSVSModeChan(c, "-b", nick.empty() ? NULL : nick.c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -958,7 +959,7 @@ int anope_event_userhost(const char *source, int ac, const char **av)
|
||||
std::string host = std::string(std::find(reply.begin(), reply.end(), '@'), reply.end());
|
||||
host.erase(host.begin());
|
||||
|
||||
User *u = finduser(user.c_str());
|
||||
User *u = finduser(user);
|
||||
if (u)
|
||||
{
|
||||
u->SetCloakedHost(host);
|
||||
|
||||
+17
-15
@@ -441,18 +441,20 @@ void get_user_stats(long *nusers, long *memuse)
|
||||
|
||||
/* Find a user by nick. Return NULL if user could not be found. */
|
||||
|
||||
User *finduser(const char *nick)
|
||||
User *finduser(const std::string &nick)
|
||||
{
|
||||
User *user;
|
||||
|
||||
if (debug >= 3)
|
||||
alog("debug: finduser(%p)", nick);
|
||||
alog("debug: finduser(%p)", nick.c_str());
|
||||
|
||||
if (isdigit(*nick) && ircd->ts6)
|
||||
if (isdigit(nick[0]) && ircd->ts6)
|
||||
return find_byuid(nick);
|
||||
|
||||
ci::string ci_nick(nick.c_str());
|
||||
|
||||
user = userlist[HASH(nick)];
|
||||
while (user && stricmp(user->nick, nick) != 0)
|
||||
while (user && ci_nick != user->nick)
|
||||
user = user->next;
|
||||
if (debug >= 3)
|
||||
alog("debug: finduser(%s) -> 0x%p", nick, static_cast<void *>(user));
|
||||
@@ -477,7 +479,7 @@ void User::SetModeInternal(UserMode *um, const std::string &Param)
|
||||
{
|
||||
if (!um)
|
||||
return;
|
||||
|
||||
|
||||
modes[um->Name] = true;
|
||||
if (!Param.empty())
|
||||
{
|
||||
@@ -494,7 +496,7 @@ void User::RemoveModeInternal(UserMode *um)
|
||||
{
|
||||
if (!um)
|
||||
return;
|
||||
|
||||
|
||||
modes[um->Name] = false;
|
||||
std::map<UserModeName, std::string>::iterator it = Params.find(um->Name);
|
||||
if (it != Params.end())
|
||||
@@ -601,11 +603,11 @@ void User::SetModes(BotInfo *bi, const std::string &modes, ...)
|
||||
default:
|
||||
if (add == -1)
|
||||
continue;
|
||||
um = ModeManager::FindUserModeByChar(modebuf[i]);
|
||||
um = ModeManager::FindUserModeByChar(modebuf[i]);
|
||||
if (!um)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (add)
|
||||
{
|
||||
if (um->Type == MODE_PARAM && sep.GetToken(sbuf))
|
||||
@@ -654,7 +656,7 @@ User *nextuser()
|
||||
return current;
|
||||
}
|
||||
|
||||
User *find_byuid(const char *uid)
|
||||
User *find_byuid(const std::string &uid)
|
||||
{
|
||||
User *u, *next;
|
||||
|
||||
@@ -1001,7 +1003,7 @@ void do_quit(const char *source, int ac, const char **av)
|
||||
* av[1] = reason
|
||||
*/
|
||||
|
||||
void do_kill(const char *nick, const char *msg)
|
||||
void do_kill(const std::string &nick, const std::string &msg)
|
||||
{
|
||||
User *user;
|
||||
NickAlias *na;
|
||||
@@ -1009,18 +1011,18 @@ void do_kill(const char *nick, const char *msg)
|
||||
user = finduser(nick);
|
||||
if (!user) {
|
||||
if (debug) {
|
||||
alog("debug: KILL of nonexistent nick: %s", nick);
|
||||
alog("debug: KILL of nonexistent nick: %s", nick.c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (debug) {
|
||||
alog("debug: %s killed", nick);
|
||||
alog("debug: %s killed", nick.c_str());
|
||||
}
|
||||
if ((na = findnick(user->nick)) && !na->HasFlag(NS_FORBIDDEN) && !na->nc->HasFlag(NI_SUSPENDED) && (user->IsRecognized() || nick_identified(user))) {
|
||||
na->last_seen = time(NULL);
|
||||
if (na->last_quit)
|
||||
delete [] na->last_quit;
|
||||
na->last_quit = *msg ? sstrdup(msg) : NULL;
|
||||
na->last_quit = !msg.empty() ? sstrdup(msg.c_str()) : NULL;
|
||||
|
||||
}
|
||||
if (Config.LimitSessions && !is_ulined(user->server->name)) {
|
||||
@@ -1198,10 +1200,10 @@ void UserSetInternalModes(User *user, int ac, const char **av)
|
||||
const char *modes = av[0];
|
||||
if (!user || !modes)
|
||||
return;
|
||||
|
||||
|
||||
if (debug)
|
||||
alog("debug: Changing user modes for %s to %s", user->nick, merge_args(ac, av));
|
||||
|
||||
|
||||
for (; *modes; *modes++)
|
||||
{
|
||||
UserMode *um;
|
||||
|
||||
Reference in New Issue
Block a user