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.
This commit is contained in:
@ -380,7 +380,6 @@ typedef struct _ServerContext ServerContext;
|
|||||||
|
|
||||||
typedef MuError (*CmdFunc) (ServerContext*,GSList*,GError**);
|
typedef MuError (*CmdFunc) (ServerContext*,GSList*,GError**);
|
||||||
|
|
||||||
|
|
||||||
/* 'add' adds a message to the database, and takes two parameters:
|
/* 'add' adds a message to the database, and takes two parameters:
|
||||||
* 'path', which is the full path to the message, and 'maildir', which
|
* 'path', which is the full path to the message, and 'maildir', which
|
||||||
* is the maildir this message lives in (e.g. "/inbox"). response with
|
* 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;
|
unsigned docid;
|
||||||
const char *maildir, *path;
|
const char *maildir, *path;
|
||||||
|
MuMsg *msg;
|
||||||
|
gchar *sexp;
|
||||||
|
|
||||||
GET_STRING_OR_ERROR_RETURN (args, "path", &path, err);
|
GET_STRING_OR_ERROR_RETURN (args, "path", &path, err);
|
||||||
GET_STRING_OR_ERROR_RETURN (args, "maildir", &maildir, err);
|
GET_STRING_OR_ERROR_RETURN (args, "maildir", &maildir, err);
|
||||||
@ -403,6 +404,15 @@ cmd_add (ServerContext *ctx, GSList *args, GError **err)
|
|||||||
gchar *escpath;
|
gchar *escpath;
|
||||||
escpath = mu_str_escape_c_literal (path, TRUE);
|
escpath = mu_str_escape_c_literal (path, TRUE);
|
||||||
print_expr ("(:info add :path %s :docid %u)", escpath, docid);
|
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);
|
g_free (escpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user