From 69c1a1e2f5f3fb02036e2196e680a63760a784ea Mon Sep 17 00:00:00 2001 From: "psyc://psyced.org/~lynX" <@> Date: Sun, 31 Jan 2010 06:35:49 +0100 Subject: [PATCH] smtp_sendmsg() --- world/net/library.i | 15 +++++++++++++++ world/net/smtp/outgoing.c | 9 +++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/world/net/library.i b/world/net/library.i index a82aab0..89bfe40 100644 --- a/world/net/library.i +++ b/world/net/library.i @@ -621,6 +621,21 @@ int greater_user(object a, object b) { return file_name(a) > file_name(b); } object* sorted_users() { return sort_array(users(), #'greater_user; } #endif +volatile mixed mailer; + +// simple SMTP interface.. used from person:logAppend - why target? +// assumes that mailto: rcpt has already been checked with legal_mailto() ! +int smtp_sendmsg(string target, string method, string data, + mapping vars, string source, string rcpt, string loginurl) { +#ifdef SMTP_PATH + unless (mailer) mailer = SMTP_PATH "outgoing" -> load(); + return mailer -> enqueue(target, method, data, vars, source, rcpt, + loginurl); +#else + return 0; +#endif +} + int xmpp_sendmsg(mixed target, string mc, mixed data, mapping vars, mixed source, array(mixed) u, int showingLog, string otarget) { string tmp; diff --git a/world/net/smtp/outgoing.c b/world/net/smtp/outgoing.c index c297775..e2c08c3 100644 --- a/world/net/smtp/outgoing.c +++ b/world/net/smtp/outgoing.c @@ -86,8 +86,11 @@ reset(a) { } create() { +#ifdef DEFAULT_LAYOUT sTextPath (DEFAULT_LAYOUT, DEFLANG, "smtp"); - +#else + sTextPath (0, 0, "smtp"); +#endif unless (spool) { restore_object(SPOOL_FILE); if (file_format != FILE_FORMAT) spool = 0; @@ -337,9 +340,11 @@ rendermsg(rcpt) { if (o) m += w("_warning_omitted_messages", "[_amount_messages_omitted] messages omitted.", ([ "_amount_messages_omitted" : o ]) ); -#ifndef _flag_disable_mail_signature +#ifdef DEFAULT_URL_LOGIN +# ifndef _flag_disable_mail_signature m += "\n--\n"+ w( "_info_mail_signature", "Reply by E-Mail is not possible. Please log in:\n[_URL_login]", ([ "_URL_login": (t2 || DEFAULT_URL_LOGIN) ]) ) + "\n"; +# endif #endif t2 = "Content-Type: text/plain; charset=" SYSTEM_CHARSET "\n" #ifndef SEND_FIRST_MSG_AS_SUBJECT