server: maybe mark updates with :maybe-view

Don't updates messages when it's not needed, but don't use :view, since
it confuses mu4e's handlers.
This commit is contained in:
djcb 2018-08-18 11:37:31 +03:00
parent 6fd6d839d7
commit 16fa5d9a22
2 changed files with 13 additions and 15 deletions

View File

@ -258,11 +258,11 @@ get_bool_from_args (GHashTable *args, const char *param, gboolean optional,
}
#define GET_STRING_OR_ERROR_RETURN(ARGS,PARAM,SP,E) \
do { \
#define GET_STRING_OR_ERROR_RETURN(ARGS,PARAM,SP,E) \
do { \
*(SP) = get_string_from_args ((ARGS),(PARAM),FALSE,(E)); \
if (!(*(SP))) \
return MU_G_ERROR_CODE((E)); \
if (!(*(SP))) \
return MU_G_ERROR_CODE((E)); \
} while (0);
@ -1207,15 +1207,13 @@ do_move (MuStore *store, unsigned docid, MuMsg *msg, const char *maildir,
print_and_clear_g_error (err);
}
if (!no_view) {
sexp = mu_msg_to_sexp (msg, docid, NULL, MU_MSG_OPTION_VERIFY);
/* note, the :move t thing is a hint to the frontend that it
* could remove the particular header */
print_expr ("(:update %s :move %s :view %s)", sexp,
different_mdir ? "t" : "nil",
no_view ? "nil" : "t");
g_free (sexp);
}
sexp = mu_msg_to_sexp (msg, docid, NULL, MU_MSG_OPTION_VERIFY);
/* note, the :move t thing is a hint to the frontend that it
* could remove the particular header */
print_expr ("(:update %s :move %s :maybe-view %s)", sexp,
different_mdir ? "t" : "nil",
no_view ? "nil" : "t");
g_free (sexp);
return MU_OK;
}

View File

@ -193,10 +193,10 @@ The server output is as follows:
;; something got moved/flags changed
((plist-get sexp :update)
(funcall mu4e-update-func
(funcall mu4e-update-func
(plist-get sexp :update)
(plist-get sexp :move)
(plist-get sexp :view)))
(plist-get sexp :maybe-view)))
;; a message got removed
((plist-get sexp :remove)