summaryrefslogtreecommitdiff
path: root/src/core/ms_read.c
diff options
context:
space:
mode:
authorcyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2009-07-25 00:37:43 +0000
committercyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2009-07-25 00:37:43 +0000
commitb2a57b09742da6c2f2011ad41eb470139d88e14f (patch)
tree054e41a724108706c5ea5f659d2065fe5fae2504 /src/core/ms_read.c
parent443654f15bf036bb18f9847332e2bd03ec823b3d (diff)
Changed params parameter of Command's Execute() from std::vector<std::string> to std::vector<ci::string>, seems to have no ill effects but may require some testing to be sure.
Also a few minor cleanups here and there. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2392 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/core/ms_read.c')
-rw-r--r--src/core/ms_read.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/core/ms_read.c b/src/core/ms_read.c
index 4335565da..a0d13ea95 100644
--- a/src/core/ms_read.c
+++ b/src/core/ms_read.c
@@ -26,21 +26,21 @@ class CommandMSRead : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
MemoInfo *mi;
ChannelInfo *ci;
- const char *numstr = params.size() ? params[0].c_str() : NULL, *chan = NULL;
+ ci::string numstr = params.size() ? params[0] : "", chan;
int num, count;
- if (numstr && *numstr == '#')
+ if (!numstr.empty() && numstr[0] == '#')
{
chan = numstr;
- numstr = params.size() > 1 ? params[1].c_str() : NULL;
+ numstr = params.size() > 1 ? params[1] : "";
- if (!(ci = cs_findchan(chan)))
+ if (!(ci = cs_findchan(chan.c_str())))
{
- notice_lang(s_MemoServ, u, CHAN_X_NOT_REGISTERED, chan);
+ notice_lang(s_MemoServ, u, CHAN_X_NOT_REGISTERED, chan.c_str());
return MOD_CONT;
}
else if (!check_access(u, ci, CA_MEMO))
@@ -54,51 +54,51 @@ class CommandMSRead : public Command
{
mi = &u->nc->memos;
}
- num = numstr ? atoi(numstr) : -1;
- if (!numstr || (stricmp(numstr, "LAST") && stricmp(numstr, "NEW") && num <= 0))
+ num = !numstr.empty() ? atoi(numstr.c_str()) : -1;
+ if (numstr.empty() || (numstr != "LAST" && numstr != "NEW" && num <= 0))
this->OnSyntaxError(u);
else if (mi->memos.empty())
{
- if (chan)
- notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_MEMOS, chan);
+ if (!chan.empty())
+ notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_MEMOS, chan.c_str());
else
notice_lang(s_MemoServ, u, MEMO_HAVE_NO_MEMOS);
}
else {
int i;
- if (!stricmp(numstr, "NEW"))
+ if (numstr == "NEW")
{
int readcount = 0;
for (i = 0; i < mi->memos.size(); ++i)
{
if (mi->memos[i]->flags & MF_UNREAD)
{
- read_memo(u, i, mi, chan);
+ read_memo(u, i, mi, chan.c_str());
++readcount;
}
}
if (!readcount)
{
- if (chan)
- notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_NEW_MEMOS, chan);
+ if (!chan.empty())
+ notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_NEW_MEMOS, chan.c_str());
else
notice_lang(s_MemoServ, u, MEMO_HAVE_NO_NEW_MEMOS);
}
}
- else if (!stricmp(numstr, "LAST"))
+ else if (numstr == "LAST")
{
for (i = 0; i < mi->memos.size() - 1; ++i);
- read_memo(u, i, mi, chan);
+ read_memo(u, i, mi, chan.c_str());
}
else /* number[s] */
{
- if (!process_numlist(numstr, &count, read_memo_callback, u, mi, chan))
+ if (!process_numlist(numstr.c_str(), &count, read_memo_callback, u, mi, chan.c_str()))
{
if (count == 1)
notice_lang(s_MemoServ, u, MEMO_DOES_NOT_EXIST, num);
else
- notice_lang(s_MemoServ, u, MEMO_LIST_NOT_FOUND, numstr);
+ notice_lang(s_MemoServ, u, MEMO_LIST_NOT_FOUND, numstr.c_str());
}
}
}