Ticket #2226 (new enhancement)

Opened 3 years ago

Last modified 3 years ago

wish: Let me know if POP messages has been lost

Reported by: tamo@… Owned by: mutt-dev
Priority: major Milestone:
Component: mutt Version: 1.5.11 and CVS
Keywords: patch Cc:

Description

If POP server automatically removes a message while mutt is in the box,
(1) ctx->hdrs[i]->refno will be changed to -1,
(2) ctx->hdrs[i]->deleted will be set to 1, and
(3) ctx->deleted will NOT be set.

All the above are done with no message at all.
I want some warning message.

>How-To-Repeat:
0. Press 'c'.
1. Input a POP box name.
2. (Server accidentally loses a message)
3. (Timeout occurs)
4. You find the message was silently marked as deleted!

>Fix:
diff -p -u -r3.9 pop.c
--- pop.c	21 Oct 2005 04:35:37 -0000	3.9
+++ pop.c	14 May 2006 06:13:24 -0000
@@ -167,7 +167,7 @@ static int fetch_uidl (char *line, void 
  */
 static int pop_fetch_headers (CONTEXT *ctx)
 {
-  int i, ret, old_count, new_count;
+  int i, ret, old_count, new_count, deleted;
   POP_DATA *pop_data = (POP_DATA *)ctx->data;
 
   time (&pop_data->check_time);
@@ -202,9 +202,20 @@ static int pop_fetch_headers (CONTEXT *c
 
   if (ret == 0)
   {
-    for (i = 0; i < old_count; i++)
+    for (i = 0, deleted = 0; i < old_count; i++)
+    {
       if (ctx->hdrs[i]->refno == -1)
+      {
 	ctx->hdrs[i]->deleted = 1;
+	deleted++;
+      }
+    }
+    if (deleted > 0)
+    {
+      mutt_error (_("%d messages have been lost. "
+            "You'd better re-open this box."), deleted);
+      mutt_sleep (2);
+    }
 
     for (i = old_count; i < new_count; i++)
     {

Attachments

patch-1.5.11cvs.tamo.popdelete.3 (1.0 kB) - added by anonymous 20 months ago.
patch-1.5.11cvs.tamo.popdelete.3

Change History

Changed 3 years ago by Rocco Rutte <pdmef@…>

Hi,

* tamo@momonga-linux.org [06-05-10 11:19:11 +0200] wrote:

>Sometimes mutt mistakingly deletes POP messages
>even though I haven't used "d" (delete) or "s" (save).
>Sometimes it even tries to delete number "-1".
>This bug appears when the POP box has around 1000 messages or more.

I sometimes saw this, too, but with far less messages.

>>Fix:
>Unknown - I'm trying to find, though.

I wasn't successful on this either.

>At least, I suggest you use unsigned type for (*HEADER)->refno.

That would require to refactor the POP code. As I read it, refno==-1 is 
used to keep track of deleted messages in pop_fetch_headers().

Before sending UIDL, all present messages get refno=-1. The fetch_uidl() 
function then updates all of these with server's numbers so that 
afterwards all messages should be properly renumbered. I.e. those which 
still have -1 aren't present on the server any longer and get deleted 
(as POP doesn't have message upload) in the current session.

Now the real problem is that they don't seem to get removed from the 
current session, i.e. the tables are not updated properly.

I may be wrong, of course. But refno is required to be negative as well.

   bye, Rocco
-- 
:wq!

Changed 3 years ago by TAKAHASHI Tamotsu <ttakah@…>

* Wed May 10 2006 Rocco Rutte <pdmef@gmx.net>
>  I may be wrong, of course. But refno is required to be negative as well.

I see. So we have to fix the real problem. ;)
Thank you.

-- 
tamo

Changed 3 years ago by tamo

Hi,
 * Wed May 10 2006 Rocco Rutte <pdmef@gmx.net>
 I was a little confused.
My lost messages must have beed deleted by the POP server.
Rocco clarified the problem.

Summary:
Mutt keeps unexpectedly-deleted messages in ctx->hdrs.
This is feature. You have to re-open the POP box.
I just want to know that some messages were lost.

Changed 20 months ago by anonymous

patch-1.5.11cvs.tamo.popdelete.3

Note: See TracTickets for help on using tickets.