summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/commands.h2
-rw-r--r--include/config.h6
-rw-r--r--include/dns.h3
-rw-r--r--include/extern.h4
-rw-r--r--include/services.h4
-rw-r--r--modules/core/ms_cancel.cpp12
-rw-r--r--modules/core/ms_info.cpp58
-rw-r--r--modules/core/ms_set.cpp6
-rw-r--r--modules/core/ns_set.cpp2
-rw-r--r--modules/core/os_session.cpp9
-rw-r--r--src/bots.cpp6
-rw-r--r--src/command.cpp2
-rw-r--r--src/config.cpp6
-rw-r--r--src/dns.cpp2
-rw-r--r--src/memoserv.cpp2
-rw-r--r--src/sessions.cpp2
16 files changed, 64 insertions, 62 deletions
diff --git a/include/commands.h b/include/commands.h
index 714d1c48d..545c9dd7b 100644
--- a/include/commands.h
+++ b/include/commands.h
@@ -114,7 +114,7 @@ class CoreExport Command : public Flags<CommandFlag>
* @param name The subcommand name
* @return The subcommand
*/
- virtual Command *FindSubcommand(const Anope::string &name);
+ virtual Command *FindSubcommand(const Anope::string &subcommand);
};
#endif // COMMANDS_H
diff --git a/include/config.h b/include/config.h
index f1a4ccca7..839af5db8 100644
--- a/include/config.h
+++ b/include/config.h
@@ -601,7 +601,7 @@ class ServerConfig
/* Force email when registering */
bool NSForceEmail;
/* Max number of nicks in a group */
- int NSMaxAliases;
+ unsigned NSMaxAliases;
/* Max number of allowed strings on the access list */
unsigned NSAccessMax;
/* Enforcer client user name */
@@ -756,7 +756,7 @@ class ServerConfig
/* How long before exceptions expire */
time_t ExceptionExpiry;
/* How many times to kill before adding an KILL */
- int MaxSessionKill;
+ unsigned MaxSessionKill;
/* Max limit that can be used for exceptions */
unsigned MaxSessionLimit;
/* How long session akills should last */
@@ -792,7 +792,7 @@ class ServerConfig
/* Timeout before defcon is reset */
time_t DefConTimeOut;
/* Session limiit to use when using defcon */
- int DefConSessionLimit;
+ unsigned DefConSessionLimit;
/* How long to add akills for defcon */
time_t DefConAKILL;
/* Chan modes for defcon */
diff --git a/include/dns.h b/include/dns.h
index 9f9d26fc3..44e8d515b 100644
--- a/include/dns.h
+++ b/include/dns.h
@@ -119,11 +119,12 @@ struct DNSRecord
/* Record class, should always be 1 */
unsigned short record_class;
/* Time to live */
- unsigned long ttl;
+ time_t ttl;
/* Record length */
unsigned short rdlength;
inline DNSRecord();
+ /* When this record was created in our cache */
time_t created;
};
diff --git a/include/extern.h b/include/extern.h
index cd8d1b70f..3b20bba8d 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -207,7 +207,7 @@ E void rsend_notify(User *u, Memo *m, const Anope::string &chan);
E void check_memos(User *u);
E MemoInfo *getmemoinfo(const Anope::string &name, bool &ischan, bool &isforbid);
E void memo_send(User *u, const Anope::string &name, const Anope::string &text, int z);
-E bool delmemo(MemoInfo *mi, int num);
+E bool delmemo(MemoInfo *mi, unsigned num);
/**** messages.c ****/
@@ -330,7 +330,7 @@ E Session *findsession(const Anope::string &host);
E Exception *find_host_exception(const Anope::string &host);
E Exception *find_hostip_exception(const Anope::string &host, const Anope::string &hostip);
-E int exception_add(User *u, const Anope::string &mask, int limit, const Anope::string &reason, const Anope::string &who, time_t expires);
+E int exception_add(User *u, const Anope::string &mask, unsigned limit, const Anope::string &reason, const Anope::string &who, time_t expires);
/**** sockets.cpp ****/
diff --git a/include/services.h b/include/services.h
index ae51653a0..4a02cadb9 100644
--- a/include/services.h
+++ b/include/services.h
@@ -484,7 +484,7 @@ class Memo : public Flags<MemoFlag>
struct MemoInfo
{
- int16 memomax;
+ unsigned memomax;
std::vector<Memo *> memos;
};
@@ -828,7 +828,7 @@ struct MailInfo
struct Exception
{
Anope::string mask; /* Hosts to which this exception applies */
- int limit; /* Session limit for exception */
+ unsigned limit; /* Session limit for exception */
Anope::string who; /* Nick of person who added the exception */
Anope::string reason; /* Reason for exception's addition */
time_t time; /* When this exception was added */
diff --git a/modules/core/ms_cancel.cpp b/modules/core/ms_cancel.cpp
index e9a58c9d5..a7d824d38 100644
--- a/modules/core/ms_cancel.cpp
+++ b/modules/core/ms_cancel.cpp
@@ -25,15 +25,15 @@ class CommandMSCancel : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
bool ischan, isforbid;
- Anope::string name = params[0];
+ Anope::string nname = params[0];
MemoInfo *mi;
- if (!(mi = getmemoinfo(name, ischan, isforbid)))
+ if (!(mi = getmemoinfo(nname, ischan, isforbid)))
{
if (isforbid)
- u->SendMessage(MemoServ, ischan ? CHAN_X_FORBIDDEN : NICK_X_FORBIDDEN, name.c_str());
+ u->SendMessage(MemoServ, ischan ? CHAN_X_FORBIDDEN : NICK_X_FORBIDDEN, nname.c_str());
else
- u->SendMessage(MemoServ, ischan ? CHAN_X_NOT_REGISTERED : NICK_X_NOT_REGISTERED, name.c_str());
+ u->SendMessage(MemoServ, ischan ? CHAN_X_NOT_REGISTERED : NICK_X_NOT_REGISTERED, nname.c_str());
}
else
{
@@ -42,9 +42,9 @@ class CommandMSCancel : public Command
for (i = mi->memos.size() - 1; i >= 0; --i)
if (mi->memos[i]->HasFlag(MF_UNREAD) && u->Account()->display.equals_ci(mi->memos[i]->sender) && !mi->memos[i]->HasFlag(MF_NOTIFYS))
{
- FOREACH_MOD(I_OnMemoDel, OnMemoDel(findnick(name)->nc, mi, mi->memos[i]->number));
+ FOREACH_MOD(I_OnMemoDel, OnMemoDel(findnick(nname)->nc, mi, mi->memos[i]->number));
delmemo(mi, mi->memos[i]->number);
- u->SendMessage(MemoServ, MEMO_CANCELLED, name.c_str());
+ u->SendMessage(MemoServ, MEMO_CANCELLED, nname.c_str());
return MOD_CONT;
}
diff --git a/modules/core/ms_info.cpp b/modules/core/ms_info.cpp
index 9c0d07a55..09bf8f97d 100644
--- a/modules/core/ms_info.cpp
+++ b/modules/core/ms_info.cpp
@@ -25,30 +25,30 @@ class CommandMSInfo : public Command
const MemoInfo *mi;
NickAlias *na = NULL;
ChannelInfo *ci = NULL;
- Anope::string name = !params.empty() ? params[0] : "";
+ Anope::string nname = !params.empty() ? params[0] : "";
int hardmax = 0;
- if (!name.empty() && name[0] != '#' && u->Account()->HasPriv("memoserv/info"))
+ if (!nname.empty() && nname[0] != '#' && u->Account()->HasPriv("memoserv/info"))
{
- na = findnick(name);
+ na = findnick(nname);
if (!na)
{
- u->SendMessage(MemoServ, NICK_X_NOT_REGISTERED, name.c_str());
+ u->SendMessage(MemoServ, NICK_X_NOT_REGISTERED, nname.c_str());
return MOD_CONT;
}
else if (na->HasFlag(NS_FORBIDDEN))
{
- u->SendMessage(MemoServ, NICK_X_FORBIDDEN, name.c_str());
+ u->SendMessage(MemoServ, NICK_X_FORBIDDEN, nname.c_str());
return MOD_CONT;
}
mi = &na->nc->memos;
hardmax = na->nc->HasFlag(NI_MEMO_HARDMAX) ? 1 : 0;
}
- else if (!name.empty() && name[0] == '#')
+ else if (!nname.empty() && nname[0] == '#')
{
- if (!(ci = cs_findchan(name)))
+ if (!(ci = cs_findchan(nname)))
{
- u->SendMessage(MemoServ, CHAN_X_NOT_REGISTERED, name.c_str());
+ u->SendMessage(MemoServ, CHAN_X_NOT_REGISTERED, nname.c_str());
return MOD_CONT;
}
else if (!check_access(u, ci, CA_MEMO))
@@ -59,7 +59,7 @@ class CommandMSInfo : public Command
mi = &ci->memos;
hardmax = ci->HasFlag(CI_MEMO_HARDMAX) ? 1 : 0;
}
- else if (!name.empty()) /* It's not a chan and we aren't services admin */
+ else if (!nname.empty()) /* It's not a chan and we aren't services admin */
{
u->SendMessage(MemoServ, ACCESS_DENIED);
return MOD_CONT;
@@ -70,64 +70,64 @@ class CommandMSInfo : public Command
hardmax = u->Account()->HasFlag(NI_MEMO_HARDMAX) ? 1 : 0;
}
- if (!name.empty() && (ci || na->nc != u->Account()))
+ if (!nname.empty() && (ci || na->nc != u->Account()))
{
if (mi->memos.empty())
- u->SendMessage(MemoServ, MEMO_INFO_X_NO_MEMOS, name.c_str());
+ u->SendMessage(MemoServ, MEMO_INFO_X_NO_MEMOS, nname.c_str());
else if (mi->memos.size() == 1)
{
if (mi->memos[0]->HasFlag(MF_UNREAD))
- u->SendMessage(MemoServ, MEMO_INFO_X_MEMO_UNREAD, name.c_str());
+ u->SendMessage(MemoServ, MEMO_INFO_X_MEMO_UNREAD, nname.c_str());
else
- u->SendMessage(MemoServ, MEMO_INFO_X_MEMO, name.c_str());
+ u->SendMessage(MemoServ, MEMO_INFO_X_MEMO, nname.c_str());
}
else
{
- int count = 0, i, end;
+ unsigned count = 0, i, end;
for (i = 0, end = mi->memos.size(); i < end; ++i)
if (mi->memos[i]->HasFlag(MF_UNREAD))
++count;
if (count == mi->memos.size())
- u->SendMessage(MemoServ, MEMO_INFO_X_MEMOS_ALL_UNREAD, name.c_str(), count);
+ u->SendMessage(MemoServ, MEMO_INFO_X_MEMOS_ALL_UNREAD, nname.c_str(), count);
else if (!count)
- u->SendMessage(MemoServ, MEMO_INFO_X_MEMOS, name.c_str(), mi->memos.size());
+ u->SendMessage(MemoServ, MEMO_INFO_X_MEMOS, nname.c_str(), mi->memos.size());
else if (count == 1)
- u->SendMessage(MemoServ, MEMO_INFO_X_MEMOS_ONE_UNREAD, name.c_str(), mi->memos.size());
+ u->SendMessage(MemoServ, MEMO_INFO_X_MEMOS_ONE_UNREAD, nname.c_str(), mi->memos.size());
else
- u->SendMessage(MemoServ, MEMO_INFO_X_MEMOS_SOME_UNREAD, name.c_str(), mi->memos.size(), count);
+ u->SendMessage(MemoServ, MEMO_INFO_X_MEMOS_SOME_UNREAD, nname.c_str(), mi->memos.size(), count);
}
if (!mi->memomax)
{
if (hardmax)
- u->SendMessage(MemoServ, MEMO_INFO_X_HARD_LIMIT, name.c_str(), mi->memomax);
+ u->SendMessage(MemoServ, MEMO_INFO_X_HARD_LIMIT, nname.c_str(), mi->memomax);
else
- u->SendMessage(MemoServ, MEMO_INFO_X_LIMIT, name.c_str(), mi->memomax);
+ u->SendMessage(MemoServ, MEMO_INFO_X_LIMIT, nname.c_str(), mi->memomax);
}
else if (mi->memomax > 0)
{
if (hardmax)
- u->SendMessage(MemoServ, MEMO_INFO_X_HARD_LIMIT, name.c_str(), mi->memomax);
+ u->SendMessage(MemoServ, MEMO_INFO_X_HARD_LIMIT, nname.c_str(), mi->memomax);
else
- u->SendMessage(MemoServ, MEMO_INFO_X_LIMIT, name.c_str(), mi->memomax);
+ u->SendMessage(MemoServ, MEMO_INFO_X_LIMIT, nname.c_str(), mi->memomax);
}
else
- u->SendMessage(MemoServ, MEMO_INFO_X_NO_LIMIT, name.c_str());
+ u->SendMessage(MemoServ, MEMO_INFO_X_NO_LIMIT, nname.c_str());
/* I ripped this code out of ircservices 4.4.5, since I didn't want
to rewrite the whole thing (it pisses me off). */
if (na)
{
if (na->nc->HasFlag(NI_MEMO_RECEIVE) && na->nc->HasFlag(NI_MEMO_SIGNON))
- u->SendMessage(MemoServ, MEMO_INFO_X_NOTIFY_ON, name.c_str());
+ u->SendMessage(MemoServ, MEMO_INFO_X_NOTIFY_ON, nname.c_str());
else if (na->nc->HasFlag(NI_MEMO_RECEIVE))
- u->SendMessage(MemoServ, MEMO_INFO_X_NOTIFY_RECEIVE, name.c_str());
+ u->SendMessage(MemoServ, MEMO_INFO_X_NOTIFY_RECEIVE, nname.c_str());
else if (na->nc->HasFlag(NI_MEMO_SIGNON))
- u->SendMessage(MemoServ, MEMO_INFO_X_NOTIFY_SIGNON, name.c_str());
+ u->SendMessage(MemoServ, MEMO_INFO_X_NOTIFY_SIGNON, nname.c_str());
else
- u->SendMessage(MemoServ, MEMO_INFO_X_NOTIFY_OFF, name.c_str());
+ u->SendMessage(MemoServ, MEMO_INFO_X_NOTIFY_OFF, nname.c_str());
}
}
- else /* !name || (!ci || na->nc == u->Account()) */
+ else /* !nname || (!ci || na->nc == u->Account()) */
{
if (mi->memos.empty())
u->SendMessage(MemoServ, MEMO_INFO_NO_MEMOS);
@@ -140,7 +140,7 @@ class CommandMSInfo : public Command
}
else
{
- int count = 0, i, end;
+ unsigned count = 0, i, end;
for (i = 0, end = mi->memos.size(); i < end; ++i)
if (mi->memos[i]->HasFlag(MF_UNREAD))
++count;
diff --git a/modules/core/ms_set.cpp b/modules/core/ms_set.cpp
index a49e849f1..492111389 100644
--- a/modules/core/ms_set.cpp
+++ b/modules/core/ms_set.cpp
@@ -134,7 +134,7 @@ class CommandMSSet : public Command
else
nc->UnsetFlag(NI_MEMO_HARDMAX);
}
- limit = p1.is_number_only() ? convertTo<int32>(p1) : -1;
+ limit = p1.is_pos_number_only() ? convertTo<int32>(p1) : -1;
if (limit < 0 || limit > 32767)
{
u->SendMessage(MemoServ, MEMO_SET_LIMIT_OVERFLOW, 32767);
@@ -160,10 +160,10 @@ class CommandMSSet : public Command
u->SendMessage(MemoServ, MEMO_SET_YOUR_LIMIT_FORBIDDEN);
return MOD_CONT;
}
- limit = p1.is_number_only() ? convertTo<int32>(p1) : -1;
+ limit = p1.is_pos_number_only() ? convertTo<int32>(p1) : -1;
/* The first character is a digit, but we could still go negative
* from overflow... watch out! */
- if (limit < 0 || (Config->MSMaxMemos > 0 && limit > Config->MSMaxMemos))
+ if (limit < 0 || (Config->MSMaxMemos > 0 && convertTo<unsigned>(limit) > Config->MSMaxMemos))
{
if (!chan.empty())
u->SendMessage(MemoServ, MEMO_SET_LIMIT_TOO_HIGH, chan.c_str(), Config->MSMaxMemos);
diff --git a/modules/core/ns_set.cpp b/modules/core/ns_set.cpp
index 51949ad8e..dd932d606 100644
--- a/modules/core/ns_set.cpp
+++ b/modules/core/ns_set.cpp
@@ -165,7 +165,7 @@ class CommandNSSetPassword : public Command
{
Anope::string param = params[1];
- int len = param.length();
+ unsigned len = param.length();
if (u->Account()->display.equals_ci(param) || (Config->StrictPasswords && len < 5))
{
diff --git a/modules/core/os_session.cpp b/modules/core/os_session.cpp
index e88e9a856..51f98b951 100644
--- a/modules/core/os_session.cpp
+++ b/modules/core/os_session.cpp
@@ -123,10 +123,11 @@ class CommandOSSession : public Command
private:
CommandReturn DoList(User *u, const std::vector<Anope::string> &params)
{
- int mincount;
Anope::string param = params[1];
- if ((mincount = (param.is_number_only() ? convertTo<int>(param) : 0)) <= 1)
+ unsigned mincount = param.is_pos_number_only() ? convertTo<unsigned>(param) : 0;
+
+ if (mincount <= 1)
u->SendMessage(OperServ, OPER_SESSION_INVALID_THRESHOLD);
else
{
@@ -318,8 +319,8 @@ class CommandOSException : public Command
return MOD_CONT;
}
- n1 = n1str.is_number_only() ? convertTo<int>(n1str) - 1 : -1;
- n2 = n2str.is_number_only() ? convertTo<int>(n2str) - 1 : -1;
+ n1 = n1str.is_pos_number_only() ? convertTo<int>(n1str) - 1 : -1;
+ n2 = n2str.is_pos_number_only() ? convertTo<int>(n2str) - 1 : -1;
if (n1 >= 0 && n1 < exceptions.size() && n2 >= 0 && n2 < exceptions.size() && n1 != n2)
{
diff --git a/src/bots.cpp b/src/bots.cpp
index fbb5de3c7..e1d70d05a 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -155,9 +155,9 @@ void BotInfo::Join(Channel *c, bool update_ts)
}
Anope::string Limit;
- int limit = 0;
- if (c->GetParam(CMODE_LIMIT, Limit) && Limit.is_number_only())
- limit = convertTo<int>(Limit);
+ unsigned limit = 0;
+ if (c->GetParam(CMODE_LIMIT, Limit) && Limit.is_pos_number_only())
+ limit = convertTo<unsigned>(Limit);
/* Should we be invited? */
if (c->HasMode(CMODE_INVITE) || (limit && c->users.size() >= limit))
diff --git a/src/command.cpp b/src/command.cpp
index 93c1f978c..19ca62544 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -46,7 +46,7 @@ bool Command::DelSubcommand(Command *c)
return false;
}
-Command *Command::FindSubcommand(const Anope::string &name)
+Command *Command::FindSubcommand(const Anope::string &subcommand)
{
return NULL;
}
diff --git a/src/config.cpp b/src/config.cpp
index e692682b8..898f9bf70 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -1101,7 +1101,7 @@ void ServerConfig::Read()
{"nickserv", "resenddelay", "0", new ValueContainerTime(&this->NSResendDelay), DT_TIME, NoValidation},
{"nickserv", "expire", "21d", new ValueContainerTime(&this->NSExpire), DT_TIME, NoValidation},
{"nickserv", "preregexpire", "0", new ValueContainerTime(&this->NSRExpire), DT_TIME, ValidateEmailReg},
- {"nickserv", "maxaliases", "0", new ValueContainerInt(&this->NSMaxAliases), DT_INTEGER, NoValidation},
+ {"nickserv", "maxaliases", "0", new ValueContainerUInt(&this->NSMaxAliases), DT_UINTEGER, NoValidation},
{"nickserv", "accessmax", "0", new ValueContainerUInt(&this->NSAccessMax), DT_UINTEGER, ValidateNotZero},
{"nickserv", "enforceruser", "", new ValueContainerString(&temp_nsuserhost), DT_STRING, ValidateNotEmpty},
{"nickserv", "releasetimeout", "0", new ValueContainerTime(&this->NSReleaseTimeout), DT_TIME, ValidateNotZero},
@@ -1176,7 +1176,7 @@ void ServerConfig::Read()
{"operserv", "exceptionexpiry", "0", new ValueContainerTime(&this->ExceptionExpiry), DT_TIME, ValidateOperServ},
{"operserv", "sessionlimitexceeded", "", new ValueContainerString(&this->SessionLimitExceeded), DT_STRING, NoValidation},
{"operserv", "sessionlimitdetailsloc", "", new ValueContainerString(&this->SessionLimitDetailsLoc), DT_STRING, NoValidation},
- {"operserv", "maxsessionkill", "0", new ValueContainerInt(&this->MaxSessionKill), DT_INTEGER, NoValidation},
+ {"operserv", "maxsessionkill", "0", new ValueContainerUInt(&this->MaxSessionKill), DT_UINTEGER, NoValidation},
{"operserv", "sessionautokillexpiry", "0", new ValueContainerTime(&this->SessionAutoKillExpiry), DT_TIME, NoValidation},
{"operserv", "addakiller", "no", new ValueContainerBool(&this->AddAkiller), DT_BOOLEAN, NoValidation},
{"operserv", "opersonly", "no", new ValueContainerBool(&this->OSOpersOnly), DT_BOOLEAN, NoValidation},
@@ -1187,7 +1187,7 @@ void ServerConfig::Read()
{"defcon", "level3", "", new ValueContainerString(&DefCon3), DT_STRING, ValidateDefCon},
{"defcon", "level2", "", new ValueContainerString(&DefCon2), DT_STRING, ValidateDefCon},
{"defcon", "level1", "", new ValueContainerString(&DefCon1), DT_STRING, ValidateDefCon},
- {"defcon", "sessionlimit", "0", new ValueContainerInt(&this->DefConSessionLimit), DT_INTEGER, ValidateDefCon},
+ {"defcon", "sessionlimit", "0", new ValueContainerUInt(&this->DefConSessionLimit), DT_UINTEGER, ValidateDefCon},
{"defcon", "akillexpire", "0", new ValueContainerTime(&this->DefConAKILL), DT_TIME, ValidateDefCon},
{"defcon", "chanmodes", "", new ValueContainerString(&this->DefConChanModes), DT_STRING, ValidateDefCon},
{"defcon", "timeout", "0", new ValueContainerTime(&this->DefConTimeOut), DT_TIME, NoValidation},
diff --git a/src/dns.cpp b/src/dns.cpp
index 2c586b02e..c4cfbda51 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -38,7 +38,7 @@ DNSRequest::DNSRequest(const Anope::string &addr, QueryType qt, bool cache, Modu
return;
}
- short packet_id;
+ unsigned short packet_id;
while (DNSEngine->requests.count((packet_id = GetRandomID())));
p->id = this->id = packet_id;
diff --git a/src/memoserv.cpp b/src/memoserv.cpp
index f27db9742..3d45dac2e 100644
--- a/src/memoserv.cpp
+++ b/src/memoserv.cpp
@@ -296,7 +296,7 @@ void memo_send(User *u, const Anope::string &name, const Anope::string &text, in
* @param num Memo number to delete
* @return int 1 if the memo was found, else 0.
*/
-bool delmemo(MemoInfo *mi, int num)
+bool delmemo(MemoInfo *mi, unsigned num)
{
if (mi->memos.empty())
return false;
diff --git a/src/sessions.cpp b/src/sessions.cpp
index 38dfedef5..f13683050 100644
--- a/src/sessions.cpp
+++ b/src/sessions.cpp
@@ -255,7 +255,7 @@ Exception *find_hostip_exception(const Anope::string &host, const Anope::string
/************************ Exception Manipulation *************************/
/*************************************************************************/
-int exception_add(User *u, const Anope::string &mask, int limit, const Anope::string &reason, const Anope::string &who, time_t expires)
+int exception_add(User *u, const Anope::string &mask, unsigned limit, const Anope::string &reason, const Anope::string &who, time_t expires)
{
/* Check if an exception already exists for this mask */
for (std::vector<Exception *>::iterator it = exceptions.begin(), it_end = exceptions.end(); it != it_end; ++it)