My greetings to the list.
As discussed in previous postings, with Sergey, support for UTF8
strings was added to vacation sieve action. There is one other action
however (reject) that can accept a text as argument. Since there was a
problem there with the handling of Greek text, I took the liberty of
converting it to properly support UTF8 strings.
My patch, included below, is for the actions.c file (routine
build_mime). The patch is against the CVS head.
Please let me know if this will be included in mailutils.
Thanks,
Kostas
--
Kostas Zorbadelos
Systems Designer/Developer, Otenet SA
[EMAIL PROTECTED] contact: kzorba (at) otenet.gr
Out there in the darkness, out there in the night
out there in the starlight, one soul burns brighter
than a thousand suns.
Index: actions.c
===================================================================
RCS file: /cvsroot/mailutils/mailutils/libsieve/actions.c,v
retrieving revision 1.28
diff -u -r1.28 actions.c
--- actions.c 27 Aug 2005 11:37:35 -0000 1.28
+++ actions.c 19 Oct 2005 16:20:37 -0000
@@ -137,99 +137,89 @@
{
mu_mime_t mime = NULL;
char datestr[80];
-
- mu_mime_create (&mime, NULL, 0);
- {
- mu_message_t newmsg;
- mu_stream_t stream;
- time_t t;
- struct tm *tm;
- char *sender;
- size_t off = 0;
- mu_body_t body;
-
- mu_message_create (&newmsg, NULL);
- mu_message_get_body (newmsg, &body);
- mu_body_get_stream (body, &stream);
+ time_t t;
+ struct tm *tm;
+ mu_message_t newmsg;
+ mu_header_t hdr;
+ mu_body_t body;
+ mu_stream_t stream, istream, ostream;
+ char *header = "Content-Type: text/plain;charset=" MU_SIEVE_CHARSET "\n"
+ "Content-Transfer-Encoding: 8bit\n\n";
+ char *sender;
+ char *email;
+ int rc;
+ size_t off = 0;
+ size_t ioff = 0, ooff = 0, n;
+ char buffer[512];
- time (&t);
- tm = localtime (&t);
- strftime (datestr, sizeof datestr, "%a, %b %d %H:%M:%S %Y %Z", tm);
+ /* The reject reason part */
- mu_sieve_get_message_sender (msg, &sender);
+ mu_mime_create (&mime, NULL, 0);
+ mu_message_create (&newmsg, NULL);
+ mu_message_get_body (newmsg, &body);
+ mu_body_get_stream (body, &stream);
+ time (&t);
+ tm = localtime (&t);
+ strftime (datestr, sizeof datestr, "%a, %b %d %H:%M:%S %Y %Z", tm);
- mu_stream_printf (stream, &off,
- "\nThe original message was received at %s from %s.\n",
- datestr, sender);
- free (sender);
- mu_stream_printf (stream, &off,
- "Message was refused by recipient's mail filtering
program.\n");
- mu_stream_printf (stream, &off, "Reason given was as follows:\n\n");
- mu_stream_printf (stream, &off, "%s", text);
- mu_stream_close (stream);
- mu_mime_add_part (mime, newmsg);
- message_unref (newmsg);
- }
+ mu_sieve_get_message_sender (msg, &sender);
+ mu_stream_printf (stream, &off,
+ "\nThe original message was received at %s from %s.\n",
+ datestr, sender);
+ free (sender);
+ mu_stream_printf (stream, &off,
+ "Message was refused by recipient's mail filtering
program.\n");
+ mu_stream_printf (stream, &off, "Reason given was as follows:\n\n");
+ mu_stream_printf (stream, &off, "%s", text);
+ mu_stream_close (stream);
+ mu_header_create (&hdr, header, strlen (header), newmsg);
+ mu_message_set_header (newmsg, hdr, NULL);
+ mu_mime_add_part (mime, newmsg);
+ message_unref (newmsg);
/* message/delivery-status */
- {
- mu_message_t newmsg;
- mu_stream_t stream;
- mu_header_t hdr;
- size_t off = 0;
- mu_body_t body;
- char *email;
-
- mu_message_create (&newmsg, NULL);
- mu_message_get_header (newmsg, &hdr);
- mu_header_set_value (hdr, "Content-Type", "message/delivery-status", 1);
- mu_message_get_body (newmsg, &body);
- mu_body_get_stream (body, &stream);
- mu_stream_printf (stream, &off, "Reporting-UA: sieve; %s\n",
PACKAGE_STRING);
- mu_stream_printf (stream, &off, "Arrival-Date: %s\n", datestr);
- email = mu_get_user_email (NULL);
- mu_stream_printf (stream, &off, "Final-Recipient: RFC822; %s\n",
- email ? email : "unknown");
- free (email);
- mu_stream_printf (stream, &off, "Action: deleted\n");
- mu_stream_printf (stream, &off,
- "Disposition:
automatic-action/MDN-sent-automatically;deleted\n");
- mu_stream_printf (stream, &off, "Last-Attempt-Date: %s\n", datestr);
- mu_stream_close (stream);
- mu_mime_add_part(mime, newmsg);
- message_unref (newmsg);
- }
+
+ off = 0;
+ mu_message_create (&newmsg, NULL);
+ mu_message_get_header (newmsg, &hdr);
+ mu_header_set_value (hdr, "Content-Type", "message/delivery-status", 1);
+ mu_message_get_body (newmsg, &body);
+ mu_body_get_stream (body, &stream);
+ mu_stream_printf (stream, &off, "Reporting-UA: sieve; %s\n", PACKAGE_STRING);
+ mu_stream_printf (stream, &off, "Arrival-Date: %s\n", datestr);
+ email = mu_get_user_email (NULL);
+ mu_stream_printf (stream, &off, "Final-Recipient: RFC822; %s\n",
+ email ? email : "unknown");
+ free (email);
+ mu_stream_printf (stream, &off, "Action: deleted\n");
+ mu_stream_printf (stream, &off,
+ "Disposition:
automatic-action/MDN-sent-automatically;deleted\n");
+ mu_stream_printf (stream, &off, "Last-Attempt-Date: %s\n", datestr);
+ mu_stream_close (stream);
+ mu_mime_add_part(mime, newmsg);
+ message_unref (newmsg);
/* Quote original message */
- {
- mu_message_t newmsg;
- mu_stream_t istream, ostream;
- mu_header_t hdr;
- size_t ioff = 0, ooff = 0, n;
- char buffer[512];
- mu_body_t body;
-
- mu_message_create (&newmsg, NULL);
- mu_message_get_header (newmsg, &hdr);
- mu_header_set_value (hdr, "Content-Type", "message/rfc822", 1);
- mu_message_get_body (newmsg, &body);
- mu_body_get_stream (body, &ostream);
- mu_message_get_stream (msg, &istream);
-
- while (mu_stream_read (istream, buffer, sizeof buffer - 1, ioff, &n) == 0
- && n != 0)
- {
- size_t sz;
- mu_stream_write (ostream, buffer, n, ooff, &sz);
- if (sz != n)
- return EIO;
- ooff += n;
- ioff += n;
- }
- mu_stream_close (ostream);
- mu_mime_add_part (mime, newmsg);
- message_unref (newmsg);
- }
+
+ mu_message_create (&newmsg, NULL);
+ mu_message_get_header (newmsg, &hdr);
+ mu_header_set_value (hdr, "Content-Type", "message/rfc822", 1);
+ mu_message_get_body (newmsg, &body);
+ mu_body_get_stream (body, &ostream);
+ mu_message_get_stream (msg, &istream);
+ while (mu_stream_read (istream, buffer, sizeof buffer - 1, ioff, &n) == 0
+ && n != 0)
+ {
+ size_t sz;
+ mu_stream_write (ostream, buffer, n, ooff, &sz);
+ if (sz != n)
+ return EIO;
+ ooff += n;
+ ioff += n;
+ }
+ mu_stream_close (ostream);
+ mu_mime_add_part (mime, newmsg);
+ message_unref (newmsg);
*pmime = mime;
_______________________________________________
Bug-mailutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-mailutils