summaryrefslogtreecommitdiff
path: root/include/mail.h
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-11-22 00:50:33 -0500
committerAdam <Adam@anope.org>2012-11-22 00:50:33 -0500
commitd33a0f75a5c0c584fbb7cc0076da36d494f39494 (patch)
tree7b2274cc833c793c0f5595660cbd4d715de52ffd /include/mail.h
parent368d469631763e9c8bf399980d0ac7c5b5664d39 (diff)
Pretty large coding style cleanup, in source doc
cleanup, and allow protocol mods to depend on each other
Diffstat (limited to 'include/mail.h')
-rw-r--r--include/mail.h57
1 files changed, 35 insertions, 22 deletions
diff --git a/include/mail.h b/include/mail.h
index 493002637..2b513c849 100644
--- a/include/mail.h
+++ b/include/mail.h
@@ -18,28 +18,41 @@
#include "threadengine.h"
#include "serialize.h"
-extern CoreExport bool Mail(User *u, NickCore *nc, const BotInfo *service, const Anope::string &subject, const Anope::string &message);
-extern CoreExport bool Mail(NickCore *nc, const Anope::string &subject, const Anope::string &message);
-extern CoreExport bool MailValidate(const Anope::string &email);
-
-class MailThread : public Thread
+namespace Mail
{
- private:
- Anope::string SendMailPath;
- Anope::string SendFrom;
- Anope::string MailTo;
- Anope::string Addr;
- Anope::string Subject;
- Anope::string Message;
- bool DontQuoteAddresses;
-
- bool Success;
- public:
- MailThread(const Anope::string &smpath, const Anope::string &sf, const Anope::string &mailto, const Anope::string &addr, const Anope::string &subject, const Anope::string &message);
-
- ~MailThread();
-
- void Run();
-};
+ extern CoreExport bool Send(User *from, NickCore *to, const BotInfo *service, const Anope::string &subject, const Anope::string &message);
+ extern CoreExport bool Send(NickCore *to, const Anope::string &subject, const Anope::string &message);
+ extern CoreExport bool Validate(const Anope::string &email);
+
+ /* A email message being sent */
+ class Message : public Thread
+ {
+ private:
+ Anope::string sendmail_path;
+ Anope::string send_from;
+ Anope::string mail_to;
+ Anope::string addr;
+ Anope::string subject;
+ Anope::string message;
+ bool dont_quote_addresses;
+
+ bool success;
+ public:
+ /** Construct this message. Once constructed call Thread::Start to launch the mail sending.
+ * @param sf Config->SendFrom
+ * @param mailto Name of person being mailed (u->nick, nc->display, etc)
+ * @param addr Destination address to mail
+ * @param subject Message subject
+ * @param message The actual message
+ */
+ Message(const Anope::string &sf, const Anope::string &mailto, const Anope::string &addr, const Anope::string &subject, const Anope::string &message);
+
+ ~Message();
+
+ /* Called from within the thread to actually send the mail */
+ void Run() anope_override;
+ };
+
+} // namespace Mail
#endif // MAIL_H