httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject svn commit: r231187 - in /httpd/mod_mbox/trunk/module-2.0: mod_mbox.c mod_mbox.h mod_mbox_index.c
Date Wed, 10 Aug 2005 07:16:42 GMT
Author: jerenkrantz
Date: Wed Aug 10 00:16:37 2005
New Revision: 231187

URL: http://svn.apache.org/viewcvs?rev=231187&view=rev
Log:
Add mboxindexroot directive which adds in a 'site index' link to dir indexes.

Example:

MboxIndexRoot http://mail-archives.apache.org/mod_mbox/

* module-2.0/mod_mbox.h: Add in root_url to dir_config
* module-2.0/mod_mbox.c: Add mboxindexroot directive; set/merge root_url
* module-2.0/mod_mbox_index.c
  (show_list_info): Emit href with mboxindexroot value if present.

Modified:
    httpd/mod_mbox/trunk/module-2.0/mod_mbox.c
    httpd/mod_mbox/trunk/module-2.0/mod_mbox.h
    httpd/mod_mbox/trunk/module-2.0/mod_mbox_index.c

Modified: httpd/mod_mbox/trunk/module-2.0/mod_mbox.c
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/trunk/module-2.0/mod_mbox.c?rev=231187&r1=231186&r2=231187&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mod_mbox.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mod_mbox.c Wed Aug 10 00:16:37 2005
@@ -82,6 +82,7 @@
     dir_cfg *conf = apr_pcalloc(p, sizeof(dir_cfg));
 
     conf->enabled = 0;
+    conf->root_url = NULL;
     conf->search_path = NULL;
 
     return conf;
@@ -100,6 +101,16 @@
         to->enabled = from->enabled;
     }
 
+    if (merge->root_url != NULL) {
+        to->root_url = apr_pstrdup(p, merge->root_url);
+    }
+    else if (from->root_url != NULL) {
+        to->root_url = apr_pstrdup(p, from->root_url);
+    }
+    else {
+        to->root_url = NULL;
+    }
+
     if (merge->search_path != NULL) {
         to->search_path = apr_pstrdup(p, merge->search_path);
     }
@@ -116,7 +127,10 @@
 static const command_rec mbox_cmds[] ={
     AP_INIT_FLAG("mboxindex", ap_set_flag_slot,
                  (void *)APR_OFFSETOF(dir_cfg, enabled), OR_INDEXES,
-		 "Enable mod_mbox to create directory listings of .mbox files."),
+                 "Enable mod_mbox directory listings of .mbox files."),
+    AP_INIT_TAKE1("mboxindexroot", ap_set_string_slot,
+                 (void *)APR_OFFSETOF(dir_cfg, root_url), OR_INDEXES,
+                 "URL for site index (optional)"),
     AP_INIT_TAKE1("mboxsearch", ap_set_string_slot,
                  (void *)APR_OFFSETOF(dir_cfg, search_path), OR_INDEXES,
                  "Set the Directory that contains Search Data"),

Modified: httpd/mod_mbox/trunk/module-2.0/mod_mbox.h
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/trunk/module-2.0/mod_mbox.h?rev=231187&r1=231186&r2=231187&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mod_mbox.h (original)
+++ httpd/mod_mbox/trunk/module-2.0/mod_mbox.h Wed Aug 10 00:16:37 2005
@@ -69,6 +69,7 @@
 
 typedef struct dir_cfg {
     int enabled;
+    const char* root_url;
     const char* search_path;
 } dir_cfg;
 

Modified: httpd/mod_mbox/trunk/module-2.0/mod_mbox_index.c
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/trunk/module-2.0/mod_mbox_index.c?rev=231187&r1=231186&r2=231187&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mod_mbox_index.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mod_mbox_index.c Wed Aug 10 00:16:37 2005
@@ -37,6 +37,9 @@
     char dstr[APR_RFC822_DATE_LEN];
     char* list;
     char* domain;
+    dir_cfg *conf;
+
+    conf = ap_get_module_config(r->per_dir_config, &mbox_module);
 
     list = ESCAPE_OR_BLANK(r->pool, mli->list);
     domain = ESCAPE_OR_BLANK(r->pool, mli->domain);
@@ -49,10 +52,18 @@
              "link=\"#0000FF\" vlink=\"#000080\" alink=\"#FF0000\">\n",
              r);
 
-    ap_rprintf(r,
-               "<h2>%s@%s</h2>\n"
-               "<table style='text-align: left;'>\n",
-               list, domain);
+    if (conf->root_url) {
+        ap_rprintf(r,
+                   "<h2>%s@%s (<a href=\"%s\">Site Index</a>)</h2>\n"
+                   "<table style='text-align: left;'>\n",
+                   list, domain, conf->root_url);
+    }
+    else {
+        ap_rprintf(r,
+                   "<h2>%s@%s</h2>\n"
+                   "<table style='text-align: left;'>\n",
+                   list, domain);
+    }
 
     show_list_info_row(r, "Subscription address", "subscribe",
                        list, domain);



Mime
View raw message