]> gitweb.ps.run Git - ps-cgit/blobdiff - cgit.c
Merge branch 'lh/about'
[ps-cgit] / cgit.c
diff --git a/cgit.c b/cgit.c
index cb1149d44189d17a13bbec97f8aa4f28c84c7f91..7b228af83046faef92602b0a74a6e1e6e58fea47 100644 (file)
--- a/cgit.c
+++ b/cgit.c
 
 const char *cgit_version = CGIT_VERSION;
 
+void add_mimetype(const char *name, const char *value)
+{
+       struct string_list_item *item;
+
+       item = string_list_insert(xstrdup(name), &ctx.cfg.mimetypes);
+       item->util = xstrdup(value);
+}
+
 struct cgit_filter *new_filter(const char *cmd, int extra_args)
 {
        struct cgit_filter *f;
@@ -66,6 +74,8 @@ void config_cb(const char *name, const char *value)
                        ctx.cfg.virtual_root = "";
        } else if (!strcmp(name, "nocache"))
                ctx.cfg.nocache = atoi(value);
+       else if (!strcmp(name, "noplainemail"))
+               ctx.cfg.noplainemail = atoi(value);
        else if (!strcmp(name, "noheader"))
                ctx.cfg.noheader = atoi(value);
        else if (!strcmp(name, "snapshots"))
@@ -122,6 +132,8 @@ void config_cb(const char *name, const char *value)
                ctx.cfg.clone_prefix = xstrdup(value);
        else if (!strcmp(name, "local-time"))
                ctx.cfg.local_time = atoi(value);
+       else if (!prefixcmp(name, "mimetype."))
+               add_mimetype(name + 9, value);
        else if (!strcmp(name, "repo.group"))
                ctx.cfg.repo_group = xstrdup(value);
        else if (!strcmp(name, "repo.url"))
@@ -240,6 +252,7 @@ static void prepare_context(struct cgit_context *ctx)
        ctx->page.modified = time(NULL);
        ctx->page.expires = ctx->page.modified;
        ctx->page.etag = NULL;
+       memset(&ctx->cfg.mimetypes, 0, sizeof(struct string_list));
 }
 
 struct refmatch {