]> granicus.if.org Git - mutt/commitdiff
Experimental patch to add an imap-fetch-mail function.
authorThomas Roessler <roessler@does-not-exist.org>
Sun, 31 Dec 2000 12:39:15 +0000 (12:39 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Sun, 31 Dec 2000 12:39:15 +0000 (12:39 +0000)
OPS
curs_main.c
functions.h
globals.h
imap/imap.c

diff --git a/OPS b/OPS
index b4d39a5b3bb69018a1a6ee8457c3c2d319c86912..9ed55ce54e64f4914d082c4e47f32490a321f4ad 100644 (file)
--- a/OPS
+++ b/OPS
@@ -97,6 +97,7 @@ OP_MAIN_CHANGE_FOLDER "open a different folder"
 OP_MAIN_CHANGE_FOLDER_READONLY "open a different folder in read only mode"
 OP_MAIN_CLEAR_FLAG "clear a status flag from a message"
 OP_MAIN_DELETE_PATTERN "delete messages matching a pattern"
+OP_MAIN_IMAP_FETCH "force retrieval of mail from IMAP server"
 OP_MAIN_FETCH_MAIL "retrieve mail from POP server"
 OP_MAIN_FIRST_MESSAGE "move to the first message"
 OP_MAIN_LAST_MESSAGE "move to the last message"
index 6e6816a5be43678aa6679d767a73a3d602cb778d..f49727837c02cd470bb2aa0a64d5777932e281c1 100644 (file)
@@ -876,6 +876,12 @@ int mutt_index_menu (void)
         * The following operations can be performed inside of the pager.
         */
 
+#ifdef USE_IMAP
+      case OP_MAIN_IMAP_FETCH:
+       ImapLastCheck = 0;
+        break;
+#endif
+      
       case OP_MAIN_SYNC_FOLDER:
 
        CHECK_MSGCOUNT;
index 3b1bd8ec0fae1cf7bc20b195d6ea04e08fde6029..0f2f1e59ac9f79d3d79e61a44190b65d2257aa80 100644 (file)
@@ -84,6 +84,9 @@ struct binding_t OpMain[] = {
   { "group-reply",             OP_GROUP_REPLY,                 "g" },
 #ifdef USE_POP
   { "fetch-mail",              OP_MAIN_FETCH_MAIL,             "G" },
+#endif
+#ifdef USE_IMAP
+  { "imap-fetch-mail",         OP_MAIN_IMAP_FETCH,             NULL },
 #endif
   { "display-toggle-weed",             OP_DISPLAY_HEADERS,             "h" },
   { "next-undeleted",          OP_MAIN_NEXT_UNDELETED,         "j" },
@@ -160,6 +163,9 @@ struct binding_t OpPager[] = {
   { "forward-message", OP_FORWARD_MESSAGE,             "f" },
   { "flag-message",    OP_FLAG_MESSAGE,                "F" },
   { "group-reply",     OP_GROUP_REPLY,                 "g" },
+#ifdef USE_IMAP
+  { "imap-fetch-mail",  OP_MAIN_IMAP_FETCH,            NULL },
+#endif
   { "display-toggle-weed",     OP_DISPLAY_HEADERS,             "h" },
   { "next-undeleted",  OP_MAIN_NEXT_UNDELETED,         "j" },
   { "next-entry",      OP_NEXT_ENTRY,                  "J" },
index 936b8b9e2e0bbb1cf405165bb392a490c0ba638b..45691a1e0713990e3cf7ff387f4d5e6998d4de2f 100644 (file)
--- a/globals.h
+++ b/globals.h
@@ -111,6 +111,10 @@ WHERE LIST *UnIgnore INITVAL(0);
 WHERE LIST *MailLists INITVAL(0);
 WHERE LIST *SubscribedLists INITVAL(0);
 
+#ifdef USE_IMAP
+WHERE time_t ImapLastCheck INITVAL(0);
+#endif
+
 /* bit vector for boolean variables */
 #ifdef MAIN_C
 unsigned char Options[(OPTMAX + 7)/8];
index 4f7913ebb632cb733a1bf40df884530b04e1e01b..3302e91bcf9d0334874ed032405af3891c164af9 100644 (file)
@@ -1008,7 +1008,6 @@ int imap_check_mailbox (CONTEXT *ctx, int *index_hint)
 {
   /* overload keyboard timeout to avoid many mailbox checks in a row.
    * Most users don't like having to wait exactly when they press a key. */
-  static time_t LastCheck = 0;
 
   IMAP_DATA* idata;
   time_t now;
@@ -1016,8 +1015,8 @@ int imap_check_mailbox (CONTEXT *ctx, int *index_hint)
   idata = (IMAP_DATA*) ctx->data;
 
   now = time(NULL);
-  if (now > LastCheck + Timeout) {
-    LastCheck = now;
+  if (now > ImapLastCheck + Timeout) {
+    ImapLastCheck = now;
 
     if (imap_exec (idata, "NOOP", 0) != 0)
     {