aboutsummaryrefslogtreecommitdiff
path: root/src/triplet.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/triplet.c')
-rw-r--r--src/triplet.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/triplet.c b/src/triplet.c
index e060089..24ab611 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -481,7 +481,6 @@ fill_user_data (struct file_triplet *trp)
struct access_method *method = trp->spool->access_method[user_data_method];
char *text;
unsigned nrows, ncols;
- struct metadef def[5];
struct passwd *pw;
void *md;
@@ -498,10 +497,7 @@ fill_user_data (struct file_triplet *trp)
pw = getpwuid (TRIPLET_UID (trp));
if (!pw)
return;
- make_default_meta (def, pw->pw_name, trp->project);
- meta_escape (method, md, def);
- text = meta_expand_string (method->query, def, NULL);
- meta_free (def);
+ text = triplet_expand_method_query (method, md, trp);
rc = method_run (method, md, text);
free (text);
@@ -576,6 +572,30 @@ DECL_EXPAND_TIMER(system)
DECL_TIMER(name, user), \
DECL_TIMER(name, system)
+struct metadef triplet_default_meta[] = {
+ { "u", NULL, expand_user_name, NULL },
+ { "user", NULL, expand_user_name, NULL },
+ { "user:name", NULL, expand_user_name, NULL },
+ { "p", NULL, expand_project_base, NULL },
+ { "project", NULL, expand_project_base, NULL },
+ { "url", NULL, expand_url, NULL },
+ { "spool", NULL, expand_tag, NULL },
+ { "dir", NULL, expand_relative_dir, NULL },
+ { "dest-dir", NULL, expand_dest_dir, NULL },
+ { "source-dir", NULL, expand_source_dir, NULL },
+ { NULL }
+};
+
+char *
+triplet_expand_method_query (struct access_method *method, void *handle,
+ struct file_triplet *trp)
+{
+ char *p = meta_expand_string (method->query, triplet_default_meta, trp,
+ method, handle);
+ meta_free (triplet_default_meta);
+ return p;
+}
+
struct metadef triplet_meta[] = {
{ "project", NULL, expand_project_base, NULL },
{ "url", NULL, expand_url, NULL },
@@ -595,14 +615,14 @@ struct metadef triplet_meta[] = {
{ "report", NULL, expand_report, NULL },
DECL_FULL_TIMER(wydawca),
DECL_FULL_TIMER(triplet),
- DECL_FULL_TIMER(directory),
+ DECL_FULL_TIMER(spool),
{ NULL }
};
char *
triplet_expand_param (const char *tmpl, struct file_triplet *trp)
{
- char *p = meta_expand_string (tmpl, triplet_meta, trp);
+ char *p = meta_expand_string (tmpl, triplet_meta, trp, NULL, NULL);
meta_free (triplet_meta);
return p;
}

Return to:

Send suggestions and report system problems to the System administrator.