summaryrefslogtreecommitdiff
path: root/src/memoserv.c
diff options
context:
space:
mode:
authorAdam <Adam@drink-coca-cola.info>2010-05-09 19:02:50 -0400
committerAdam <Adam@anope.org>2010-06-18 21:01:09 -0400
commit4e1286ca109d079f32d32f07c344a1ab93899032 (patch)
treeef55488a4cc068f8954a8862ab2e67f2d1872281 /src/memoserv.c
parent4149afd45d2c0b9f464d1b4434f7bdaa61873d44 (diff)
Rewrote the mail system to use threading
Diffstat (limited to 'src/memoserv.c')
-rw-r--r--src/memoserv.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/src/memoserv.c b/src/memoserv.c
index 5236345f9..4ab9c76ff 100644
--- a/src/memoserv.c
+++ b/src/memoserv.c
@@ -18,7 +18,7 @@
/* *INDENT-OFF* */
E void moduleAddMemoServCmds();
-static void new_memo_mail(NickCore *nc, Memo *m);
+static bool SendMemoMail(NickCore *nc, Memo *m);
E void rsend_notify(User *u, Memo *m, const char *chan);
/*************************************************************************/
@@ -300,7 +300,7 @@ void memo_send(User * u, const char *name, const char *text, int z)
/* if (MSNotifyAll) */
/* let's get out the mail if set in the nickcore - certus */
if (nc->HasFlag(NI_MEMO_MAIL))
- new_memo_mail(nc, m);
+ SendMemoMail(nc, m);
} else {
Channel *c;
@@ -356,32 +356,17 @@ int delmemo(MemoInfo * mi, int num)
/*************************************************************************/
-static void new_memo_mail(NickCore * nc, Memo * m)
+static bool SendMemoMail(NickCore *nc, Memo *m)
{
- MailInfo *mail = NULL;
+ char message[BUFSIZE];
- if (!nc || !m)
- return;
+ snprintf(message, sizeof(message), getstring(NICK_MAIL_TEXT), nc->display, m->sender.c_str(), m->number, m->text);
- mail = MailMemoBegin(nc);
- if (!mail) {
- return;
- }
- fprintf(mail->pipe, getstring(MEMO_MAIL_TEXT1), nc->display);
- fprintf(mail->pipe, "\n");
- fprintf(mail->pipe, getstring(MEMO_MAIL_TEXT2), m->sender.c_str(),
- m->number);
- fprintf(mail->pipe, "\n\n");
- fprintf(mail->pipe, "%s", getstring(MEMO_MAIL_TEXT3));
- fprintf(mail->pipe, "\n\n");
- fprintf(mail->pipe, "%s", m->text);
- fprintf(mail->pipe, "\n");
- MailEnd(mail);
- return;
+ return Mail(nc, getstring(MEMO_MAIL_SUBJECT), message);
}
-
/*************************************************************************/
+
/* Send receipt notification to sender. */
void rsend_notify(User * u, Memo * m, const char *chan)