Make sidebar compilation conditional on a configure option.
Add --enable-sidebar option to configure
Alter Makefile to honour configure
Move our OPS into OPS.sidebar
Surround all our code with #ifdef USE_SIDEBAR
By using the unifdef program, all the sidebar code can be removed.
The result is code that differs only slightly from the original mutt
code. Run this on each source file:
unifdef -Bm -UUSE_SIDEBAR -UHAVE_FMEMOPEN <FILE>
Then run sed using this script:
s/ *- *SidebarWidth//g
s/ *+ *SidebarWidth//g
s/SidebarWidth *+ *//g
s/SidebarWidth/0/g
Compared to the original mutt code, there are some minor changes,
such as whitespace, and minor refactoring of variables.
Note: One sidebar global variable is left-behind: SidebarWidth.
This is deeply embedded in the mutt code. This is because mutt
hard-codes a lot of values: 0's for the left-hand side of the
screen and COLS representing the width of the screen.
rfc822.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \
score.c send.c sendlib.c signal.c sort.c \
status.c system.c thread.c charset.c history.c lib.c \
- sidebar.c \
muttlib.c editmsg.c mbyte.c \
url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
EXTRA_SCRIPTS = smime_keys
+if BUILD_SIDEBAR
+mutt_SOURCES += sidebar.c sidebar.h
+endif
+
+EXTRA_DIST += OPS.SIDEBAR
+
mutt_dotlock_SOURCES = mutt_dotlock.c
mutt_dotlock_LDADD = $(LIBOBJS)
mutt_dotlock_DEPENDENCIES = $(LIBOBJS)
keymap_defs.h: $(OPS) $(srcdir)/gen_defs
$(srcdir)/gen_defs $(OPS) > keymap_defs.h
-keymap_alldefs.h: $(srcdir)/OPS $(srcdir)/OPS.PGP $(srcdir)/OPS.MIX $(srcdir)/OPS.CRYPT $(srcdir)/OPS.SMIME $(srcdir)/gen_defs
+keymap_alldefs.h: $(srcdir)/OPS $(srcdir)/OPS.SIDEBAR $(srcdir)/OPS.PGP $(srcdir)/OPS.MIX $(srcdir)/OPS.CRYPT $(srcdir)/OPS.SMIME $(srcdir)/gen_defs
rm -f $@
$(srcdir)/gen_defs $(srcdir)/OPS $(srcdir)/OPS.PGP \
- $(srcdir)/OPS.MIX $(srcdir)/OPS.CRYPT $(srcdir)/OPS.SMIME \
+ $(srcdir)/OPS.SIDEBAR $(srcdir)/OPS.MIX $(srcdir)/OPS.CRYPT $(srcdir)/OPS.SMIME \
> keymap_alldefs.h
reldate.h: $(srcdir)/ChangeLog
OP_MAIN_SHOW_LIMIT "show currently active limit pattern"
OP_MAIN_COLLAPSE_THREAD "collapse/uncollapse current thread"
OP_MAIN_COLLAPSE_ALL "collapse/uncollapse all threads"
-OP_SIDEBAR_SCROLL_UP "scroll the mailbox pane up 1 page"
-OP_SIDEBAR_SCROLL_DOWN "scroll the mailbox pane down 1 page"
-OP_SIDEBAR_NEXT "go down to next mailbox"
-OP_SIDEBAR_PREV "go to previous mailbox"
-OP_SIDEBAR_OPEN "open hilighted mailbox"
-OP_SIDEBAR_NEXT_NEW "go down to next mailbox with new mail"
-OP_SIDEBAR_PREV_NEW "go to previous mailbox with new mail"
--- /dev/null
+OP_SIDEBAR_NEXT "Move the highlight to next mailbox"
+OP_SIDEBAR_NEXT_NEW "Move the highlight to next mailbox with new mail"
+OP_SIDEBAR_OPEN "Open highlighted mailbox"
+OP_SIDEBAR_PREV "Move the highlight to previous mailbox"
+OP_SIDEBAR_PREV_NEW "Move the highlight to previous mailbox with new mail"
+OP_SIDEBAR_SCROLL_DOWN "Scroll the Sidebar down 1 page"
+OP_SIDEBAR_SCROLL_UP "Scroll the Sidebar up 1 page"
#include "mx.h"
#include "mutt_curses.h"
+
+#ifdef USE_SIDEBAR
#include "sidebar.h"
+#endif
#ifdef USE_IMAP
#include "imap.h"
}
}
+#ifdef USE_SIDEBAR
/**
* buffy_compare_name - qsort callback to sort BUFFYs
* @a: First BUFFY to compare
free (ary);
return tmp;
}
+#endif
BUFFY *mutt_find_mailbox (const char *path)
{
static BUFFY *buffy_new (const char *path)
{
BUFFY* buffy;
+#ifdef USE_SIDEBAR
char rp[PATH_MAX] = "";
char *r = NULL;
+#endif
buffy = (BUFFY *) safe_calloc (1, sizeof (BUFFY));
strfcpy (buffy->path, path, sizeof (buffy->path));
+#ifdef USE_SIDEBAR
r = realpath (path, rp);
strfcpy (buffy->realpath, r ? rp : path, sizeof (buffy->realpath));
+#endif
buffy->next = NULL;
buffy->magic = 0;
char buf[_POSIX_PATH_MAX];
struct stat sb;
char f1[PATH_MAX];
+#ifndef USE_SIDEBAR
char f2[PATH_MAX];
+#endif
char *p, *q;
while (MoreArgs (s))
p = realpath (buf, f1);
for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next))
{
+#ifdef USE_SIDEBAR
q = (*tmp)->realpath;
if (mutt_strcmp (p ? p : buf, q) == 0)
+#else
+ q = realpath ((*tmp)->path, f2);
+ if (mutt_strcmp (p ? p : buf, q ? q : (*tmp)->path) == 0)
+#endif
{
dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path));
break;
else
(*tmp)->size = 0;
}
+#ifdef USE_SIDEBAR
Incoming = buffy_sort (Incoming);
+#endif
return 0;
}
return 0;
}
+#ifdef USE_SIDEBAR
if (option (OPTSIDEBAR) && mailbox->msg_unread > 0) {
mailbox->new = 1;
return 1;
}
+#endif
if ((dirp = opendir (path)) == NULL)
{
return 0;
}
+#ifdef USE_SIDEBAR
/**
* buffy_maildir_update - Update messages counts for a maildir mailbox
* @mailbox: BUFFY representing a maildir mailbox
mailbox->sb_last_checked = time (NULL);
closedir (dirp);
}
+#endif
/* returns 1 if mailbox has new mail */
static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb)
else
statcheck = sb->st_mtime > sb->st_atime
|| (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
+#ifdef USE_SIDEBAR
if ((!option (OPTSIDEBAR) && statcheck) || (option (OPTSIDEBAR) && mailbox->msg_unread > 0))
+#else
+ if (statcheck)
+#endif
{
if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
{
return rc;
}
+#ifdef USE_SIDEBAR
/**
* buffy_mbox_update - Update messages counts for an mbox mailbox
* @mailbox: BUFFY representing an mbox mailbox
mx_close_mailbox (ctx, 0);
}
}
+#endif
int mutt_buffy_check (int force)
{
{
case M_MBOX:
case M_MMDF:
+#ifdef USE_SIDEBAR
if (sb_should_refresh()) {
buffy_mbox_update (tmp, &sb);
sb_set_update_time();
}
+#endif
if (buffy_mbox_hasnew (tmp, &sb) > 0)
BuffyCount++;
break;
case M_MAILDIR:
+#ifdef USE_SIDEBAR
if (sb_should_refresh()) {
buffy_maildir_update (tmp);
sb_set_update_time();
}
+#endif
if (buffy_maildir_hasnew (tmp) > 0)
BuffyCount++;
break;
case M_MH:
+#ifdef USE_SIDEBAR
if (sb_should_refresh()) {
mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked);
sb_set_update_time();
}
+#endif
mh_buffy(tmp);
if (tmp->new)
BuffyCount++;
typedef struct buffy_t
{
char path[_POSIX_PATH_MAX];
+#ifdef USE_SIDEBAR
char realpath[_POSIX_PATH_MAX];
+#endif
off_t size;
struct buffy_t *next;
+#ifdef USE_SIDEBAR
struct buffy_t *prev;
+#endif
short new; /* mailbox has new mail */
+#ifdef USE_SIDEBAR
int msgcount; /* total number of messages */
int msg_unread; /* number of unread messages */
int msg_flagged; /* number of flagged messages */
+#endif
short notified; /* user has been notified */
short magic; /* mailbox type */
short newly_created; /* mbox or mmdf just popped into existence */
time_t last_visited; /* time of last exit from this mailbox */
+#ifdef USE_SIDEBAR
time_t sb_last_checked; /* time of last buffy check from sidebar */
+#endif
}
BUFFY;
{ "underline", MT_COLOR_UNDERLINE },
{ "index", MT_COLOR_INDEX },
{ "prompt", MT_COLOR_PROMPT },
+#ifdef USE_SIDEBAR
{ "sidebar_flagged", MT_COLOR_FLAGGED },
{ "sidebar_new", MT_COLOR_NEW },
+#endif
{ NULL, 0 }
};
#include "mailbox.h"
#include "sort.h"
#include "charset.h"
+#ifdef USE_SIDEBAR
#include "sidebar.h"
+#endif
#ifdef MIXMASTER
#include "remailer.h"
static void draw_envelope (HEADER *msg, char *fcc)
{
+#ifdef USE_SIDEBAR
sb_draw();
+#endif
draw_envelope_addr (HDR_FROM, msg->env->from);
draw_envelope_addr (HDR_TO, msg->env->to);
draw_envelope_addr (HDR_CC, msg->env->cc);
SMIMEAUX_TARGET="smime_keys"
fi
+AC_ARG_ENABLE(sidebar, AC_HELP_STRING([--enable-sidebar], [Enable Sidebar support]),
+[ if test x$enableval = xyes ; then
+ AC_DEFINE(USE_SIDEBAR,1,[ Define if you want support for the sidebar. ])
+ OPS="$OPS \$(srcdir)/OPS.SIDEBAR"
+ need_sidebar="yes"
+ fi
+])
+AM_CONDITIONAL(BUILD_SIDEBAR, test x$need_sidebar = xyes)
+
AC_ARG_WITH(mixmaster, AS_HELP_STRING([--with-mixmaster@<:@=PATH@:>@],[Include Mixmaster support]),
[if test "$withval" != no
then
#include "sort.h"
#include "buffy.h"
#include "mx.h"
+
+#ifdef USE_SIDEBAR
#include "sidebar.h"
+#endif
#ifdef USE_POP
#include "pop.h"
do_buffy_notify = 1;
}
+#ifdef USE_SIDEBAR
if (option (OPTSIDEBAR))
menu->redraw |= REDRAW_SIDEBAR;
+#endif
if (op != -1)
mutt_curs_set (0);
if (menu->redraw & REDRAW_FULL)
{
menu_redraw_full (menu);
+#ifdef USE_SIDEBAR
sb_draw();
+#endif
mutt_show_error ();
- } else if (menu->redraw & REDRAW_SIDEBAR) {
+ }
+#ifdef USE_SIDEBAR
+ else if (menu->redraw & REDRAW_SIDEBAR) {
sb_draw();
menu->redraw &= ~REDRAW_SIDEBAR;
}
+#endif
if (menu->menu == MENU_MAIN)
{
if (menu->redraw & REDRAW_STATUS)
{
+#ifdef USE_SIDEBAR
/* Temporarily lie about the sidebar width */
short sw = SidebarWidth;
SidebarWidth = 0;
+#endif
menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
+#ifdef USE_SIDEBAR
SidebarWidth = sw; /* Restore the sidebar width */
+#endif
move (option (OPTSTATUSONTOP) ? 0 : LINES-2, 0);
SETCOLOR (MT_COLOR_STATUS);
+#ifdef USE_SIDEBAR
sb_set_buffystats (Context);
+#endif
mutt_paddstr (COLS, buf);
NORMAL_COLOR;
menu->redraw &= ~REDRAW_STATUS;
break;
CHECK_MSGCOUNT;
+#ifdef USE_SIDEBAR
CHECK_VISIBLE;
+#endif
CHECK_READONLY;
{
int oldvcount = Context->vcount;
menu->redraw = REDRAW_FULL;
break;
+#ifdef USE_SIDEBAR
case OP_SIDEBAR_OPEN:
+#endif
case OP_MAIN_CHANGE_FOLDER:
case OP_MAIN_NEXT_UNREAD_MAILBOX:
{
mutt_buffy (buf, sizeof (buf));
+#ifdef USE_SIDEBAR
if (op == OP_SIDEBAR_OPEN) {
if (!CurBuffy)
break;
strncpy (buf, CurBuffy->path, sizeof (buf));
} else
+#endif
if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
{
if (menu->menu == MENU_PAGER)
}
mutt_expand_path (buf, sizeof (buf));
+#ifdef USE_SIDEBAR
sb_set_open_buffy (buf);
+#endif
if (mx_get_magic (buf) <= 0)
{
mutt_error (_("%s is not a mailbox."), buf);
mutt_what_key();
break;
+#ifdef USE_SIDEBAR
case OP_SIDEBAR_SCROLL_UP:
case OP_SIDEBAR_SCROLL_DOWN:
case OP_SIDEBAR_NEXT:
case OP_SIDEBAR_PREV_NEW:
sb_change_mailbox (op);
break;
+#endif
default:
if (menu->menu == MENU_MAIN)
km_error_key (MENU_MAIN);
#include "mutt_curses.h"
#include "sort.h"
#include "mx.h"
+
+#ifdef USE_SIDEBAR
#include "sidebar.h"
+#endif
void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
{
*/
if (h->searched && (changed != h->changed || deleted != ctx->deleted || tagged != ctx->tagged || flagged != ctx->flagged))
h->searched = 0;
+#ifdef USE_SIDEBAR
sb_draw();
+#endif
}
void mutt_tag_set_flag (int flag, int bf)
{ "decrypt-copy", OP_DECRYPT_COPY, NULL },
{ "decrypt-save", OP_DECRYPT_SAVE, NULL },
+#ifdef USE_SIDEBAR
{ "sidebar-next", OP_SIDEBAR_NEXT, NULL },
{ "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL },
{ "sidebar-open", OP_SIDEBAR_OPEN, NULL },
{ "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL },
{ "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL },
{ "sidebar-scroll-up", OP_SIDEBAR_SCROLL_UP, NULL },
+#endif
{ NULL, 0, NULL }
};
{ "what-key", OP_WHAT_KEY, NULL },
+#ifdef USE_SIDEBAR
{ "sidebar-next", OP_SIDEBAR_NEXT, NULL },
{ "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL },
{ "sidebar-open", OP_SIDEBAR_OPEN, NULL },
{ "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL },
{ "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL },
{ "sidebar-scroll-up", OP_SIDEBAR_SCROLL_UP, NULL },
+#endif
{ NULL, 0, NULL }
};
WHERE char *SendCharset;
WHERE char *Sendmail;
WHERE char *Shell;
+#ifdef USE_SIDEBAR
WHERE char *SidebarDelim;
WHERE char *SidebarDelimChars;
WHERE char *SidebarFormat;
WHERE char *SidebarIndentStr;
+#endif
WHERE char *Signature;
WHERE char *SimpleSearch;
#if USE_SMTP
WHERE short ScoreThresholdRead;
WHERE short ScoreThresholdFlag;
+/* This isn't excluded from the build because it's too entwined in the code.
+ * For now. */
+WHERE short SidebarWidth;
+#ifdef USE_SIDEBAR
WHERE struct buffy_t *CurBuffy INITVAL(0);
WHERE short SidebarLastRefresh;
WHERE short SidebarRefresh;
WHERE LIST *SidebarWhitelist INITVAL(0);
-WHERE short SidebarWidth;
+#endif
#ifdef USE_IMAP
WHERE short ImapKeepalive;
opened */
status->uidnext = oldun;
- /* Added to make the sidebar show the correct numbers */
+#ifdef USE_SIDEBAR
+ /* Make the sidebar show the correct numbers */
if (status->messages) {
inc->msgcount = status->messages;
inc->msg_unread = status->unseen;
}
+#endif
FREE (&value);
return;
imap_munge_mbox_name (munged, sizeof (munged), name);
snprintf (command, sizeof (command),
+#ifdef USE_SIDEBAR
"STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT MESSAGES)", munged);
+#else
+ "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT)", munged);
+#endif
if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0)
{
** Command to use when spawning a subshell. By default, the user's login
** shell from \fC/etc/passwd\fP is used.
*/
+#ifdef USE_SIDEBAR
{ "sidebar_delim", DT_STR, R_BOTH, UL &SidebarDelim, UL "|" },
/*
** .pp
** For example: sidebar_width=20 could display 20 ASCII characters, or 10
** Chinese characters.
*/
+#endif
{ "sig_dashes", DT_BOOL, R_NONE, OPTSIGDASHES, 1 },
/*
** .pp
{ "send-hook", mutt_parse_hook, M_SENDHOOK },
{ "send2-hook", mutt_parse_hook, M_SEND2HOOK },
{ "set", parse_set, 0 },
+#ifdef USE_SIDEBAR
{ "sidebar_whitelist",parse_list, UL &SidebarWhitelist },
+#endif
{ "source", parse_source, 0 },
{ "spam", parse_spam_list, M_SPAM },
{ "nospam", parse_spam_list, M_NOSPAM },
#define M_NEWFOLDER (1<<4) /* create a new folder - same as M_APPEND, but uses
* safe_fopen() for mbox-style folders.
*/
+#ifdef USE_SIDEBAR
#define M_PEEK (1<<5) /* revert atime back after taking a look (if applicable) */
+#endif
/* mx_open_new_message() */
#define M_ADD_FROM (1<<0) /* add a From_ line */
#include "url.h"
#include "mutt_crypt.h"
#include "mutt_idna.h"
+#ifdef USE_SIDEBAR
#include "sidebar.h"
+#endif
#ifdef USE_SASL
#include "mutt_sasl.h"
"-USE_HCACHE "
#endif
+#ifdef USE_SIDEBAR
+ "+USE_SIDEBAR "
+#else
+ "-USE_SIDEBAR "
+#endif
+
);
#ifdef ISPELL
int main (int argc, char **argv)
{
+#ifdef USE_SIDEBAR
char folder[PATH_MAX] = "";
+#else
+ char folder[_POSIX_PATH_MAX] = "";
+#endif
char *subject = NULL;
char *includeFile = NULL;
char *draftFile = NULL;
strfcpy (folder, NONULL(Spoolfile), sizeof (folder));
mutt_expand_path (folder, sizeof (folder));
+#ifdef USE_SIDEBAR
{
char tmpfolder[PATH_MAX] = "";
strfcpy (tmpfolder, folder, sizeof (tmpfolder));
if (!realpath (tmpfolder, folder))
strfcpy (folder, tmpfolder, sizeof (tmpfolder));
}
+#endif
mutt_str_replace (&CurrentFolder, folder);
mutt_str_replace (&LastFolder, folder);
if((Context = mx_open_mailbox (folder, ((flags & M_RO) || option (OPTREADONLY)) ? M_READONLY : 0, NULL))
|| !explicit_folder)
{
+#ifdef USE_SIDEBAR
sb_set_open_buffy (folder);
+#endif
mutt_index_menu ();
if (Context)
FREE (&Context);
mutt_perror (ctx->path);
return (-1);
}
+#ifdef USE_SIDEBAR
ctx->atime = sb.st_atime;
+#endif
ctx->mtime = sb.st_mtime;
ctx->size = sb.st_size;
ctx->size = sb.st_size;
ctx->mtime = sb.st_mtime;
+#ifdef USE_SIDEBAR
ctx->atime = sb.st_atime;
+#endif
#ifdef NFS_ATTRIBUTE_HACK
if (sb.st_mtime > sb.st_atime)
#include "mutt_curses.h"
#include "mutt_menu.h"
#include "mbyte.h"
+#ifdef USE_SIDEBAR
#include "sidebar.h"
+#endif
extern size_t UngetCount;
int do_color;
int attr;
+#ifdef USE_SIDEBAR
sb_draw();
+#endif
for (i = menu->top; i < menu->top + menu->pagelen; i++)
{
if (i < menu->max)
else
{
NORMAL_COLOR;
+#ifdef USE_SIDEBAR
CLEARLINE_WIN(i - menu->top + menu->offset);
+#else
+ CLEARLINE(i - menu->top + menu->offset);
+#endif
}
}
NORMAL_COLOR;
mhs_free_sequences (&mhs);
}
+#ifdef USE_SIDEBAR
/**
* mh_buffy_update - Update messages counts for an mh mailbox
* @path: Pathname of the mailbox
mhs_free_sequences (&mhs);
*sb_last_checked = time (NULL);
}
+#endif
static int mh_mkstemp (CONTEXT * dest, FILE ** fp, char **tgt)
{
OPTSAVEEMPTY,
OPTSAVENAME,
OPTSCORE,
+#ifdef USE_SIDEBAR
OPTSIDEBAR,
OPTSIDEBARFOLDERINDENT,
OPTSIDEBARNEWMAILONLY,
OPTSIDEBARNEXTNEWWRAP,
OPTSIDEBARSHORTPATH,
OPTSIDEBARSORT,
+#endif
OPTSIGDASHES,
OPTSIGONTOP,
OPTSORTRE,
{
char *path;
FILE *fp;
+#ifdef USE_SIDEBAR
time_t atime;
+#endif
time_t mtime;
off_t size;
off_t vsize;
unsigned int quiet : 1; /* inhibit status messages? */
unsigned int collapsed : 1; /* are all threads collapsed? */
unsigned int closing : 1; /* mailbox is being closed */
+#ifdef USE_SIDEBAR
unsigned int peekonly : 1; /* just taking a glance, revert atime */
+#endif
/* driver hooks */
void *data; /* driver specific data */
#undef lines
#endif /* lines */
+#ifdef USE_SIDEBAR
#define CLEARLINE_WIN(x) move (x,SidebarWidth), clrtoeol()
+#endif
#define CLEARLINE(x) move(x,0), clrtoeol()
#define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x)
#define BEEP() do { if (option (OPTBEEP)) beep(); } while (0)
MT_COLOR_UNDERLINE,
MT_COLOR_INDEX,
MT_COLOR_PROMPT,
+#ifdef USE_SIDEBAR
MT_COLOR_FLAGGED,
MT_COLOR_NEW,
+#endif
MT_COLOR_MAX
};
#define REDRAW_FULL (1<<5)
#define REDRAW_BODY (1<<6)
#define REDRAW_SIGWINCH (1<<7)
+#ifdef USE_SIDEBAR
#define REDRAW_SIDEBAR (1<<8)
+#endif
#define M_MODEFMT "-- Mutt: %s"
#include "copy.h"
#include "keymap.h"
#include "url.h"
+#ifdef USE_SIDEBAR
#include "sidebar.h"
+#endif
#ifdef USE_IMAP
#include "imap.h"
ctx->quiet = 1;
if (flags & M_READONLY)
ctx->readonly = 1;
+#ifdef USE_SIDEBAR
if (flags & M_PEEK)
ctx->peekonly = 1;
+#endif
if (flags & (M_APPEND|M_NEWFOLDER))
{
if(!ctx)
return;
+#ifdef USE_SIDEBAR
/* fix up the times so buffy won't get confused */
struct utimbuf ut;
if (ctx->peekonly && ctx->path && (ctx->mtime > ctx->atime)) {
ut.modtime = ctx->mtime;
utime (ctx->path, &ut);
}
+#endif
/* never announce that a mailbox we've just left has new mail. #3290
* XXX: really belongs in mx_close_mailbox, but this is a nice hook point */
+#ifdef USE_SIDEBAR
if (!ctx->peekonly)
+#endif
mutt_buffy_setnotified(ctx->path);
if (ctx->mx_close)
mutt_clear_threads (ctx);
for (i = 0; i < ctx->msgcount; i++)
mutt_free_header (&ctx->hdrs[i]);
+#ifdef USE_SIDEBAR
ctx->msgcount -= ctx->deleted;
sb_set_buffystats (ctx);
+#endif
FREE (&ctx->hdrs);
FREE (&ctx->v2r);
FREE (&ctx->path);
if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->read
&& !(ctx->hdrs[i]->flagged && option (OPTKEEPFLAGGED)))
read_msgs++;
+#ifdef USE_SIDEBAR
if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->read)
ctx->unread--;
if (ctx->hdrs[i]->deleted && ctx->hdrs[i]->flagged)
ctx->flagged--;
+#endif
}
if (read_msgs && quadoption (OPT_MOVE) != M_NO)
int mh_read_dir (CONTEXT *, const char *);
int mh_sync_mailbox (CONTEXT *, int *);
int mh_check_mailbox (CONTEXT *, int *);
+#ifdef USE_SIDEBAR
void mh_buffy_update (const char *, int *, int *, int *, time_t *);
+#endif
int mh_check_empty (const char *);
int maildir_read_dir (CONTEXT *);
#include "pager.h"
#include "attach.h"
#include "mbyte.h"
+#ifdef USE_SIDEBAR
#include "sidebar.h"
+#endif
#include "mutt_crypt.h"
wchar_t wc;
mbstate_t mbstate;
int wrap_cols = mutt_term_width ((flags & M_PAGER_NOWRAP) ? 0 : Wrap);
+#ifdef USE_SIDEBAR
wrap_cols -= SidebarWidth;
+#endif
if (check_attachment_marker ((char *)buf) == 0)
wrap_cols = COLS;
&QuoteList, &q_level, &force_redraw, &SearchRE) > 0)
lines++;
curline++;
+#ifdef USE_SIDEBAR
move (lines + bodyoffset, SidebarWidth);
+#endif
}
last_offset = lineInfo[curline].offset;
} while (force_redraw);
addch ('~');
addch ('\n');
lines++;
+#ifdef USE_SIDEBAR
move (lines + bodyoffset, SidebarWidth);
+#endif
}
NORMAL_COLOR;
hfi.ctx = Context;
hfi.pager_progress = pager_progress_str;
+#ifdef USE_SIDEBAR
statuswidth = COLS;
if (option (OPTSTATUSONTOP) && (PagerIndexLines > 0))
statuswidth -= SidebarWidth;
+#endif
if (last_pos < sb.st_size - 1)
snprintf(pager_progress_str, sizeof(pager_progress_str), OFF_T_FMT "%%", (100 * last_offset / sb.st_size));
/* print out the pager status bar */
move (statusoffset, SidebarWidth);
SETCOLOR (MT_COLOR_STATUS);
+#ifdef USE_SIDEBAR
short sw = SidebarWidth;
if (option (OPTSTATUSONTOP) && PagerIndexLines > 0) {
CLEARLINE_WIN (statusoffset);
/* Temporarily lie about the sidebar width */
SidebarWidth = 0;
}
+#endif
if (IsHeader (extra) || IsMsgAttach (extra))
{
snprintf (bn, sizeof (bn), "%s (%s)", banner, pager_progress_str);
mutt_paddstr (statuswidth, bn);
}
+#ifdef USE_SIDEBAR
if (!option (OPTSTATUSONTOP) || PagerIndexLines == 0)
SidebarWidth = sw; /* Restore the sidebar width */
-
+#endif
NORMAL_COLOR;
if (option(OPTTSENABLED) && TSSupported)
{
/* redraw the pager_index indicator, because the
* flags for this message might have changed. */
menu_redraw_current (index);
+#ifdef USE_SIDEBAR
sb_draw();
+#endif
/* print out the index status bar */
menu_status_line (buffer, sizeof (buffer), index, NONULL(Status));
NORMAL_COLOR;
}
+#ifdef USE_SIDEBAR
/* if we're not using the index, update every time */
if (index == 0)
sb_draw();
+#endif
redraw = 0;
mutt_what_key ();
break;
+#ifdef USE_SIDEBAR
case OP_SIDEBAR_NEXT:
case OP_SIDEBAR_NEXT_NEW:
case OP_SIDEBAR_PREV:
case OP_SIDEBAR_SCROLL_UP:
sb_change_mailbox (ch);
break;
+#endif
default:
ch = -1;