#include <langinfo.h>
#endif
+#ifdef USE_NOTMUCH
+#include "mutt_notmuch.h"
+#endif
+
/* not possible to unget more than one char under some curses libs, and it
* is impossible to unget function keys in SLang, so roll our own input
* buffering routines.
_mutt_select_file (buf, blen, flags, files, numfiles);
*redraw = REDRAW_FULL;
}
- else if (flags & M_SEL_VFOLDER) {
- _mutt_select_file (buf, blen, flags, files, numfiles);
- *redraw = REDRAW_FULL;
- }
else
{
char *pc = safe_malloc (mutt_strlen (prompt) + 3);
buf[0] = 0;
MAYBE_REDRAW (*redraw);
FREE (&pc);
+#ifdef USE_NOTMUCH
+ if ((flags & M_SEL_VFOLDER) && buf[0] && strncmp(buf, "notmuch://", 10) != 0)
+ nm_description_to_path(buf, buf, blen);
+#endif
}
return 0;
break;
}
}
+#ifdef USE_NOTMUCH
+ else if (op == OP_MAIN_CHANGE_VFOLDER) {
+ mutt_enter_vfolder (cp, buf, sizeof (buf), &menu->redraw, 1);
+ if (!buf[0])
+ {
+ CLEARLINE (LINES-1);
+ break;
+ }
+ }
+#endif
else
{
mutt_buffy (buf, sizeof (buf));
break;
strncpy (buf, path, sizeof (buf));
} else
-#endif
-#ifdef USE_NOTMUCH
- if (op == OP_MAIN_CHANGE_VFOLDER)
- mutt_enter_vfolder (cp, buf, sizeof (buf), &menu->redraw, 1);
- else
#endif
if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
{
return NULL;
}
+int nm_description_to_path(const char *desc, char *buf, size_t bufsz)
+{
+ BUFFY *p;
+
+ if (!desc || !buf || !bufsz)
+ return -EINVAL;
+
+ for (p = VirtIncoming; p; p = p->next)
+ if (p->path && p->desc && strcmp(desc, p->desc) == 0) {
+ strncpy(buf, p->path, bufsz);
+ buf[bufsz - 1] = '\0';
+ return 0;
+ }
+
+ return -1;
+}
+
/*
* returns header from mutt context
*/
void nm_longrun_done(CONTEXT *cxt);
char *nm_get_description(CONTEXT *ctx);
+int nm_description_to_path(const char *desc, char *buf, size_t bufsz);
int nm_record_message(CONTEXT *ctx, char *path, HEADER *h);