summaryrefslogtreecommitdiff
path: root/src/mail.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-09-10 20:31:31 -0400
committerAdam <Adam@anope.org>2010-09-10 20:31:31 -0400
commitf00e76d30a86acf0f18bcde5647eedd50de50569 (patch)
tree04af81a883ea6e71ec36e35a2822487c7f8192c6 /src/mail.cpp
parent9eb7562bee7f2a52cf91b0ab0ebc10351f2a46f2 (diff)
Added Anope::CurTime to keep us from calling time() everywhere
Diffstat (limited to 'src/mail.cpp')
-rw-r--r--src/mail.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/mail.cpp b/src/mail.cpp
index 666355b0a..55e99e406 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -35,17 +35,15 @@ bool Mail(User *u, NickRequest *nr, const Anope::string &service, const Anope::s
if (!u || !nr || subject.empty() || service.empty() || message.empty())
return false;
- time_t t = time(NULL);
-
if (!Config->UseMail)
notice_lang(service, u, MAIL_DISABLED);
- else if (t - u->lastmail < Config->MailDelay)
- notice_lang(service, u, MAIL_DELAYED, Config->MailDelay - t - u->lastmail);
+ else if (Anope::CurTime - u->lastmail < Config->MailDelay)
+ notice_lang(service, u, MAIL_DELAYED, Config->MailDelay - Anope::CurTime - u->lastmail);
else if (nr->email.empty())
notice_lang(service, u, MAIL_INVALID, nr->nick.c_str());
else
{
- u->lastmail = nr->lastmail = t;
+ u->lastmail = nr->lastmail = Anope::CurTime;
threadEngine.Start(new MailThread(nr->nick, nr->email, subject, message));
return true;
}
@@ -58,17 +56,15 @@ bool Mail(User *u, NickCore *nc, const Anope::string &service, const Anope::stri
if (!u || !nc || subject.empty() || service.empty() || message.empty())
return false;
- time_t t = time(NULL);
-
if (!Config->UseMail)
notice_lang(service, u, MAIL_DISABLED);
- else if (t - u->lastmail < Config->MailDelay)
- notice_lang(service, u, MAIL_DELAYED, Config->MailDelay - t - u->lastmail);
+ else if (Anope::CurTime - u->lastmail < Config->MailDelay)
+ notice_lang(service, u, MAIL_DELAYED, Config->MailDelay - Anope::CurTime - u->lastmail);
else if (nc->email.empty())
notice_lang(service, u, MAIL_INVALID, nc->display.c_str());
else
{
- u->lastmail = nc->lastmail = t;
+ u->lastmail = nc->lastmail = Anope::CurTime;
threadEngine.Start(new MailThread(nc->display, nc->email, subject, message));
return true;
}
@@ -81,7 +77,7 @@ bool Mail(NickCore *nc, const Anope::string &subject, const Anope::string &messa
if (!Config->UseMail || !nc || nc->email.empty() || subject.empty() || message.empty())
return false;
- nc->lastmail = time(NULL);
+ nc->lastmail = Anope::CurTime;
threadEngine.Start(new MailThread(nc->display, nc->email, subject, message));
return true;