summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes1
-rw-r--r--extern.h1
-rw-r--r--lang/de.l18
-rw-r--r--lang/en_us.l16
-rw-r--r--lang/index7
-rw-r--r--mail.c48
-rw-r--r--memoserv.c69
-rw-r--r--services.h9
-rw-r--r--version.log6
9 files changed, 153 insertions, 22 deletions
diff --git a/Changes b/Changes
index d73b9a614..7adadd21e 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
Anope Version 1.7.0
--------------------
Provided by Anope Dev. <dev@anope.org>
+2004/04/01 Added memo2mail and /msg memoserv set notify MAIL/NOMAIL
2004/03/31 Fixed MySQL double encryption if using MD5.
2004/03/31 Implemented MySQL Phase2 (see docs/MYSQL file)
2004/03/31 Modules can now add Commands/Messages from outside of AnopeInit.
diff --git a/extern.h b/extern.h
index 88999e855..6f0a0280e 100644
--- a/extern.h
+++ b/extern.h
@@ -519,6 +519,7 @@ E void fatal_perror(const char *fmt, ...) FORMAT(printf,1,2);
E MailInfo *MailBegin(User *u, NickCore *nc, char *subject, char *service);
E MailInfo *MailRegBegin(User *u, NickRequest *nr, char *subject, char *service);
+E MailInfo *MailMemoBegin(NickCore * nc);
E void MailEnd(MailInfo *mail);
E void MailReset(User *u, NickCore *nc);
E int MailValidate(const char *email);
diff --git a/lang/de.l b/lang/de.l
index 21928224a..edce6c5cc 100644
--- a/lang/de.l
+++ b/lang/de.l
@@ -1616,6 +1616,12 @@ MEMO_SET_NOTIFY_NEW
%s wird dich benachrichtigen, sobald neue Memos für dich eintreffen.
MEMO_SET_NOTIFY_OFF
%s wird dich nicht länger beim Eintreffen neuer Memos benachrichtigen.
+MEMO_SET_NOTIFY_MAIL
+ Du wirst nun per Email über neue Memos informiert.
+MEMO_SET_NOTIFY_NOMAIL
+ Du wirst nicht länger per Email über neue Memos benachrichtigt.
+MEMO_SET_NOTIFY_INVALIDMAIL
+ Du hast keine zulässige Email Adresse gesetzt.
# SET LIMIT responses
MEMO_SET_LIMIT_SYNTAX
@@ -1710,7 +1716,17 @@ MEMO_INFO_X_NOTIFY_RECEIVE
%s wird bei Ankunft neuer Memos benachrichtigt.
MEMO_INFO_X_NOTIFY_SIGNON
%s wird beim Logon über neuer Memos benachrichtigt.
-
+
+# Memo2Mail
+MEMO_MAIL_SUBJECT
+ Neue Memo
+MEMO_MAIL_TEXT1
+ Hi %s
+MEMO_MAIL_TEXT2
+ Du hast gerade eine neue Memo von %s erhalten. Dies ist Memo Nummer %d.
+MEMO_MAIL_TEXT3
+ Memo Text:
+
###########################################################################
#
# BotServ messages
diff --git a/lang/en_us.l b/lang/en_us.l
index 7260ad383..932f7bfc5 100644
--- a/lang/en_us.l
+++ b/lang/en_us.l
@@ -1592,6 +1592,12 @@ MEMO_SET_NOTIFY_NEW
%s will now notify you of memos when they are sent to you.
MEMO_SET_NOTIFY_OFF
%s will not send you any notification of memos.
+MEMO_SET_NOTIFY_MAIL
+ You will now be informed about new memos via email.
+MEMO_SET_NOTIFY_NOMAIL
+ You will no longer be informed via email.
+MEMO_SET_NOTIFY_INVALIDMAIL
+ There's no email address set for your nick.
# SET LIMIT responses
MEMO_SET_LIMIT_SYNTAX
@@ -1687,6 +1693,16 @@ MEMO_INFO_X_NOTIFY_RECEIVE
MEMO_INFO_X_NOTIFY_SIGNON
%s is notified of news memos at logon.
+# Memo2Mail responses
+MEMO_MAIL_SUBJECT
+ New memo
+MEMO_MAIL_TEXT1
+ Hi %s
+MEMO_MAIL_TEXT2
+ You've just received a new memo from %s. This is memo number %d.
+MEMO_MAIL_TEXT3
+ Memo Text:
+
###########################################################################
#
# BotServ messages
diff --git a/lang/index b/lang/index
index 652888670..d89f7cba8 100644
--- a/lang/index
+++ b/lang/index
@@ -609,6 +609,9 @@ MEMO_SET_NOTIFY_ON
MEMO_SET_NOTIFY_LOGON
MEMO_SET_NOTIFY_NEW
MEMO_SET_NOTIFY_OFF
+MEMO_SET_NOTIFY_MAIL
+MEMO_SET_NOTIFY_NOMAIL
+MEMO_SET_NOTIFY_INVALIDMAIL
MEMO_SET_LIMIT_SYNTAX
MEMO_SET_LIMIT_SERVADMIN_SYNTAX
MEMO_SET_YOUR_LIMIT_FORBIDDEN
@@ -654,6 +657,10 @@ MEMO_INFO_X_NOTIFY_OFF
MEMO_INFO_X_NOTIFY_ON
MEMO_INFO_X_NOTIFY_RECEIVE
MEMO_INFO_X_NOTIFY_SIGNON
+MEMO_MAIL_SUBJECT
+MEMO_MAIL_TEXT1
+MEMO_MAIL_TEXT2
+MEMO_MAIL_TEXT3
BOT_DOES_NOT_EXIST
BOT_NOT_ASSIGNED
BOT_NOT_ON_CHANNEL
diff --git a/mail.c b/mail.c
index 8ed48169b..b74d30028 100644
--- a/mail.c
+++ b/mail.c
@@ -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
diff --git a/memoserv.c b/memoserv.c
index e85700092..6619baf1a 100644
--- a/memoserv.c
+++ b/memoserv.c
@@ -1,16 +1,16 @@
-/* MemoServ functions.
- *
- * (C) 2003 Anope Team
- * Contact us at info@anope.org
- *
- * Please read COPYING and README for furhter details.
- *
- * Based on the original code of Epona by Lara.
- * Based on the original code of Services by Andy Church.
- *
- * $Id$
- *
- */
+# /* MemoServ functions.
+ *
+ * (C) 2003 Anope Team
+ * Contact us at info@anope.org
+ *
+ * Please read COPYING and README for furhter details.
+ *
+ * Based on the original code of Epona by Lara.
+ * Based on the original code of Services by Andy Church.
+ *
+ * $Id$
+ *
+ */
#include "services.h"
#include "pseudo.h"
@@ -34,6 +34,7 @@ static int do_info(User *u);
static int do_staff(User *u);
static int do_sendall(User *u);
void moduleAddMemoServCmds(void);
+static void new_memo_mail(NickCore *nc, Memo *m);
/*************************************************************************/
void moduleAddMemoServCmds(void) {
@@ -335,7 +336,11 @@ void memo_send(User * u, char *name, char *text, int z)
notice_lang(s_MemoServ, u, MEMO_NEW_MEMO_ARRIVED,
source, s_MemoServ, m->number);
} /* if (flags & MEMO_RECEIVE) */
- } /* if (MSNotifyAll) */
+ }
+ /* if (MSNotifyAll) */
+ /* let's get out the mail if set in the nickcore - certus */
+ if (nc->flags & NI_MEMO_MAIL)
+ new_memo_mail(nc, m);
} else {
struct c_userlist *cu, *next;
Channel *c;
@@ -812,6 +817,16 @@ static int do_set_notify(User * u, MemoInfo * mi, char *param)
u->na->nc->flags &= ~NI_MEMO_SIGNON;
u->na->nc->flags |= NI_MEMO_RECEIVE;
notice_lang(s_MemoServ, u, MEMO_SET_NOTIFY_NEW, s_MemoServ);
+ } else if (stricmp(param, "MAIL") == 0) {
+ if (u->na->nc->email) {
+ u->na->nc->flags |= NI_MEMO_MAIL;
+ notice_lang(s_MemoServ, u, MEMO_SET_NOTIFY_MAIL);
+ } else {
+ notice_lang(s_MemoServ, u, MEMO_SET_NOTIFY_INVALIDMAIL);
+ }
+ } else if (stricmp(param, "NOMAIL") == 0) {
+ u->na->nc->flags &= ~NI_MEMO_MAIL;
+ notice_lang(s_MemoServ, u, MEMO_SET_NOTIFY_NOMAIL);
} else if (stricmp(param, "OFF") == 0) {
u->na->nc->flags &= ~(NI_MEMO_SIGNON | NI_MEMO_RECEIVE);
notice_lang(s_MemoServ, u, MEMO_SET_NOTIFY_OFF, s_MemoServ);
@@ -1173,3 +1188,29 @@ static int do_sendall(User * u)
}
/*************************************************************************/
+
+static void new_memo_mail(NickCore * nc, Memo * m)
+{
+ MailInfo *mail = NULL;
+
+ if (!nc || !m)
+ return;
+
+ mail = MailMemoBegin(nc);
+ if (!mail) {
+ return;
+ }
+ fprintf(mail->pipe, getstring2(NULL, MEMO_MAIL_TEXT1), nc->display);
+ fprintf(mail->pipe, "\n");
+ fprintf(mail->pipe, getstring2(NULL, MEMO_MAIL_TEXT2), m->sender,
+ m->number);
+ fprintf(mail->pipe, "\n\n");
+ fprintf(mail->pipe, getstring2(NULL, MEMO_MAIL_TEXT3));
+ fprintf(mail->pipe, "\n\n");
+ fprintf(mail->pipe, "%s", m->text);
+ fprintf(mail->pipe, "\n");
+ MailEnd(mail);
+ return;
+}
+
+/*************************************************************************/
diff --git a/services.h b/services.h
index adc51a651..046fdbfd1 100644
--- a/services.h
+++ b/services.h
@@ -293,12 +293,12 @@ struct nickcore_ {
/* Nickname setting flags: */
#define NI_KILLPROTECT 0x00000001 /* Kill others who take this nick */
-#define NI_SECURE 0x00000002 /* Don't recognize unless IDENTIFY'd */
-#define NI_MSG 0x00000004 /* Use PRIVMSGs instead of NOTICEs */
+#define NI_SECURE 0x00000002 /* Don't recognize unless IDENTIFY'd */
+#define NI_MSG 0x00000004 /* Use PRIVMSGs instead of NOTICEs */
#define NI_MEMO_HARDMAX 0x00000008 /* Don't allow user to change memo limit */
#define NI_MEMO_SIGNON 0x00000010 /* Notify of memos at signon and un-away */
#define NI_MEMO_RECEIVE 0x00000020 /* Notify of new memos when sent */
-#define NI_PRIVATE 0x00000040 /* Don't show in LIST to non-servadmins */
+#define NI_PRIVATE 0x00000040 /* Don't show in LIST to non-servadmins */
#define NI_HIDE_EMAIL 0x00000080 /* Don't show E-mail in INFO */
#define NI_HIDE_MASK 0x00000100 /* Don't show last seen address in INFO */
#define NI_HIDE_QUIT 0x00000200 /* Don't show last quit message in INFO */
@@ -307,7 +307,8 @@ struct nickcore_ {
#define NI_SERVICES_OPER 0x00001000 /* User is a Services operator */
#define NI_SERVICES_ADMIN 0x00002000 /* User is a Services admin */
#define NI_ENCRYPTEDPW 0x00004000 /* Nickname password is encrypted */
-#define NI_SERVICES_ROOT 0x00008000 /* User is a Services root */
+#define NI_SERVICES_ROOT 0x00008000 /* User is a Services root */
+#define NI_MEMO_MAIL 0x00010000 /* User gets email on memo */
/* Languages. Never insert anything in the middle of this list, or
* everybody will start getting the wrong language! If you want to change
diff --git a/version.log b/version.log
index 724005046..92a163fc3 100644
--- a/version.log
+++ b/version.log
@@ -8,11 +8,15 @@
VERSION_MAJOR="1"
VERSION_MINOR="7"
VERSION_PATCH="0"
-VERSION_BUILD="23"
+VERSION_BUILD="25"
VERSION_EXTRA=""
# $Log$
#
+# BUILD : 1.7.0 (25)
+# BUGS :
+# NOTES : Added memo2mail and /msg memoserv set notify MAIL/NOMAIL
+#
# BUILD : 1.7.0 (23)
# BUGS : none.
# NOTES : Spelling error