summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2019-04-07 16:02:02 -0700
committerKevin McCarthy <kevin@8t8.us>2019-04-07 16:02:02 -0700
commitbcda4240165ff4e3b3f7da5677a3e0ddd00aa8b6 (patch)
treeea41383488df5ea18ab7d70db829803d09953912
parenta69a853fdf1407b8e0c53f1fb63f2f0e1a71a9b2 (diff)
Create mutt_buffer_buffy() buffer function.
Relocate some of the buffy function declarations to buffy.h while adding the new declaration.
-rw-r--r--buffy.c25
-rw-r--r--buffy.h7
-rw-r--r--enter.c1
-rw-r--r--protos.h4
4 files changed, 27 insertions, 10 deletions
diff --git a/buffy.c b/buffy.c
index 849d25ee..d413abf5 100644
--- a/buffy.c
+++ b/buffy.c
@@ -726,18 +726,31 @@ int mutt_buffy_notify (void)
return (0);
}
+void mutt_buffy (char *s, size_t slen)
+{
+ BUFFER *s_buf;
+
+ s_buf = mutt_buffer_pool_get ();
+
+ mutt_buffer_addstr (s_buf, NONULL (s));
+ mutt_buffer_buffy (s_buf);
+ strfcpy (s, mutt_b2s (s_buf), slen);
+
+ mutt_buffer_pool_release (&s_buf);
+}
+
/*
* mutt_buffy() -- incoming folders completion routine
*
* given a folder name, this routine gives the next incoming folder with new
* mail.
*/
-void mutt_buffy (char *s, size_t slen)
+void mutt_buffer_buffy (BUFFER *s)
{
BUFFY *tmp = Incoming;
int pass, found = 0;
- mutt_expand_path (s, slen);
+ mutt_buffer_expand_path (s);
if (mutt_buffy_check (0))
{
@@ -747,11 +760,11 @@ void mutt_buffy (char *s, size_t slen)
mutt_expand_path (tmp->path, sizeof (tmp->path));
if ((found || pass) && tmp->new)
{
- strfcpy (s, tmp->path, slen);
- mutt_pretty_mailbox (s, slen);
+ mutt_buffer_strcpy (s, tmp->path);
+ mutt_buffer_pretty_mailbox (s);
return;
}
- if (mutt_strcmp (s, tmp->path) == 0)
+ if (mutt_strcmp (mutt_b2s (s), tmp->path) == 0)
found = 1;
}
@@ -760,7 +773,7 @@ void mutt_buffy (char *s, size_t slen)
}
/* no folders with new mail */
- *s = '\0';
+ mutt_buffer_clear (s);
}
/* fetch buffy object for given path, if present */
diff --git a/buffy.h b/buffy.h
index 18be9de9..89091c9c 100644
--- a/buffy.h
+++ b/buffy.h
@@ -51,6 +51,13 @@ WHERE short BuffyCheckStatsInterval INITVAL (60);
extern time_t BuffyDoneTime; /* last time we knew for sure how much mail there was */
+void mutt_buffer_buffy (BUFFER *);
+void mutt_buffy (char *, size_t);
+
+int mutt_buffy_list (void);
+int mutt_buffy_check (int);
+int mutt_buffy_notify (void);
+
BUFFY *mutt_find_mailbox (const char *path);
void mutt_update_mailbox (BUFFY * b);
diff --git a/enter.c b/enter.c
index ecdb71ed..ccfdb4c7 100644
--- a/enter.c
+++ b/enter.c
@@ -26,6 +26,7 @@
#include "mutt_curses.h"
#include "keymap.h"
#include "history.h"
+#include "buffy.h"
#include <string.h>
diff --git a/protos.h b/protos.h
index 74af0c6a..eefc27ca 100644
--- a/protos.h
+++ b/protos.h
@@ -173,8 +173,6 @@ int mutt_bounce_message (FILE *fp, HEADER *, ADDRESS *);
void mutt_break_thread (HEADER *);
void mutt_browser_cleanup (void);
void mutt_buffer_concat_path (BUFFER *, const char *, const char *);
-void mutt_buffy (char *, size_t);
-int mutt_buffy_list (void);
void mutt_canonical_charset (char *, size_t, const char *);
void mutt_check_stats(void);
int mutt_count_body_parts (CONTEXT *, HEADER *);
@@ -295,8 +293,6 @@ void mutt_alias_delete_reverse (ALIAS *t);
int mutt_alloc_color (int fg, int bg);
int mutt_any_key_to_continue (const char *);
char *mutt_apply_replace (char *, size_t, char *, REPLACE_LIST *);
-int mutt_buffy_check (int);
-int mutt_buffy_notify (void);
int mutt_builtin_editor (const char *, HEADER *, HEADER *);
int mutt_can_decode (BODY *);
int mutt_change_flag (HEADER *, int);