diff options
author | certus certus@31f1291d-b8d6-0310-a050-a5561fc1590b <certus certus@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-04-02 15:31:27 +0000 |
---|---|---|
committer | certus certus@31f1291d-b8d6-0310-a050-a5561fc1590b <certus certus@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-04-02 15:31:27 +0000 |
commit | 3e7ce67993960a7a3b6306c26d9afc22ed4a377d (patch) | |
tree | 71ecf4a6c2c19e9d683c4af54e0ad8063ba3cc6c /mail.c | |
parent | 8c2baf706f2d7d8fe2a796bed72be650c7df1e23 (diff) |
BUILD : 1.7.0 (25) BUGS : NOTES : Added memo2mail and /msg memoserv set notify MAIL/NOMAIL
git-svn-id: svn://svn.anope.org/anope/trunk@25 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@16 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'mail.c')
-rw-r--r-- | mail.c | 48 |
1 files changed, 46 insertions, 2 deletions
@@ -107,11 +107,53 @@ MailInfo *MailBegin(User * u, NickCore * nc, char *subject, char *service) return NULL; } +/* new function to send memo mails */ + +MailInfo *MailMemoBegin(NickCore * nc) +{ + + if (!nc) + return NULL; + + if (!UseMail || !nc->email) { + return NULL; + + } else { + MailInfo *mail; + + mail = scalloc(sizeof(MailInfo), 1); + mail->sender = NULL; + mail->recipient = nc; + mail->recip = NULL; + + if (!(mail->pipe = popen(SendMailPath, "w"))) { + free(mail); + return NULL; + } + + fprintf(mail->pipe, "From: %s\n", SendFrom); + if (DontQuoteAddresses) { + fprintf(mail->pipe, "To: %s <%s>\n", nc->display, nc->email); + } else { + fprintf(mail->pipe, "To: \"%s\" <%s>\n", nc->display, + nc->email); + } + fprintf(mail->pipe, "Subject: %s\n", + getstring2(NULL, MEMO_MAIL_SUBJECT)); + return mail; + } + return NULL; +} + /* Finish to send the mail. Cleanup everything. */ +/* - param checking modified because we don't + have an user sending this mail. + Certus, 02.04.2004 */ + void MailEnd(MailInfo * mail) { - if (!mail || !mail->sender || !mail->pipe) + if (!mail || !mail->pipe) /* removed sender check */ return; if (!mail->recipient && !mail->recip) @@ -119,7 +161,9 @@ void MailEnd(MailInfo * mail) pclose(mail->pipe); - mail->sender->lastmail = time(NULL); + if (mail->sender) /* added sender check */ + mail->sender->lastmail = time(NULL); + if (mail->recipient) mail->recipient->lastmail = time(NULL); else |