* cosmetics
This commit is contained in:
@ -669,7 +669,8 @@ print_sexps (MuMsgIter *iter, gboolean threads, unsigned maxnum)
|
|||||||
|
|
||||||
|
|
||||||
static MuError
|
static MuError
|
||||||
save_part (MuMsg *msg, unsigned index, GSList *args, GError **err)
|
save_part (MuMsg *msg, unsigned docid,
|
||||||
|
unsigned index, GSList *args, GError **err)
|
||||||
{
|
{
|
||||||
gboolean rv;
|
gboolean rv;
|
||||||
const gchar *path;
|
const gchar *path;
|
||||||
@ -694,7 +695,7 @@ save_part (MuMsg *msg, unsigned index, GSList *args, GError **err)
|
|||||||
|
|
||||||
|
|
||||||
static MuError
|
static MuError
|
||||||
open_part (MuMsg *msg, unsigned index, GError **err)
|
open_part (MuMsg *msg, unsigned docid, unsigned index, GError **err)
|
||||||
{
|
{
|
||||||
char *targetpath;
|
char *targetpath;
|
||||||
gboolean rv;
|
gboolean rv;
|
||||||
@ -729,13 +730,14 @@ leave:
|
|||||||
|
|
||||||
|
|
||||||
static MuError
|
static MuError
|
||||||
temp_part (MuMsg *msg, unsigned index, GSList *args, GError **err)
|
temp_part (MuMsg *msg, unsigned docid, unsigned index, GSList *args,
|
||||||
|
GError **err)
|
||||||
{
|
{
|
||||||
const char *what, *param;
|
const char *what, *param;
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
GET_STRING_OR_ERROR_RETURN (args, "what", &what, err);
|
GET_STRING_OR_ERROR_RETURN (args, "what", &what, err);
|
||||||
GET_STRING_OR_ERROR_RETURN (args, "param", ¶m, err);
|
param = get_string_from_args (args, "param", TRUE, NULL);
|
||||||
|
|
||||||
path = mu_msg_part_get_cache_path (msg, MU_MSG_OPTION_NONE, index, err);
|
path = mu_msg_part_get_cache_path (msg, MU_MSG_OPTION_NONE, index, err);
|
||||||
if (!path)
|
if (!path)
|
||||||
@ -744,14 +746,24 @@ temp_part (MuMsg *msg, unsigned index, GSList *args, GError **err)
|
|||||||
path, index, err))
|
path, index, err))
|
||||||
print_and_clear_g_error (err);
|
print_and_clear_g_error (err);
|
||||||
else {
|
else {
|
||||||
gchar *escpath, *escparam;
|
gchar *escpath;
|
||||||
escpath = mu_str_escape_c_literal (path, FALSE);
|
escpath = mu_str_escape_c_literal (path, FALSE);
|
||||||
|
|
||||||
|
if (param) {
|
||||||
|
char *escparam;
|
||||||
escparam = mu_str_escape_c_literal (param, FALSE);
|
escparam = mu_str_escape_c_literal (param, FALSE);
|
||||||
print_expr ("(:temp \"%s\""
|
print_expr ("(:temp \"%s\""
|
||||||
" :what \"%s\""
|
" :what \"%s\""
|
||||||
" :param \"%s\")", escpath, what, escparam);
|
" :docid %u"
|
||||||
g_free (escpath);
|
" :param \"%s\""")",
|
||||||
|
escpath, what, docid, escparam);
|
||||||
g_free (escparam);
|
g_free (escparam);
|
||||||
|
} else
|
||||||
|
print_expr ("(:temp \"%s\" :what \"%s\" :docid %u)",
|
||||||
|
escpath, what, docid);
|
||||||
|
|
||||||
|
g_free (escpath);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (path);
|
g_free (path);
|
||||||
@ -803,9 +815,9 @@ cmd_extract (ServerContext *ctx, GSList *args, GError **err)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case SAVE: rv = save_part (msg, index, args, err); break;
|
case SAVE: rv = save_part (msg, docid, index, args, err); break;
|
||||||
case OPEN: rv = open_part (msg, index, err); break;
|
case OPEN: rv = open_part (msg, docid, index, err); break;
|
||||||
case TEMP: rv = temp_part (msg, index, args, err); break;
|
case TEMP: rv = temp_part (msg, docid, index, args, err); break;
|
||||||
default: print_error (MU_ERROR_INTERNAL, "unknown action");
|
default: print_error (MU_ERROR_INTERNAL, "unknown action");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user