[PATCH] IMAP logout command
- To: mutt-dev@xxxxxxxx
- Subject: [PATCH] IMAP logout command
- From: Gregory Shapiro <mutt-dev@xxxxxxxxxxxxxx>
- Date: Sat, 21 Apr 2007 22:06:04 -0700
- Dkim-signature: v=0.5; a=rsa-sha256; c=relaxed/simple; d=gshapiro.net; s=gatsby.dkim; t=1177218488; bh=zkt72grdfAPCHowaDDL4FMjSq/l8vTCc8Gp 5kUBrHk0=; h=X-DomainKeys:DomainKey-Signature:Date:From:To:Subject: Message-ID:MIME-Version:Content-Type:Content-Disposition: User-Agent; b=FzAkz+mfxKrUSpj/4NL3UqMJ/bzC0C4dBqxZJKyBwDPNC3uDd/Tc LrNb5KmlQvk3j9QZH/TLrjCqt1jIxO60ckgorrpXF3fZFbpWlY03Sx5EYmChmEyoUpM EfoueaohT1+vweKdcvSmwXsDY5yOEduDH9YadNlZ4AnpZsX3kvIQ=
- Domainkey-signature: a=rsa-sha1; s=gatsby; d=gshapiro.net; c=nofws; q=dns; h=date:from:to:subject:message-id:mime-version:content-type: content-disposition:user-agent; b=FluaGUHfF0jwrCmn8nsZ82HMOheV4U5QFpH0fjhSetXvITVhLtNuApId9rOGvFyJ4 9bg/Ua2ZyvBxUiY0GynYMiTy8ahiuAvnZCov9P4BgIJfhK2l0unM6GCZwhShjZVM01t KCUwy/1hnEvhmmbRpyy/oMjn+JRcvr0Ku0o+HyA=
- List-unsubscribe: <mailto:mutt-dev-request@mutt.org?Subject="Unsubscribe Mutt Dev"?body=unsubscribe>
- Sender: owner-mutt-dev@xxxxxxxx
- User-agent: Mutt/1.5.15 (2007-04-06)
The attached patch for mutt 1.5.15 adds the ability to log out of all
IMAP servers. Currently the only way to close IMAP connections is to
quit mutt.
This patch is useful for mobile users who leave mutt running on their
laptop and change locations (and therefore networks). By binding this
to a keyboard shortcut, you can logout of all IMAP connections before
putting your laptop to sleep. IMAP connections can then be reopened
later.
--- mutt-1.5.15.old/PATCHES 2007-03-15 08:49:37.000000000 -0700
+++ mutt-1.5.15/PATCHES 2007-04-21 21:34:31.000000000 -0700
@@ -0,0 +1 @@
+patch-1.5.15.gs.imap_logout.1
--- mutt-1.5.15.old/OPS 2007-04-01 14:58:55.000000000 -0700
+++ mutt-1.5.15/OPS 2007-04-21 20:57:05.000000000 -0700
@@ -102,6 +102,7 @@
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_IMAP_LOGOUT_ALL "logout from all IMAP servers"
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"
--- mutt-1.5.15.old/curs_main.c 2007-04-03 10:41:14.000000000 -0700
+++ mutt-1.5.15/curs_main.c 2007-04-21 21:42:43.000000000 -0700
@@ -995,6 +995,19 @@
if (Context && Context->magic == M_IMAP)
imap_check_mailbox (Context, &index_hint, 1);
break;
+
+ case OP_MAIN_IMAP_LOGOUT_ALL:
+ if (Context)
+ {
+ if (mx_close_mailbox (Context, &index_hint) == 0)
+ {
+ FREE (&Context);
+ imap_logout_all();
+ }
+ }
+ set_option (OPTSEARCHINVALID);
+ menu->redraw = REDRAW_FULL;
+ break;
#endif
case OP_MAIN_SYNC_FOLDER:
--- mutt-1.5.15.old/functions.h 2007-04-01 14:58:55.000000000 -0700
+++ mutt-1.5.15/functions.h 2007-04-21 20:56:39.000000000 -0700
@@ -107,6 +107,7 @@
#endif
#ifdef USE_IMAP
{ "imap-fetch-mail", OP_MAIN_IMAP_FETCH, NULL },
+ { "imap-logout-all", OP_MAIN_IMAP_LOGOUT_ALL, NULL },
#endif
{ "display-toggle-weed", OP_DISPLAY_HEADERS, "h" },
{ "next-undeleted", OP_MAIN_NEXT_UNDELETED, "j" },
@@ -188,6 +189,7 @@
{ "group-reply", OP_GROUP_REPLY, "g" },
#ifdef USE_IMAP
{ "imap-fetch-mail", OP_MAIN_IMAP_FETCH, NULL },
+ { "imap-logout-all", OP_MAIN_IMAP_LOGOUT_ALL, NULL },
#endif
{ "display-toggle-weed", OP_DISPLAY_HEADERS, "h" },
{ "next-undeleted", OP_MAIN_NEXT_UNDELETED, "j" },