From 2803b43f6391a4e163dd3de87c486632d28e50cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abd=C3=B3=20Roig-Maranges?= Date: Thu, 6 Dec 2012 19:16:36 +0100 Subject: [PATCH] Make cmd_add output update information This way, if a message changes, I can use add to force reindexing it, and notify mu4e about the changes. --- mu/mu-cmd-server.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mu/mu-cmd-server.c b/mu/mu-cmd-server.c index 0cfff7fb..b932b444 100644 --- a/mu/mu-cmd-server.c +++ b/mu/mu-cmd-server.c @@ -380,7 +380,6 @@ typedef struct _ServerContext ServerContext; typedef MuError (*CmdFunc) (ServerContext*,GSList*,GError**); - /* 'add' adds a message to the database, and takes two parameters: * 'path', which is the full path to the message, and 'maildir', which * is the maildir this message lives in (e.g. "/inbox"). response with @@ -392,6 +391,8 @@ cmd_add (ServerContext *ctx, GSList *args, GError **err) { unsigned docid; const char *maildir, *path; + MuMsg *msg; + gchar *sexp; GET_STRING_OR_ERROR_RETURN (args, "path", &path, err); GET_STRING_OR_ERROR_RETURN (args, "maildir", &maildir, err); @@ -403,6 +404,15 @@ cmd_add (ServerContext *ctx, GSList *args, GError **err) gchar *escpath; escpath = mu_str_escape_c_literal (path, TRUE); print_expr ("(:info add :path %s :docid %u)", escpath, docid); + + msg = mu_store_get_msg (ctx->store, docid, err); + if (msg) { + sexp = mu_msg_to_sexp (msg, docid, NULL, MU_MSG_OPTION_VERIFY); + print_expr ("(:update %s :move nil)", sexp); + + mu_msg_unref(msg); + g_free (sexp); + } g_free (escpath); }