httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r729600 [3/3] - in /httpd/mod_mbox/trunk: ./ config/ m4/ module-2.0/ scripts/
Date Sat, 27 Dec 2008 05:27:53 GMT
Modified: httpd/mod_mbox/trunk/module-2.0/mod_mbox_out.c
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/mod_mbox_out.c?rev=729600&r1=729599&r2=729600&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mod_mbox_out.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mod_mbox_out.c Fri Dec 26 21:27:52 2008
@@ -1,18 +1,18 @@
-/* Copyright 2001-2005 The Apache Software Foundation or its licensors, as
-* applicable.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* This file contains all output functions.
  */
@@ -21,38 +21,38 @@
 
 /* Define local prototypes, even if functions are declared before
    they're called (avoid GCC warnings). */
-void display_atom_entry(request_rec *r, Message *m, const char* mboxfile,
+void display_atom_entry(request_rec *r, Message *m, const char *mboxfile,
                         apr_pool_t *pool, apr_file_t *f);
 void mbox_static_message_nav(request_rec *r, char **context,
-			     char *baseURI, char *msgID);
+                             char *baseURI, char *msgID);
 
 char *mbox_months[12][2] = {
-    { "Jan", "January"  },
-    { "Feb", "February" },
-    { "Mar", "March"    },
-    { "Apr", "April"    },
-    { "May", "May"      },
-    { "Jun", "June"     },
-    { "Jul", "July"     },
-    { "Aug", "August"   },
-    { "Sep", "September"},
-    { "Oct", "October"  },
-    { "Nov", "November" },
-    { "Dec", "December" }
+    {"Jan", "January"},
+    {"Feb", "February"},
+    {"Mar", "March"},
+    {"Apr", "April"},
+    {"May", "May"},
+    {"Jun", "June"},
+    {"Jul", "July"},
+    {"Aug", "August"},
+    {"Sep", "September"},
+    {"Oct", "October"},
+    {"Nov", "November"},
+    {"Dec", "December"}
 };
 
 /* Display an ATOM feed entry from given message structure */
-void display_atom_entry(request_rec *r, Message *m, const char* mboxfile,
+void display_atom_entry(request_rec *r, Message *m, const char *mboxfile,
                         apr_pool_t *pool, apr_file_t *f)
 {
     char dstr[100];
     apr_size_t dlen;
     apr_time_exp_t extime;
-    char* uid;
-    char* c;
+    char *uid;
+    char *c;
 
     ap_rputs("<entry>\n", r);
-    ap_rprintf(r, "<title>%s</title>\n",  ESCAPE_OR_BLANK(pool, m->subject));
+    ap_rprintf(r, "<title>%s</title>\n", ESCAPE_OR_BLANK(pool, m->subject));
     ap_rprintf(r, "<author><name>%s</name></author>\n",
                ESCAPE_OR_BLANK(pool, m->from));
 
@@ -74,45 +74,44 @@
 
     apr_time_exp_gmt(&extime, m->date);
 
-    apr_strftime(dstr, &dlen, sizeof(dstr),
-                 "%G-%m-%dT%H:%M:%SZ", &extime);
+    apr_strftime(dstr, &dlen, sizeof(dstr), "%G-%m-%dT%H:%M:%SZ", &extime);
 
     ap_rprintf(r, "<updated>%s</updated>\n", dstr);
     ap_rputs("<content type=\"xhtml\">\n"
-             "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n"
-             "<pre>\n", r);
+             "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n" "<pre>\n", r);
 
     load_message(pool, f, m);
     /* Parse multipart information */
     m->mime_msg = mbox_mime_decode_multipart(pool, m->raw_body,
-					     m->content_type,
-					     m->cte, m->boundary);
+                                             m->content_type,
+                                             m->cte, m->boundary);
 
-    ap_rprintf(r, "%s", mbox_wrap_text(mbox_mime_get_body(pool, m->mime_msg)));
+    ap_rprintf(r, "%s",
+               mbox_wrap_text(mbox_mime_get_body(pool, m->mime_msg)));
 
     ap_rputs("\n</pre>\n</div>\n</content>\n", r);
     ap_rputs("</entry>\n", r);
 }
 
-static int mbox2atom(request_rec *r, const char* mboxfile, mbox_cache_info *mli, int max)
+static int mbox2atom(request_rec *r, const char *mboxfile,
+                     mbox_cache_info *mli, int max)
 {
     apr_status_t rv;
-    char* filename;
-    char* origfilename;
+    char *filename;
+    char *origfilename;
     apr_file_t *f;
     MBOX_LIST *head;
     Message *m;
     int i;
-    apr_pool_t* tpool;
+    apr_pool_t *tpool;
 
     apr_pool_create(&tpool, r->pool);
 
     filename = apr_pstrcat(r->pool, r->filename, mboxfile, NULL);
 
-    rv = apr_file_open(&f, filename, APR_READ,
-                       APR_OS_DEFAULT, r->pool);
+    rv = apr_file_open(&f, filename, APR_READ, APR_OS_DEFAULT, r->pool);
 
-    if(rv != APR_SUCCESS) {
+    if (rv != APR_SUCCESS) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
                       "mod_mbox(mbox2atom): Can't open mbox '%s' for atom feed",
                       filename);
@@ -128,7 +127,7 @@
     head = mbox_sort_list(head, MBOX_SORT_REVERSE_DATE);
 
     for (i = 0; i < max && head != NULL; i++) {
-        m = (Message*)head->value;
+        m = (Message *) head->value;
         display_atom_entry(r, m, mboxfile, tpool, f);
         head = head->next;
         apr_pool_clear(tpool);
@@ -150,12 +149,14 @@
         return;
     }
 
-    fi = (mbox_file_t *)files->elts;
+    fi = (mbox_file_t *) files->elts;
     for (i = 0; i < files->nelts && entries < MBOX_ATOM_NUM_ENTRIES; i++) {
         if (!fi[i].count) {
             continue;
         }
-        entries += mbox2atom(r, fi[i].filename, mli, MBOX_ATOM_NUM_ENTRIES - entries);
+        entries +=
+            mbox2atom(r, fi[i].filename, mli,
+                      MBOX_ATOM_NUM_ENTRIES - entries);
     }
 }
 
@@ -181,15 +182,15 @@
         return HTTP_NOT_FOUND;
     }
 
-    k = k-6;
+    k = k - 6;
     *k = 0;
 
     /* Open mbox cache */
     rv = mbox_cache_get(&mli, path, r->pool);
     if (rv != APR_SUCCESS) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
-                       "mod_mbox(xml_boxlist): Can't open directory cache '%s' for index",
-                       r->filename);
+                      "mod_mbox(xml_boxlist): Can't open directory cache '%s' for index",
+                      r->filename);
         return HTTP_FORBIDDEN;
     }
 
@@ -201,13 +202,13 @@
     ap_rputs("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", r);
     ap_rputs("<boxlist>\n", r);
 
-    fi = (mbox_file_t *)files->elts;
+    fi = (mbox_file_t *) files->elts;
 
     for (i = 0; i < files->nelts; i++) {
         if (fi[i].count || !conf->hide_empty) {
-	    ap_rprintf(r, "<mbox id=\"%s\" count=\"%d\" />\n",
+            ap_rprintf(r, "<mbox id=\"%s\" count=\"%d\" />\n",
                        fi[i].filename, fi[i].count);
-	}
+        }
     }
 
     ap_rputs("</boxlist>\n", r);
@@ -239,15 +240,15 @@
     }
 
     /* Roll back before the '/YYYYMM' part of the filename */
-    k = k-7;
+    k = k - 7;
     *k = 0;
 
     /* Open mbox cache */
     rv = mbox_cache_get(&mli, path, r->pool);
     if (rv != APR_SUCCESS) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
-                       "mod_mbox(static_boxlist): Can't open directory cache '%s' for index",
-                       path);
+                      "mod_mbox(static_boxlist): Can't open directory cache '%s' for index",
+                      path);
         return HTTP_FORBIDDEN;
     }
 
@@ -257,32 +258,36 @@
     }
 
     ap_rputs("  <table id=\"boxlist\">\n", r);
-    ap_rputs("   <thead><tr><th colspan=\"2\">Box list</th></tr></thead>\n", r);
+    ap_rputs("   <thead><tr><th colspan=\"2\">Box list</th></tr></thead>\n",
+             r);
     ap_rputs("   <tbody>\n", r);
 
-    fi = (mbox_file_t *)files->elts;
+    fi = (mbox_file_t *) files->elts;
 
-    for (i=0 ; i < files->nelts; i++) {
+    for (i = 0; i < files->nelts; i++) {
         if (fi[i].count || !conf->hide_empty) {
-	    if (strcmp(k+1, fi[i].filename) == 0) {
-	        ap_rputs("   <tr id=\"boxactive\">", r);
-	    }
-	    else {
-	        ap_rputs("   <tr>", r);
-	    }
-
-	    ap_rprintf(r, "    <td class=\"box\"><a href=\"%s/%s%s\" title=\"Browse %s %.4s archives\">"
-		       "%s %.4s</a></td><td class=\"msgcount\">%d</td>\n",
-		       base_path, fi[i].filename, r->path_info,
-		       mbox_months[atoi(apr_pstrndup(r->pool,
-						     fi[i].filename+4, 2)) - 1][1],
-		       fi[i].filename,
- 		       mbox_months[atoi(apr_pstrndup(r->pool,
-						     fi[i].filename+4, 2)) - 1][0],
-		       fi[i].filename, fi[i].count);
+            if (strcmp(k + 1, fi[i].filename) == 0) {
+                ap_rputs("   <tr id=\"boxactive\">", r);
+            }
+            else {
+                ap_rputs("   <tr>", r);
+            }
+
+            ap_rprintf(r,
+                       "    <td class=\"box\"><a href=\"%s/%s%s\" title=\"Browse %s %.4s archives\">"
+                       "%s %.4s</a></td><td class=\"msgcount\">%d</td>\n",
+                       base_path, fi[i].filename, r->path_info,
+                       mbox_months[atoi
+                                   (apr_pstrndup
+                                    (r->pool, fi[i].filename + 4, 2)) - 1][1],
+                       fi[i].filename,
+                       mbox_months[atoi
+                                   (apr_pstrndup
+                                    (r->pool, fi[i].filename + 4, 2)) - 1][0],
+                       fi[i].filename, fi[i].count);
 
-	    ap_rputs("   </tr>\n", r);
-	}
+            ap_rputs("   </tr>\n", r);
+        }
     }
 
     ap_rputs("   </tbody>\n", r);
@@ -293,7 +298,7 @@
 
 /* Outputs an XHTML list of available mailboxes */
 apr_status_t mbox_static_index_boxlist(request_rec *r, mbox_dir_cfg_t *conf,
-				       mbox_cache_info *mli)
+                                       mbox_cache_info *mli)
 {
     mbox_file_t *fi;
     apr_array_header_t *files;
@@ -306,63 +311,65 @@
 
     ap_rputs("  <table id=\"grid\">\n", r);
 
-    fi = (mbox_file_t *)files->elts;
+    fi = (mbox_file_t *) files->elts;
 
-    for (i=0; i < files->nelts; i++) {
+    for (i = 0; i < files->nelts; i++) {
         /* Only display an entry if it has messages or if we don't
-	   hide empty mailboxes */
+           hide empty mailboxes */
         if (fi[i].count || !conf->hide_empty) {
-	    if (!year_hdr) {
-	        if (!side) {
-		    ap_rputs("  <tr><td class=\"left\">\n", r);
-		    side = 1;
-		}
-		else {
-		    ap_rputs("  <td class=\"right\">\n", r);
-		    side = 0;
-		}
-
-		ap_rputs("   <table class=\"year\">\n", r);
-		ap_rputs("    <thead><tr>\n", r);
-		ap_rprintf(r, "     <th colspan=\"3\">Year %.4s</th>\n",
-			   fi[i].filename);
-		ap_rputs("    </tr></thead>\n", r);
-		ap_rputs("    <tbody>\n", r);
-
-		year_hdr = 1;
-	    }
-
-	    ap_rputs("    <tr>\n", r);
-	    ap_rprintf(r, "     <td class=\"date\">%s %.4s</td>\n",
-		       mbox_months[atoi(apr_pstrndup(r->pool,
-                                                     fi[i].filename+4, 2)) - 1][0],
-		       fi[i].filename);
-	    ap_rprintf(r, "     <td class=\"links\"><span class=\"links\" id=\"%.4s%.2s\">"
-		       "<a href=\"%.4s%.2s.mbox/thread\">Thread</a>"
-		       " &middot; <a href=\"%.4s%.2s.mbox/date\">Date</a>"
-		       " &middot; <a href=\"%.4s%.2s.mbox/author\">Author</a></span></td>\n",
-		       fi[i].filename, fi[i].filename+4,
-		       fi[i].filename, fi[i].filename+4,
-		       fi[i].filename, fi[i].filename+4,
-		       fi[i].filename, fi[i].filename+4);
-	    ap_rprintf(r, "     <td class=\"msgcount\">%d</td>\n", fi[i].count);
-	    ap_rputs("    </tr>\n", r);
-	}
-
-	/* Year separation */
-	if ((fi[i+1].filename && year_hdr) &&
-	    (fi[i].filename[3] != fi[i+1].filename[3])) {
-	    ap_rputs("    </tbody>\n", r);
-	    ap_rputs("   </table>\n", r);
-	    if (side) {
-	        ap_rputs("  </td>\n", r);
-	    }
-	    else {
-	        ap_rputs("  </td></tr>\n\n", r);
-	    }
+            if (!year_hdr) {
+                if (!side) {
+                    ap_rputs("  <tr><td class=\"left\">\n", r);
+                    side = 1;
+                }
+                else {
+                    ap_rputs("  <td class=\"right\">\n", r);
+                    side = 0;
+                }
+
+                ap_rputs("   <table class=\"year\">\n", r);
+                ap_rputs("    <thead><tr>\n", r);
+                ap_rprintf(r, "     <th colspan=\"3\">Year %.4s</th>\n",
+                           fi[i].filename);
+                ap_rputs("    </tr></thead>\n", r);
+                ap_rputs("    <tbody>\n", r);
+
+                year_hdr = 1;
+            }
+
+            ap_rputs("    <tr>\n", r);
+            ap_rprintf(r, "     <td class=\"date\">%s %.4s</td>\n",
+                       mbox_months[atoi(apr_pstrndup(r->pool,
+                                                     fi[i].filename + 4,
+                                                     2)) - 1][0],
+                       fi[i].filename);
+            ap_rprintf(r,
+                       "     <td class=\"links\"><span class=\"links\" id=\"%.4s%.2s\">"
+                       "<a href=\"%.4s%.2s.mbox/thread\">Thread</a>"
+                       " &middot; <a href=\"%.4s%.2s.mbox/date\">Date</a>"
+                       " &middot; <a href=\"%.4s%.2s.mbox/author\">Author</a></span></td>\n",
+                       fi[i].filename, fi[i].filename + 4, fi[i].filename,
+                       fi[i].filename + 4, fi[i].filename, fi[i].filename + 4,
+                       fi[i].filename, fi[i].filename + 4);
+            ap_rprintf(r, "     <td class=\"msgcount\">%d</td>\n",
+                       fi[i].count);
+            ap_rputs("    </tr>\n", r);
+        }
+
+        /* Year separation */
+        if ((fi[i + 1].filename && year_hdr) &&
+            (fi[i].filename[3] != fi[i + 1].filename[3])) {
+            ap_rputs("    </tbody>\n", r);
+            ap_rputs("   </table>\n", r);
+            if (side) {
+                ap_rputs("  </td>\n", r);
+            }
+            else {
+                ap_rputs("  </td></tr>\n\n", r);
+            }
 
-	    year_hdr = 0;
-	}
+            year_hdr = 0;
+        }
     }
 
     ap_rputs("    </tbody>\n", r);
@@ -399,10 +406,10 @@
     }
 
     /* Wipe out at most three chars preceding the '@' sign */
-    for (i=0 ; i<3 ; i++) {
+    for (i = 0; i < 3; i++) {
         if ((atsign - i) > ltsign) {
-	    email[atsign - i] = '.';
-	}
+            email[atsign - i] = '.';
+        }
     }
 
     return email;
@@ -410,7 +417,7 @@
 
 /* Display an XHTML message list entry */
 static void display_static_msglist_entry(request_rec *r, Message *m,
-					 int linked, int depth)
+                                         int linked, int depth)
 {
     mbox_dir_cfg_t *conf;
 
@@ -432,29 +439,30 @@
         ap_rprintf(r, "    <td class=\"author\">%s</td>\n", from);
     }
     else {
-      ap_rputs("    <td class=\"author\"></td>\n", r);
+        ap_rputs("    <td class=\"author\"></td>\n", r);
     }
 
     /* Subject, linked or not */
     ap_rputs("     <td class=\"subject\">", r);
-    for (i=0 ; i < depth ; i++) {
+    for (i = 0; i < depth; i++) {
         ap_rputs("&nbsp;&nbsp;", r);
     }
 
     if (linked) {
-        ap_rprintf(r, "<a href=\"%s\">", URI_ESCAPE_OR_BLANK(r->pool, m->msgID));
+        ap_rprintf(r, "<a href=\"%s\">",
+                   URI_ESCAPE_OR_BLANK(r->pool, m->msgID));
     }
 
     ap_rprintf(r, "%s", ESCAPE_OR_BLANK(r->pool, m->subject));
     if (linked) {
-        ap_rputs("</a>" , r);
+        ap_rputs("</a>", r);
     }
     ap_rputs("     </td>\n", r);
 
     /* Message date */
     if (linked) {
         ap_rprintf(r, "    <td class=\"date\">%s</td>\n",
-		   ESCAPE_OR_BLANK(r->pool, m->str_date));
+                   ESCAPE_OR_BLANK(r->pool, m->str_date));
     }
     else {
         ap_rputs("    <td class=\"date\"></td>\n", r);
@@ -465,7 +473,7 @@
 
 /* Display an XML message list entry */
 static void display_xml_msglist_entry(request_rec *r, Message *m,
-				      int linked, int depth)
+                                      int linked, int depth)
 {
     mbox_dir_cfg_t *conf;
 
@@ -480,18 +488,20 @@
     }
 
     ap_rprintf(r, " <message linked=\"%d\" depth=\"%d\" id=\"%s\">\n",
-	       linked, depth, URI_ESCAPE_OR_BLANK(r->pool, m->msgID));
+               linked, depth, URI_ESCAPE_OR_BLANK(r->pool, m->msgID));
 
     ap_rprintf(r, "  <from><![CDATA[%s]]></from>\n", from);
-    ap_rprintf(r, "  <date><![CDATA[%s]]></date>\n", ESCAPE_OR_BLANK(r->pool, m->str_date));
+    ap_rprintf(r, "  <date><![CDATA[%s]]></date>\n",
+               ESCAPE_OR_BLANK(r->pool, m->str_date));
 
-    ap_rprintf(r, "  <subject><![CDATA[%s]]></subject>\n", ESCAPE_OR_BLANK(r->pool, m->subject));
+    ap_rprintf(r, "  <subject><![CDATA[%s]]></subject>\n",
+               ESCAPE_OR_BLANK(r->pool, m->subject));
     ap_rprintf(r, " </message>\n");
 }
 
 /* Display a threaded message list for Container 'c' */
 static void display_msglist_thread(request_rec *r, Container *c,
-				   int depth, int mode)
+                                   int depth, int mode)
 {
     Message *m;
     int linked = 1;
@@ -506,7 +516,7 @@
     }
     else {
         m = c->child->message;
-	linked = 0;
+        linked = 0;
     }
 
     if (mode == MBOX_OUTPUT_STATIC) {
@@ -520,7 +530,7 @@
      * Subject
      *  +-> Re: Subject */
     if (c->child) {
-        display_msglist_thread(r, c->child, depth+1, mode);
+        display_msglist_thread(r, c->child, depth + 1, mode);
     }
 
     /* Display follow-ups :
@@ -543,16 +553,16 @@
     Message *m;
     Container *threads = NULL, *c;
 
-    int current_page = 0;  /* Current page number, starting at 0 */
-    int pages;             /* Number of pages */
-    int count = 0;         /* Message count */
+    int current_page = 0;       /* Current page number, starting at 0 */
+    int pages;                  /* Number of pages */
+    int count = 0;              /* Message count */
     int i = 0;
 
     conf = ap_get_module_config(r->per_dir_config, &mbox_module);
 
     /* Fetch page number if present. Otherwise, assume page #1 */
     if (r->args && strcmp(r->args, ""))
-      current_page = atoi(r->args);
+        current_page = atoi(r->args);
 
     /* Load the index of messages from the DB into the MBOX_LIST */
     head = mbox_load_index(r, f, &count);
@@ -560,24 +570,24 @@
     /* Compute the page count, depending on the sort flags */
     if (sortFlags != MBOX_SORT_THREAD) {
         pages = count / DEFAULT_MSGS_PER_PAGE;
-	if (count > pages * DEFAULT_MSGS_PER_PAGE) {
-	    pages++;
-	}
+        if (count > pages * DEFAULT_MSGS_PER_PAGE) {
+            pages++;
+        }
     }
     else {
-	threads = calculate_threads(r->pool, head);
-	c = threads;
-	count = 0;
-
-	while (c) {
-	    c = c->next;
-	    count++;
-	}
+        threads = calculate_threads(r->pool, head);
+        c = threads;
+        count = 0;
+
+        while (c) {
+            c = c->next;
+            count++;
+        }
 
         pages = count / DEFAULT_THREADS_PER_PAGE;
-	if (count > pages * DEFAULT_THREADS_PER_PAGE) {
-	    pages++;
-	}
+        if (count > pages * DEFAULT_THREADS_PER_PAGE) {
+            pages++;
+        }
     }
 
     /* This index only changes when the .mbox file changes. */
@@ -587,46 +597,45 @@
 
     /* Send page header */
     ap_rputs("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", r);
-    ap_rprintf(r, "<index page=\"%d\" pages=\"%d\">\n",
-	       current_page, pages);
+    ap_rprintf(r, "<index page=\"%d\" pages=\"%d\">\n", current_page, pages);
 
     /* For date and author sorts */
     if (sortFlags != MBOX_SORT_THREAD) {
         /* Sort the list */
         head = mbox_sort_list(head, sortFlags);
 
-	/* Pass useless messages */
-	while (head && (i < current_page * DEFAULT_MSGS_PER_PAGE)) {
-	    head = head->next;
-	    i++;
-	}
-
-	/* Display current_page's messages */
-	while (head && (i < (current_page + 1) * DEFAULT_MSGS_PER_PAGE)) {
-	    m = (Message*)head->value;
-	    display_xml_msglist_entry(r, m, 1, 0);
-
-	    head = head->next;
-	    i++;
-	}
+        /* Pass useless messages */
+        while (head && (i < current_page * DEFAULT_MSGS_PER_PAGE)) {
+            head = head->next;
+            i++;
+        }
+
+        /* Display current_page's messages */
+        while (head && (i < (current_page + 1) * DEFAULT_MSGS_PER_PAGE)) {
+            m = (Message *) head->value;
+            display_xml_msglist_entry(r, m, 1, 0);
+
+            head = head->next;
+            i++;
+        }
     }
 
     /* For threaded view */
     else {
         c = threads;
 
-	/* Pass useless threads */
-	while (c && (i < current_page * DEFAULT_THREADS_PER_PAGE)) {
-	    c = c->next;
-	    i++;
-	}
-
-	/* Display current_page's threads */
-	while (c && (i < (current_page + 1) * DEFAULT_THREADS_PER_PAGE)) {
-	    display_msglist_thread(r, c, 0, MBOX_OUTPUT_AJAX);
-	    c = c->next;
-	    i++;
-	}
+        /* Pass useless threads */
+        while (c && (i < current_page * DEFAULT_THREADS_PER_PAGE)) {
+            c = c->next;
+            i++;
+        }
+
+        /* Display current_page's threads */
+        while (c && (i < (current_page + 1) * DEFAULT_THREADS_PER_PAGE)) {
+            display_msglist_thread(r, c, 0, MBOX_OUTPUT_AJAX);
+            c = c->next;
+            i++;
+        }
     }
 
     ap_rputs("</index>", r);
@@ -639,7 +648,7 @@
  * FIXME: improve the algorithm in order to handle long pages list.
  */
 static void mbox_static_msglist_page_selector(request_rec *r, char *baseURI,
-					      int pages, int current_page)
+                                              int pages, int current_page)
 {
     int i;
 
@@ -650,35 +659,37 @@
     }
 
     if (current_page) {
-      ap_rprintf(r, "<a href=\"%s%s?%d\">&laquo; Previous</a> &middot; ",
-		 baseURI, r->path_info, current_page-1);
+        ap_rprintf(r, "<a href=\"%s%s?%d\">&laquo; Previous</a> &middot; ",
+                   baseURI, r->path_info, current_page - 1);
     }
 
     for (i = 0; i < pages; i++) {
         if (i != 0) {
-	    ap_rputs(" &middot; ", r);
-	}
+            ap_rputs(" &middot; ", r);
+        }
 
-	if (i != current_page) {
-	    ap_rprintf(r, "<a href=\"%s%s?%d\">%d</a>",
-		       baseURI, r->path_info, i, i+1);
-	}
-	else {
-	  ap_rprintf(r, "%d", i+1);
-	}
+        if (i != current_page) {
+            ap_rprintf(r, "<a href=\"%s%s?%d\">%d</a>",
+                       baseURI, r->path_info, i, i + 1);
+        }
+        else {
+            ap_rprintf(r, "%d", i + 1);
+        }
     }
 
-    if (current_page+1 < pages) {
-      ap_rprintf(r, " &middot; <a href=\"%s%s?%d\">Next &raquo;</a>",
-		 baseURI, r->path_info, current_page+1);
+    if (current_page + 1 < pages) {
+        ap_rprintf(r, " &middot; <a href=\"%s%s?%d\">Next &raquo;</a>",
+                   baseURI, r->path_info, current_page + 1);
     }
 }
 
-apr_status_t mbox_static_msglist_nav(request_rec *r, char *baseURI,
-                                     int pages, int current_page,
-                                     int sortFlags)
+static void mbox_static_msglist_nav(request_rec *r, char *baseURI,
+                                    int pages, int current_page,
+                                    int sortFlags)
 {
-    ap_rputs("   <tr><th class=\"title\"><a href=\"browser\">Message list</a></th>", r);
+    ap_rputs
+        ("   <tr><th class=\"title\"><a href=\"browser\">Message list</a></th>",
+         r);
 
     ap_rputs("<th class=\"pages\">", r);
     mbox_static_msglist_page_selector(r, baseURI, pages, current_page);
@@ -687,27 +698,25 @@
     ap_rputs("<th class=\"sort\">", r);
     if (sortFlags == MBOX_SORT_THREAD) {
         ap_rprintf(r, "Thread &middot; "
-		   "<a href=\"%s/author\">Author</a> &middot; "
-		   "<a href=\"%s/date\">Date</a>",
-		   baseURI, baseURI);
+                   "<a href=\"%s/author\">Author</a> &middot; "
+                   "<a href=\"%s/date\">Date</a>", baseURI, baseURI);
     }
     else if (sortFlags == MBOX_SORT_AUTHOR) {
         ap_rprintf(r, "<a href=\"%s/thread\">Thread</a> &middot; "
-		   "Author &middot; "
-		   "<a href=\"%s/date\">Date</a>",
-		   baseURI, baseURI);
+                   "Author &middot; "
+                   "<a href=\"%s/date\">Date</a>", baseURI, baseURI);
     }
     else {
         ap_rprintf(r, "<a href=\"%s/thread\">Thread</a> &middot; "
-		   "<a href=\"%s/author\">Author</a> &middot; "
-		   "Date",
-		   baseURI, baseURI);
+                   "<a href=\"%s/author\">Author</a> &middot; "
+                   "Date", baseURI, baseURI);
     }
     ap_rputs("</th></tr>\n", r);
 }
 
 /* Display the XHTML index of the specified mbox file. */
-apr_status_t mbox_static_msglist(request_rec *r, apr_file_t *f, int sortFlags)
+apr_status_t mbox_static_msglist(request_rec *r, apr_file_t *f,
+                                 int sortFlags)
 {
     apr_finfo_t fi;
 
@@ -716,9 +725,9 @@
     Message *m;
     Container *threads = NULL, *c;
 
-    int current_page = 0;  /* Current page number, starting at 0 */
-    int pages;             /* Total number of pages */
-    int count = 0;         /* Message count */
+    int current_page = 0;       /* Current page number, starting at 0 */
+    int pages;                  /* Total number of pages */
+    int count = 0;              /* Message count */
     int i = 0;
 
     char *baseURI;
@@ -731,7 +740,7 @@
 
     /* Fetch page number if present. Otherwise, assume page #1 */
     if (r->args && strcmp(r->args, ""))
-      current_page = atoi(r->args);
+        current_page = atoi(r->args);
 
     /* Load the index of messages from the DB into the MBOX_LIST */
     head = mbox_load_index(r, f, &count);
@@ -739,24 +748,24 @@
     /* Compute the page count, depending on the sort flags */
     if (sortFlags != MBOX_SORT_THREAD) {
         pages = count / DEFAULT_MSGS_PER_PAGE;
-	if (count > pages * DEFAULT_MSGS_PER_PAGE) {
-	    pages++;
-	}
+        if (count > pages * DEFAULT_MSGS_PER_PAGE) {
+            pages++;
+        }
     }
     else {
-	threads = calculate_threads(r->pool, head);
-	c = threads;
-	count = 0;
-
-	while (c) {
-	    c = c->next;
-	    count++;
-	}
+        threads = calculate_threads(r->pool, head);
+        c = threads;
+        count = 0;
+
+        while (c) {
+            c = c->next;
+            count++;
+        }
 
         pages = count / DEFAULT_THREADS_PER_PAGE;
-	if (count > pages * DEFAULT_THREADS_PER_PAGE) {
-	    pages++;
-	}
+        if (count > pages * DEFAULT_THREADS_PER_PAGE) {
+            pages++;
+        }
     }
 
     /* This index only changes when the .mbox file changes. */
@@ -768,9 +777,11 @@
     filename = strrchr(r->filename, '/');
     if (filename &&
         apr_fnmatch("[0-9][0-9][0-9][0-9][0-9][0-9].mbox", filename + 1, 0)
-            == APR_SUCCESS) {
+        == APR_SUCCESS) {
         month = mbox_months[atoi(apr_pstrndup(r->pool, baseURI +
-            (strlen(baseURI) - strlen(".mbox") - 2), 2)) - 1][1];
+                                              (strlen(baseURI) -
+                                               strlen(".mbox") - 2),
+                                              2)) - 1][1];
         year = baseURI + (strlen(baseURI) - strlen(".mbox") - 6);
     }
     else {
@@ -780,19 +791,21 @@
 
     /* Send page header */
     ap_rputs("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", r);
-    ap_rputs("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n", r);
+    ap_rputs("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n",
+             r);
     ap_rputs("\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\n", r);
 
     ap_rputs("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n", r);
     ap_rputs(" <head>\n", r);
     ap_rputs("  <meta http-equiv=\"Content-Type\" "
-	     "content=\"text/html; charset=utf-8\" />\n", r);
+             "content=\"text/html; charset=utf-8\" />\n", r);
     ap_rprintf(r, "  <title>Mailing list archives: %s %.4s</title>\n",
                month, year);
 
     if (conf->style_path) {
-        ap_rprintf(r, "  <link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" />\n",
-		   conf->style_path);
+        ap_rprintf(r,
+                   "  <link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" />\n",
+                   conf->style_path);
     }
 
     ap_rputs(" </head>\n\n", r);
@@ -805,12 +818,11 @@
 
     if (conf->root_path) {
         ap_rprintf(r, "<a href=\"%s\" title=\"Back to the archives depot\">"
-		   "Site index</a> &middot; ",
-		   conf->root_path);
+                   "Site index</a> &middot; ", conf->root_path);
     }
 
     ap_rprintf(r, "<a href=\"%s\" title=\"Back to the list index\">"
-	       "List index</a></h5>", get_base_path(r));
+               "List index</a></h5>", get_base_path(r));
 
     ap_rputs("  <table id=\"msglist\">\n", r);
     ap_rputs("  <thead>\n", r);
@@ -824,38 +836,38 @@
         /* Sort the list */
         head = mbox_sort_list(head, sortFlags);
 
-	/* Pass useless messages */
-	while (head && (i < current_page * DEFAULT_MSGS_PER_PAGE)) {
-	    head = head->next;
-	    i++;
-	}
-
-	/* Display current_page's messages */
-	while (head && (i < (current_page + 1) * DEFAULT_MSGS_PER_PAGE)) {
-	    m = (Message*)head->value;
-	    display_static_msglist_entry(r, m, 1, 0);
-
-	    head = head->next;
-	    i++;
-	}
+        /* Pass useless messages */
+        while (head && (i < current_page * DEFAULT_MSGS_PER_PAGE)) {
+            head = head->next;
+            i++;
+        }
+
+        /* Display current_page's messages */
+        while (head && (i < (current_page + 1) * DEFAULT_MSGS_PER_PAGE)) {
+            m = (Message *) head->value;
+            display_static_msglist_entry(r, m, 1, 0);
+
+            head = head->next;
+            i++;
+        }
     }
 
     /* For threaded view */
     else {
         c = threads;
 
-	/* Pass useless threads */
-	while (c && (i < current_page * DEFAULT_THREADS_PER_PAGE)) {
-	    c = c->next;
-	    i++;
-	}
-
-	/* Display current_page's threads */
-	while (c && (i < (current_page + 1) * DEFAULT_THREADS_PER_PAGE)) {
-	    display_msglist_thread(r, c, 0, MBOX_OUTPUT_STATIC);
-	    c = c->next;
-	    i++;
-	}
+        /* Pass useless threads */
+        while (c && (i < current_page * DEFAULT_THREADS_PER_PAGE)) {
+            c = c->next;
+            i++;
+        }
+
+        /* Display current_page's threads */
+        while (c && (i < (current_page + 1) * DEFAULT_THREADS_PER_PAGE)) {
+            display_msglist_thread(r, c, 0, MBOX_OUTPUT_STATIC);
+            c = c->next;
+            i++;
+        }
     }
 
     ap_rputs("   </tbody>\n", r);
@@ -884,46 +896,51 @@
     ap_set_content_type(r, "text/html; charset=utf-8");
 
     ap_rputs("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", r);
-    ap_rputs("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n", r);
+    ap_rputs("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n",
+             r);
     ap_rputs("\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\n", r);
 
     ap_rputs("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n", r);
     ap_rputs(" <head>\n", r);
     ap_rputs("  <meta http-equiv=\"Content-Type\" "
-	     "content=\"text/html; charset=utf-8\" />\n", r);
+             "content=\"text/html; charset=utf-8\" />\n", r);
     ap_rputs("  <title>Mailing list archives</title>\n", r);
 
     if (conf->style_path) {
-        ap_rprintf(r, "   <link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" />\n",
-		   conf->style_path);
+        ap_rprintf(r,
+                   "   <link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" />\n",
+                   conf->style_path);
     }
 
     if (conf->script_path) {
-        ap_rprintf(r, "   <script type=\"text/javascript\" src=\"%s\"></script>\n",
-		   conf->script_path);
+        ap_rprintf(r,
+                   "   <script type=\"text/javascript\" src=\"%s\"></script>\n",
+                   conf->script_path);
     }
 
     ap_rputs(" </head>\n\n", r);
 
-    ap_rprintf(r, " <body id=\"archives\" onload=\"javascript:loadBrowser ('%s');\">\n", baseURI);
+    ap_rprintf(r,
+               " <body id=\"archives\" onload=\"javascript:loadBrowser ('%s');\">\n",
+               baseURI);
     ap_rputs("  <h1>Mailing list archives</h1>\n\n", r);
 
     ap_rputs("  <h5>\n", r);
 
     if (conf->root_path) {
         ap_rprintf(r, "<a href=\"%s\" title=\"Back to the archives depot\">"
-		   "Site index</a> &middot; ",
-		   conf->root_path);
+                   "Site index</a> &middot; ", conf->root_path);
     }
 
     ap_rprintf(r, "<a href=\"%s\" title=\"Back to the list index\">"
-	       "List index</a></h5>", get_base_path(r));
+               "List index</a></h5>", get_base_path(r));
 
     /* Output a small notice if no MboxScriptPath configuration
        directive was specified. */
     if (!conf->script_path) {
         ap_rputs("  <p>You did not specified a script path, and the dynamic "
-		 "browser won't run without it. Check your server configuration.\n", r);
+                 "browser won't run without it. Check your server configuration.\n",
+                 r);
     }
 
     ap_rputs(" </body>\n</html>\n", r);
@@ -942,12 +959,12 @@
 
     /* Fetch message ID (offset is 5 : '/raw') and eventual MIME part
        number. */
-    msgID = r->path_info+5;
+    msgID = r->path_info + 5;
 
     part = strchr(msgID, '/');
     if (part) {
         *part = 0;
-	part++;
+        part++;
     }
 
     ap_unescape_url(msgID);
@@ -971,7 +988,7 @@
     /* No MIME part specified : output whole message and return. */
     if (!part) {
         ap_set_content_type(r, "text/plain");
-	ap_rprintf(r, "%s", m->raw_msg);
+        ap_rprintf(r, "%s", m->raw_msg);
 
         return OK;
     }
@@ -989,35 +1006,35 @@
     /* First, parse the MIME structure, and look for the correct
        subpart */
     m->mime_msg = mbox_mime_decode_multipart(r->pool, m->raw_body,
-					     m->content_type,
-					     m->cte, m->boundary);
+                                             m->content_type,
+                                             m->cte, m->boundary);
 
     mime_part = m->mime_msg;
 
     do {
         int num;
 
-	end = strchr(part, '/');
-	if (end) {
-	    *end = 0;
-	    num = atoi(part);
-	    *end = '/';
-
-	    part = end + 1;
-	}
-	else {
-	    num = atoi(part);
-	}
-
-	if (mime_part && num > 0 &&
-	    (num <= mime_part->sub_count) &&
-	    mime_part->sub[num - 1] &&
-	    mime_part->sub[num - 1]->body != NULL) {
-	    mime_part = mime_part->sub[num - 1];
-	}
-	else {
-	    return HTTP_NOT_FOUND;
-	}
+        end = strchr(part, '/');
+        if (end) {
+            *end = 0;
+            num = atoi(part);
+            *end = '/';
+
+            part = end + 1;
+        }
+        else {
+            num = atoi(part);
+        }
+
+        if (mime_part && num > 0 &&
+            (num <= mime_part->sub_count) &&
+            mime_part->sub[num - 1] &&
+            mime_part->sub[num - 1]->body != NULL) {
+            mime_part = mime_part->sub[num - 1];
+        }
+        else {
+            return HTTP_NOT_FOUND;
+        }
     } while (*part && end);
 
     if (strncmp(mime_part->content_type, "multipart/", 10) == 0) {
@@ -1028,7 +1045,7 @@
     }
 
     if (mime_part->body_len > 0) {
-        const char* pdata;
+        const char *pdata;
         apr_size_t ret_len;
 
         mime_part->body[mime_part->body_len] = 0;
@@ -1036,8 +1053,7 @@
         pdata = mbox_mime_decode_body(r->pool,
                                       mime_part->cte,
                                       mime_part->body,
-                                      mime_part->body_len,
-                                      &ret_len);
+                                      mime_part->body_len, &ret_len);
         if (pdata != NULL && ret_len) {
             ap_rwrite(pdata, ret_len, r);
         }
@@ -1047,28 +1063,27 @@
 }
 
 void mbox_static_message_nav(request_rec *r, char **context,
-			     char *baseURI, char *msgID)
+                             char *baseURI, char *msgID)
 {
     ap_rputs("    <th class=\"nav\">", r);
 
     /* Date navigation */
     if (context[0]) {
         ap_rprintf(r, "<a href=\"%s/%s\" "
-		   "title=\"Previous by date\">&laquo;</a>",
-		   baseURI, URI_ESCAPE_OR_BLANK(r->pool, context[0]));
+                   "title=\"Previous by date\">&laquo;</a>",
+                   baseURI, URI_ESCAPE_OR_BLANK(r->pool, context[0]));
     }
     else {
         ap_rputs("&laquo;", r);
     }
 
     ap_rprintf(r, " <a href=\"%s/date\" "
-	       "title=\"View messages sorted by date\">Date</a> ",
-	       baseURI);
+               "title=\"View messages sorted by date\">Date</a> ", baseURI);
 
     if (context[1]) {
         ap_rprintf(r, "<a href=\"%s/%s\" "
-		   "title=\"Next by date\">&raquo;</a>",
-		   baseURI, URI_ESCAPE_OR_BLANK(r->pool, context[1]));
+                   "title=\"Next by date\">&raquo;</a>",
+                   baseURI, URI_ESCAPE_OR_BLANK(r->pool, context[1]));
     }
     else {
         ap_rputs("&raquo;", r);
@@ -1079,21 +1094,21 @@
     /* Thread navigation */
     if (context[2]) {
         ap_rprintf(r, "<a href=\"%s/%s\" "
-		   "title=\"Previous by thread\">&laquo;</a>",
-		   baseURI, URI_ESCAPE_OR_BLANK(r->pool, context[2]));
+                   "title=\"Previous by thread\">&laquo;</a>",
+                   baseURI, URI_ESCAPE_OR_BLANK(r->pool, context[2]));
     }
     else {
         ap_rputs("&laquo;", r);
     }
 
     ap_rprintf(r, " <a href=\"%s/thread\" "
-	       "title=\"View messages sorted by thread\">Thread</a> ",
-	       baseURI);
+               "title=\"View messages sorted by thread\">Thread</a> ",
+               baseURI);
 
     if (context[3]) {
         ap_rprintf(r, "<a href=\"%s/%s\" "
-		   "title=\"Next by thread\">&raquo;</a>",
-		   baseURI, URI_ESCAPE_OR_BLANK(r->pool, context[3]));
+                   "title=\"Next by thread\">&raquo;</a>",
+                   baseURI, URI_ESCAPE_OR_BLANK(r->pool, context[3]));
     }
     else {
         ap_rputs("&raquo;", r);
@@ -1114,7 +1129,7 @@
     conf = ap_get_module_config(r->per_dir_config, &mbox_module);
     baseURI = get_base_uri(r);
 
-    msgID = r->path_info+1;
+    msgID = r->path_info + 1;
     ap_unescape_url(msgID);
 
     /* msgID should be the part of the URI that Apache could not resolve
@@ -1131,22 +1146,25 @@
 
     /* Parse multipart information */
     m->mime_msg = mbox_mime_decode_multipart(r->pool, m->raw_body,
-					     m->content_type,
-					     m->cte, m->boundary);
+                                             m->content_type,
+                                             m->cte, m->boundary);
 
     ap_rputs("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", r);
-    ap_rputs("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n", r);
+    ap_rputs("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n",
+             r);
     ap_rputs("\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\n", r);
 
     ap_rputs("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n", r);
     ap_rputs(" <head>\n", r);
     ap_rputs("  <meta http-equiv=\"Content-Type\" "
-	     "content=\"text/html; charset=utf-8\" />\n", r);
-    ap_rprintf(r, "  <title>%s</title>\n", ESCAPE_OR_BLANK(r->pool, m->subject));
+             "content=\"text/html; charset=utf-8\" />\n", r);
+    ap_rprintf(r, "  <title>%s</title>\n",
+               ESCAPE_OR_BLANK(r->pool, m->subject));
 
     if (conf->style_path) {
-        ap_rprintf(r, "   <link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" />\n",
-		   conf->style_path);
+        ap_rprintf(r,
+                   "   <link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" />\n",
+                   conf->style_path);
     }
 
     ap_rputs(" </head>\n\n", r);
@@ -1157,8 +1175,7 @@
 
     if (conf->root_path) {
         ap_rprintf(r, "<a href=\"%s\" title=\"Back to the archives depot\">"
-                   "Site index</a> &middot; ",
-                   conf->root_path);
+                   "Site index</a> &middot; ", conf->root_path);
     }
 
     ap_rprintf(r, "<a href=\"%s\" title=\"Back to the list index\">"
@@ -1177,55 +1194,53 @@
 
     /* Top navigation */
     ap_rputs("   <thead>\n"
-	     "    <tr>\n"
-	     "    <th class=\"title\">Message view</th>\n", r);
+             "    <tr>\n" "    <th class=\"title\">Message view</th>\n", r);
     mbox_static_message_nav(r, context, baseURI, m->msgID);
-    ap_rputs("   </tr>\n"
-	     "   </thead>\n\n", r);
+    ap_rputs("   </tr>\n" "   </thead>\n\n", r);
 
     /* Bottom navigation */
     ap_rputs("   <tfoot>\n"
-	     "    <tr>\n"
-	     "    <th class=\"title\"><a href=\"#archives\">Top</a></th>\n", r);
+             "    <tr>\n"
+             "    <th class=\"title\"><a href=\"#archives\">Top</a></th>\n",
+             r);
     mbox_static_message_nav(r, context, baseURI, m->msgID);
-    ap_rputs("   </tr>\n"
-	     "   </tfoot>\n\n", r);
+    ap_rputs("   </tr>\n" "   </tfoot>\n\n", r);
 
     /* Headers */
     ap_rputs("   <tbody>\n", r);
     ap_rprintf(r, "   <tr class=\"from\">\n"
-	       "    <td class=\"left\">From</td>\n"
-	       "    <td class=\"right\">%s</td>\n"
-	       "   </tr>\n", from);
+               "    <td class=\"left\">From</td>\n"
+               "    <td class=\"right\">%s</td>\n" "   </tr>\n", from);
 
     ap_rprintf(r, "   <tr class=\"subject\">\n"
-	       "    <td class=\"left\">Subject</td>\n"
-	       "    <td class=\"right\">%s</td>\n"
-	       "   </tr>\n", ESCAPE_OR_BLANK(r->pool, m->subject));
+               "    <td class=\"left\">Subject</td>\n"
+               "    <td class=\"right\">%s</td>\n"
+               "   </tr>\n", ESCAPE_OR_BLANK(r->pool, m->subject));
 
     ap_rprintf(r, "   <tr class=\"date\">\n"
-	       "    <td class=\"left\">Date</td>\n"
-	       "    <td class=\"right\">%s</td>\n"
-	       "   </tr>\n", ESCAPE_OR_BLANK(r->pool, m->rfc822_date));
+               "    <td class=\"left\">Date</td>\n"
+               "    <td class=\"right\">%s</td>\n"
+               "   </tr>\n", ESCAPE_OR_BLANK(r->pool, m->rfc822_date));
 
     /* Message body */
     ap_rputs("   <tr class=\"contents\"><td colspan=\"2\"><pre>\n", r);
-    ap_rprintf(r, "%s", mbox_wrap_text(mbox_mime_get_body(r->pool, m->mime_msg)));
+    ap_rprintf(r, "%s",
+               mbox_wrap_text(mbox_mime_get_body(r->pool, m->mime_msg)));
     ap_rputs("</pre></td></tr>\n", r);
 
     /* MIME structure */
     ap_rputs("   <tr class=\"mime\">\n"
-	     "    <td class=\"left\">Mime</td>\n"
-	     "    <td class=\"right\">\n<ul>\n", r);
+             "    <td class=\"left\">Mime</td>\n"
+             "    <td class=\"right\">\n<ul>\n", r);
     mbox_mime_display_static_structure(r, m->mime_msg,
-				       apr_psprintf(r->pool, "%s/raw/%s/",
-						    baseURI, m->msgID));
+                                       apr_psprintf(r->pool, "%s/raw/%s/",
+                                                    baseURI, m->msgID));
     ap_rputs("</ul>\n</td>\n</tr>\n", r);
 
     ap_rprintf(r, "   <tr class=\"raw\">\n"
-	       "    <td class=\"left\"></td>\n"
-	       "    <td class=\"right\"><a href=\"%s/raw/%s\" rel=\"nofollow\">View raw message</a></td>\n"
-	       "   </tr>\n", baseURI, URI_ESCAPE_OR_BLANK(r->pool, m->msgID));
+               "    <td class=\"left\"></td>\n"
+               "    <td class=\"right\"><a href=\"%s/raw/%s\" rel=\"nofollow\">View raw message</a></td>\n"
+               "   </tr>\n", baseURI, URI_ESCAPE_OR_BLANK(r->pool, m->msgID));
 
     ap_rputs("   </tbody>\n", r);
     ap_rputs("  </table>\n", r);
@@ -1248,7 +1263,7 @@
     baseURI = get_base_uri(r);
 
     /* Here, we skip 6 chars (/ajax/). */
-    msgID = r->path_info+6;
+    msgID = r->path_info + 6;
     ap_unescape_url(msgID);
 
     m = fetch_message(r, f, msgID);
@@ -1258,31 +1273,33 @@
 
     /* Parse multipart information */
     m->mime_msg = mbox_mime_decode_multipart(r->pool, m->raw_body,
-					     m->content_type,
-					     m->cte, m->boundary);
+                                             m->content_type,
+                                             m->cte, m->boundary);
 
     ap_rputs("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", r);
 
     from = ESCAPE_OR_BLANK(r->pool, m->from);
     from = mbox_cte_decode_header(r->pool, from);
     if (conf->antispam) {
-      from = email_antispam(from);
+        from = email_antispam(from);
     }
 
     ap_rprintf(r, "<mail id=\"%s\">\n"
-	       " <from><![CDATA[%s]]></from>\n"
-	       " <subject><![CDATA[%s]]></subject>\n"
-	       " <date><![CDATA[%s]]></date>\n"
-	       " <contents><![CDATA[",
-	       URI_ESCAPE_OR_BLANK(r->pool, m->msgID),
-	       from,
-	       ESCAPE_OR_BLANK(r->pool, m->subject),
-	       ESCAPE_OR_BLANK(r->pool, m->rfc822_date));
+               " <from><![CDATA[%s]]></from>\n"
+               " <subject><![CDATA[%s]]></subject>\n"
+               " <date><![CDATA[%s]]></date>\n"
+               " <contents><![CDATA[",
+               URI_ESCAPE_OR_BLANK(r->pool, m->msgID),
+               from,
+               ESCAPE_OR_BLANK(r->pool, m->subject),
+               ESCAPE_OR_BLANK(r->pool, m->rfc822_date));
 
-    ap_rprintf(r, "%s", mbox_wrap_text(mbox_mime_get_body(r->pool, m->mime_msg)));
+    ap_rprintf(r, "%s",
+               mbox_wrap_text(mbox_mime_get_body(r->pool, m->mime_msg)));
     ap_rputs("]]></contents>\n", r);
     ap_rputs(" <mime>\n", r);
-    mbox_mime_display_xml_structure(r, m->mime_msg, apr_psprintf(r->pool, "/"));
+    mbox_mime_display_xml_structure(r, m->mime_msg,
+                                    apr_psprintf(r->pool, "/"));
     ap_rputs(" </mime>\n", r);
     ap_rputs("</mail>\n", r);
 



Mime
View raw message