Commit bbaa1839 authored by Thomas Roessler's avatar Thomas Roessler

Experimental patch to add an imap-fetch-mail function.

parent 88b3020d
......@@ -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"
......
......@@ -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;
......
......@@ -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" },
......
......@@ -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];
......
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment