<<< Date Index >>>     <<< Thread Index >>>

[PATCH] Respect $read_inc/$write_inc for POP folders



Hi,

even though my average connection speed increases, I found the POP connection speed more or less staling in the meantime.

This means that especially deleting messages is terribly slow since mutt needs to delete them one by one. While doing so it doesn't give much feedback so that I think it's better (i.e. more consistent) to use $write_inc setting for it.

And one POP uses $write_inc, it also should use $read_inc because that's what we have these options for after all...

  bye, Rocco
--
:wq!
diff --git a/pop.c b/pop.c
index 374126a..07d5296 100644
--- a/pop.c
+++ b/pop.c
@@ -235,6 +235,8 @@ static int pop_fetch_headers (CONTEXT *c
     }
   }
 
+  mutt_message _("Fetching message headers...");
+
   if (ret == 0)
   {
     for (i = 0; i < old_count; i++)
@@ -243,8 +245,9 @@ static int pop_fetch_headers (CONTEXT *c
 
     for (i = old_count; i < new_count; i++)
     {
-      mutt_message (_("Fetching message headers... [%d/%d]"),
-                   i + 1 - old_count, new_count - old_count);
+      if (!ctx->quiet && ReadInc && (((i - old_count) % ReadInc) == 0 || (i - 
old_count) == 1))
+       mutt_message (_("Fetching message headers... [%d/%d]"),
+                     i + 1 - old_count, new_count - old_count);
 
 #if USE_HCACHE
       if ((data = mutt_hcache_fetch (hc, ctx->hdrs[i]->data, strlen)))
@@ -591,7 +594,7 @@ int pop_fetch_message (MESSAGE* msg, CON
 /* update POP mailbox - delete messages from server */
 int pop_sync_mailbox (CONTEXT *ctx, int *index_hint)
 {
-  int i, ret;
+  int i, j, ret = 0;
   char buf[LONG_STRING];
   POP_DATA *pop_data = (POP_DATA *)ctx->data;
 #ifdef USE_HCACHE
@@ -605,31 +608,38 @@ int pop_sync_mailbox (CONTEXT *ctx, int
     if (pop_reconnect (ctx) < 0)
       return -1;
 
-    mutt_message (_("Marking %d messages deleted..."), ctx->deleted);
+    if (ctx->deleted > 0)
+    {
+      mutt_message (_("Marking %d messages deleted..."), ctx->deleted);
 
 #if USE_HCACHE
-    hc = mutt_hcache_open (HeaderCache, ctx->path);
+      hc = mutt_hcache_open (HeaderCache, ctx->path);
 #endif
 
-    for (i = 0, ret = 0; ret == 0 && i < ctx->msgcount; i++)
-    {
-      if (ctx->hdrs[i]->deleted)
+      for (i = 0, j = 0, ret = 0; ret == 0 && i < ctx->msgcount; i++)
       {
-       snprintf (buf, sizeof (buf), "DELE %d\r\n", ctx->hdrs[i]->refno);
-       if ((ret = pop_query (pop_data, buf, sizeof (buf))) == 0)
+       if (ctx->hdrs[i]->deleted)
        {
-         mutt_bcache_del (pop_data->bcache, ctx->hdrs[i]->data);
+         j++;
+         if (!ctx->quiet && WriteInc && ((j % WriteInc) == 0 || j == 1))
+           mutt_message (_("Deleting messages [%d/%d]..."), j, ctx->deleted);
+         snprintf (buf, sizeof (buf), "DELE %d\r\n", ctx->hdrs[i]->refno);
+         if ((ret = pop_query (pop_data, buf, sizeof (buf))) == 0)
+         {
+           mutt_bcache_del (pop_data->bcache, ctx->hdrs[i]->data);
 #if USE_HCACHE
-         mutt_hcache_delete (hc, ctx->hdrs[i]->data, strlen);
+           mutt_hcache_delete (hc, ctx->hdrs[i]->data, strlen);
 #endif
+         }
        }
       }
-    }
 
 #if USE_HCACHE
-    mutt_hcache_close (hc);
+      mutt_hcache_close (hc);
 #endif
 
+    }
+
     if (ret == 0)
     {
       strfcpy (buf, "QUIT\r\n", sizeof (buf));