add_folder (menu, state, data->group, NULL, data->new);
#endif
}
- sidebar_draw (CurrentMenu);
+ sidebar_draw ();
}
else
#endif /* USE_NNTP */
}
closedir (dp);
}
- sidebar_draw (CurrentMenu);
+ sidebar_draw ();
browser_sort (state);
return 0;
}
(!option (OPTSHOWONLYUNREAD)|| data->unread))))
add_folder (menu, state, data->group, NULL, data, data->new);
}
- sidebar_draw (CurrentMenu);
+ sidebar_draw ();
}
else
#endif
tmp->has_new = tmp->new > 0;
}
if (BuffyCount > 0 && force != 2)
- sidebar_draw (CurrentMenu);
+ sidebar_draw ();
return (BuffyCount);
}
}
if (!first) {
/* on new mail: redraw sidebar */
- sidebar_draw (CurrentMenu);
+ sidebar_draw ();
mutt_message ("%s", buffylist);
return (1);
}
if (h->searched && (changed != h->changed || deleted != ctx->deleted ||
tagged != ctx->tagged || flagged != ctx->flagged))
h->searched = 0;
- sidebar_draw (0);
+ sidebar_draw ();
}
void mutt_tag_set_flag (int flag, int bf)
#include "mutt.h"
#include "mx.h"
+#include "curses.h"
#include <imap/imap.h>
#ifdef USE_NNTP
#include <nntp/nntp.h>
("Mailbox was externally modified. Flags may be wrong."));
else if (check == M_NEW_MAIL) {
/* on new mail: redraw sidebar */
- sidebar_draw (CurrentMenu);
+ sidebar_draw ();
mutt_message (_("New mail in this mailbox."));
if (option (OPTBEEPNEW))
if (op != -1)
mutt_curs_set (0);
if (menu->redraw & REDRAW_SIDEBAR)
- sidebar_draw (menu->menu);
+ sidebar_draw ();
if (menu->redraw & REDRAW_FULL) {
menu_redraw_full (menu);
- sidebar_draw (menu->menu);
+ sidebar_draw ();
mutt_show_error ();
}
case OP_SIDEBAR_PREV:
case OP_SIDEBAR_NEXT_NEW:
case OP_SIDEBAR_PREV_NEW:
- sidebar_scroll (op, menu->menu);
+ sidebar_scroll (op);
break;
default:
if (menu->menu == MENU_MAIN)
}
}
-size_t my_mbstowcs (wchar_t ** pwbuf, size_t * pwbuflen, size_t i, const char *buf)
+static size_t my_mbstowcs (wchar_t ** pwbuf, size_t * pwbuflen, size_t i, const char *buf)
{
wchar_t wc;
mbstate_t st;
#include "charset.h"
#include <lib-crypt/crypt.h>
#include "mutt_idna.h"
+#include "mx.h"
int mutt_is_mail_list (address_t * addr)
{
menu->make_entry (s, l, menu, i);
}
-void menu_pad_string (char *s, size_t n)
+static void menu_pad_string (char *s, size_t n)
{
int shift = option (OPTARROWCURSOR) ? 3 : 0;
int cols;
else
CLEARLINE_WIN (i - menu->top + menu->offset);
}
- sidebar_draw (1);
-/* sidebar_draw_frames(); */
+ sidebar_draw ();
menu->redraw = 0;
}
menu->redraw &= REDRAW_STATUS;
}
-void menu_redraw_prompt (MUTTMENU * menu)
+static void menu_redraw_prompt (MUTTMENU * menu)
{
if (menu->dialog) {
if (option (OPTMSGERR)) {
* halfdown: jumplen == pagelen/2
*/
#define DIRECTION ((neg * 2) + 1)
-void menu_length_jump (MUTTMENU *menu, int jumplen) {
+static void menu_length_jump (MUTTMENU *menu, int jumplen) {
int tmp, neg = (jumplen >= 0) ? 0 : -1;
int c = MIN (MenuContext, menu->pagelen / 2);
mutt_error _("No entries.");
}
-void menu_next_entry (MUTTMENU * menu)
+static void menu_next_entry (MUTTMENU * menu)
{
if (menu->current < menu->max - 1) {
menu->current++;
mutt_error _("You are on the last entry.");
}
-void menu_prev_entry (MUTTMENU * menu)
+static void menu_prev_entry (MUTTMENU * menu)
{
if (menu->current) {
menu->current--;
TopBuffy = 0;
}
-static char *shortened_hierarchy (char *box, int maxlen)
+static char *shortened_hierarchy (char *hbox, int maxlen)
{
int dots = 0;
char *last_dot = NULL;
- int i, j, len = m_strlen(box);
+ int i, j, len = m_strlen(hbox);
char *new_box;
if (!SidebarBoundary || !*SidebarBoundary)
- return (m_strdup(box));
+ return (m_strdup(hbox));
for (i = 0; i < len; ++i) {
- if (strchr (SidebarBoundary, box[i])) {
+ if (strchr (SidebarBoundary, hbox[i])) {
++dots;
- last_dot = &box[i];
+ last_dot = &hbox[i];
}
}
if (last_dot) {
++last_dot;
new_box = p_new(char, maxlen + 1);
- new_box[0] = box[0];
+ new_box[0] = hbox[0];
for (i = 1, j = 1; j < maxlen && i < len; ++i) {
- if (strchr (SidebarBoundary, box[i])) {
- new_box[j++] = box[i];
+ if (strchr (SidebarBoundary, hbox[i])) {
+ new_box[j++] = hbox[i];
new_box[j] = 0;
- if (&box[i + 1] != last_dot || j + m_strlen(last_dot) > maxlen) {
- new_box[j++] = box[i + 1];
+ if (&hbox[i + 1] != last_dot || j + m_strlen(last_dot) > maxlen) {
+ new_box[j++] = hbox[i + 1];
new_box[j] = 0;
} else {
strcat (&new_box[j], last_dot);
}
return new_box;
}
- return m_strdup(box);
+ return m_strdup(hbox);
}
static const char* sidebar_number_format (char* dest, ssize_t destlen, char op,
* 0 item was not printed ('cause of $sidebar_newmail_only)
* 1 item was printed
*/
-int make_sidebar_entry (char* box, int idx, ssize_t len)
+static int make_sidebar_entry (char* sbox, int idx, ssize_t len)
{
int shortened = 0, lencnt = 0;
char no[SHORT_STRING], entry[SHORT_STRING];
if (SidebarWidth > COLS)
SidebarWidth = COLS;
- if (option (OPTSIDEBARNEWMAILONLY) && box && Context && Context->path &&
- m_strcmp(Context->path, box) && ((BUFFY*) Incoming->data[idx])->new == 0)
+ if (option (OPTSIDEBARNEWMAILONLY) && sbox && Context && Context->path &&
+ m_strcmp(Context->path, sbox) && ((BUFFY*) Incoming->data[idx])->new == 0)
/* if $sidebar_newmail_only is set, don't display the
* box only if it's not the currently opened
* (i.e. always display the currently opened) */
lencnt = m_strlen(no);
memset(&entry, ' ', sizeof(entry));
- if (l > 0 && m_strncmp(box, ImapHomeNamespace, l) == 0 &&
- m_strlen(box) > l)
- box += l + 1; /* we're trimming the ImapHomeNamespace, the "+ 1" is for the separator */
+ if (l > 0 && m_strncmp(sbox, ImapHomeNamespace, l) == 0 &&
+ m_strlen(sbox) > l)
+ sbox += l + 1; /* we're trimming the ImapHomeNamespace, the "+ 1" is for the separator */
else
- if (l_m > 0 && m_strncmp(box, Maildir, l_m) == 0 &&
- m_strlen(box) > l_m) {
- box += l_m;
+ if (l_m > 0 && m_strncmp(sbox, Maildir, l_m) == 0 &&
+ m_strlen(sbox) > l_m) {
+ sbox += l_m;
if (Maildir[strlen(Maildir)-1]!='/') {
- box += 1;
+ sbox += 1;
}
} else
- box = basename (box);
+ sbox = basename (sbox);
- if (option (OPTSHORTENHIERARCHY) && m_strlen(box) > len-lencnt-1) {
- box = shortened_hierarchy (box, len-lencnt-1);
+ if (option (OPTSHORTENHIERARCHY) && m_strlen(sbox) > len-lencnt-1) {
+ sbox = shortened_hierarchy (sbox, len-lencnt-1);
shortened = 1;
}
- m_strcpy(entry, len - lencnt, box);
+ m_strcpy(entry, len - lencnt, sbox);
entry[m_strlen(entry)] = ' ';
memcpy(entry + (len - lencnt), no, lencnt);
addnstr (entry, len);
if (shortened)
- p_delete(&box);
+ p_delete(&sbox);
return (1);
}
/* fix counters for a context
* FIXME since ctx must not be of our business, move it elsewhere
*/
-void sidebar_set_buffystats (CONTEXT* Context) {
+void sidebar_set_buffystats (CONTEXT* curContext) {
int i = 0;
BUFFY* tmp = NULL;
- if (!Context || list_empty(Incoming) || (i = buffy_lookup (Context->path)) < 0)
+ if (!curContext || list_empty(Incoming) || (i = buffy_lookup (curContext->path)) < 0)
return;
- tmp = (BUFFY*) Incoming->data[i];
- tmp->new = Context->new;
- tmp->msg_unread = Context->unread;
- tmp->msgcount = Context->msgcount;
- tmp->msg_flagged = Context->flagged;
+ tmp = Incoming->data[i];
+ tmp->new = curContext->new;
+ tmp->msg_unread = curContext->unread;
+ tmp->msgcount = curContext->msgcount;
+ tmp->msg_flagged = curContext->flagged;
}
void sidebar_draw_frames (void) {
/* actually draws something
* FIXME this needs some clue when to do it
*/
-int sidebar_draw (int menu) {
+int sidebar_draw (void) {
int first_line = option (OPTSTATUSONTOP) ? 1 : option (OPTHELP) ? 1 : 0,
last_line = LINES - 2 + (option (OPTSTATUSONTOP) && !option (OPTHELP) ? 1 : 0),
i = 0,line;
return (-1);
}
-void sidebar_scroll (int op, int menu) {
+void sidebar_scroll (int op) {
int i = 0;
if (!SidebarWidth || list_empty(Incoming))
return;
}
calc_boundaries ();
- sidebar_draw (menu);
+ sidebar_draw ();
}
#include "mutt.h" /* because of CONTEXT :| */
-int sidebar_draw (int);
+int sidebar_draw (void);
void sidebar_draw_frames (void);
-void sidebar_scroll (int, int);
+void sidebar_scroll (int);
void sidebar_set_buffystats (CONTEXT *);
const char* sidebar_get_current (void);
void sidebar_set_current (const char*);
* retry - should retry if unable to lock?
*/
-static int invoke_dotlock (const char *path, int dummy, int flags, int retry)
+static int invoke_dotlock (const char *path, int flags, int retry)
{
char cmd[LONG_STRING + _POSIX_PATH_MAX];
char f[SHORT_STRING + _POSIX_PATH_MAX];
return mutt_system (cmd);
}
-static int dotlock_file (const char *path, int fd, int retry)
+static int dotlock_file (const char *path, int retry)
{
int r;
int flags = DL_FL_USEPRIV | DL_FL_RETRY;
retry = 1;
retry_lock:
- if ((r = invoke_dotlock (path, fd, flags, retry)) == DL_EX_EXIST) {
+ if ((r = invoke_dotlock (path, flags, retry)) == DL_EX_EXIST) {
if (!option (OPTNOCURSES)) {
char msg[LONG_STRING];
return (r == DL_EX_OK ? 0 : -1);
}
-static int undotlock_file (const char *path, int fd)
+static int undotlock_file (const char *path)
{
- return (invoke_dotlock (path, fd, DL_FL_USEPRIV | DL_FL_UNLOCK, 0) ==
+ return (invoke_dotlock (path, DL_FL_USEPRIV | DL_FL_UNLOCK, 0) ==
DL_EX_OK ? 0 : -1);
}
#ifdef USE_DOTLOCK
if (r == 0 && dot)
- r = dotlock_file (path, fd, time_out);
+ r = dotlock_file (path, time_out);
#endif /* USE_DOTLOCK */
if (r == -1) {
#ifdef USE_DOTLOCK
if (dot)
- undotlock_file (path, fd);
+ undotlock_file (path);
#endif
return 0;
}
-void mx_unlink_empty (const char *path)
+static void mx_unlink_empty (const char *path)
{
int fd;
}
#ifdef USE_DOTLOCK
- invoke_dotlock (path, fd, DL_FL_UNLINK, 1);
+ invoke_dotlock (path, DL_FL_UNLINK, 1);
#else
if (fstat (fd, &sb) == 0 && sb.st_size == 0)
unlink (path);
if (magic != M_MAILDIR && magic != M_MH && magic != M_IMAP)
continue;
sidebar_set_current (b->path);
- sidebar_draw (CurrentMenu);
+ sidebar_draw ();
if ((ctx = mx_open_mailbox (b->path,
M_READONLY | M_NOSORT | M_COUNT,
NULL)) != NULL)
if (Context && Context->path)
sidebar_set_current (Context->path);
- sidebar_draw (CurrentMenu);
+ sidebar_draw ();
return (0);
#endif
if (l->data && ((NNTP_DATA *) l->data)->subscribed)
_nntp_check_mailbox (NULL, (NNTP_DATA *) l->data);
}
- sidebar_draw (CurrentMenu);
+ sidebar_draw ();
}
else if (!force)
return 0;
}
if (redraw & REDRAW_SIDEBAR)
- sidebar_draw (MENU_PAGER);
+ sidebar_draw ();
if ((redraw & REDRAW_INDEX) && pager_index) {
/* redraw the pager_index indicator, because the
* flags for this message might have changed. */
menu_redraw_current (pager_index);
- sidebar_draw (MENU_PAGER);
+ sidebar_draw ();
/* print out the pager_index status bar */
menu_status_line (buffer, sizeof (buffer), pager_index, NONULL (Status));
move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), SW);
}
/* if we're not using the index, update every time */
if (index == 0)
- sidebar_draw (MENU_PAGER);
+ sidebar_draw ();
redraw = 0;
case OP_SIDEBAR_NEXT_NEW:
case OP_SIDEBAR_PREV:
case OP_SIDEBAR_PREV_NEW:
- sidebar_scroll (ch, MENU_PAGER);
+ sidebar_scroll (ch);
break;
default:
ch = -1;