[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-mailutils] cannot move mail to imap mailbox
From: |
Sergey Poznyakoff |
Subject: |
Re: [bug-mailutils] cannot move mail to imap mailbox |
Date: |
Sat, 30 Nov 2013 17:51:40 +0200 |
Kamil JoÅca <address@hidden> ha escrit:
>
> I have two troubles with new mailutils (2.99.98)
> 1. How can I specify logging?
Please see http://mailutils.org/wiki/Debug_level
> debug { level ("mailbox=proto" ); }
The parentheses are superfluous, don't use them. Equals sign is
used in the wrong context. Please refer to the URL above. The correct
way is:
debug {
level "mailbox.prot";
}
> but
> debug { level ("mailbox" ); }
> works
Yes, because
1) list of one element is equivalent to that element alone, and
2) category name alone enables all levels for the specified category
(both described in the wiki).
> 2. (grave) It seems, that movig message to imap mailbox moves them into
> blackhole ...
> Assume that we have mbox "sent" with one message in it:
> command:
> movemail --debug-level "config" -v --rcfile =(echo $'debug { level
> ("mailbox=proto" ); }' ) ./sent imap://address@hidden/spamcop.net/reports
FWIW, the --rcfile argument doesn't make any sense to me. Any decent
shell should report "syntax error near (" given this stuff.
> movemail: C: 02 LOGIN kjonca 22Fmtj73YwUdQw8oD0maaLObKPefAe
Ouch! Kamil, please pay attention to what you are posting here! This is
a PUBLIC mailing list, which gets archived into several places, so this
password of yours is hopelessly compromised now.
> movemail: S: 03 OK [READ-WRITE] Select completed (0.000 secs).
> movemail: number of messages in source mailbox: 1
> movemail: mbox_get_message (/home/kjonca/Mail/.tool/tmp/scr.6Tqc8G/./sent, 1)
> movemail: number of processed messages: 1
> movemail: number of errors: 0 / 0
There was no write to the remote at all. Thanks for reporting this.
Please try the attached patch.
Regards,
Sergey
diff --git a/libproto/imap/appmsg.c b/libproto/imap/appmsg.c
index 6fa280e..1c8676e 100644
--- a/libproto/imap/appmsg.c
+++ b/libproto/imap/appmsg.c
@@ -36,7 +36,7 @@ mu_imap_append_message (mu_imap_t imap, const char *mailbox,
int flags,
int rc;
rc = mu_message_get_streamref (msg, &str);
- if (rc)
+ if (rc == 0)
{
rc = mu_imap_append_stream (imap, mailbox, flags, tm, tz, str);
mu_stream_unref (str);
diff --git a/libproto/imap/mbox.c b/libproto/imap/mbox.c
index d181cbc..fcf78e8 100644
--- a/libproto/imap/mbox.c
+++ b/libproto/imap/mbox.c
@@ -1106,6 +1106,8 @@ _imap_mbx_append_message (mu_mailbox_t mbox, mu_message_t
msg)
if (rc)
return rc;
rc = mu_url_sget_path (url, &mbox_name);
+ if (rc)
+ return rc;
return mu_imap_append_message (imap, mbox_name, 0, NULL, NULL, msg);
}
diff --git a/libproto/imap/url.c b/libproto/imap/url.c
index da87aea..dc1e5c4 100644
--- a/libproto/imap/url.c
+++ b/libproto/imap/url.c
@@ -29,6 +29,7 @@
#include <mailutils/sys/registrar.h>
#include <mailutils/sys/url.h>
#include <mailutils/sys/imap.h>
+#include <mailutils/util.h>
static void url_imap_destroy (mu_url_t url);
@@ -37,6 +38,16 @@ url_imap_destroy (mu_url_t url MU_ARG_UNUSED)
{
}
+static int
+url_imap_get_path (const mu_url_t url, char *bufptr, size_t bufsize,
+ size_t *rsize)
+{
+ bufsize = mu_cpystr (bufptr, "INBOX", bufsize);
+ if (rsize)
+ *rsize = bufsize;
+ return 0;
+}
+
/*
IMAP URLs:
imap://[<user>[;AUTH=<auth>address@hidden<host>[/<mailbox>]
@@ -50,7 +61,8 @@ _mu_imap_url_init (mu_url_t url)
url->port = MU_IMAP_PORT;
url->_destroy = url_imap_destroy;
-
+ url->_get_path = url_imap_get_path;
+
if (!url->host || url->qargc)
return EINVAL;
@@ -81,6 +93,7 @@ _mu_imaps_url_init (mu_url_t url)
url->port = MU_IMAPS_PORT;
url->_destroy = url_imap_destroy;
+ url->_get_path = url_imap_get_path;
if (!url->host || url->qargc)
return EINVAL;