chiark / gitweb /
Make "short" context in @part actually work
authorRichard Kettlewell <rjk@greenend.org.uk>
Sun, 18 May 2008 21:05:36 +0000 (22:05 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sun, 18 May 2008 21:05:36 +0000 (22:05 +0100)
server/disorder-cgi.h
server/macros-disorder.c

index 9da8975..beb8581 100644 (file)
@@ -56,6 +56,7 @@
 #include "split.h"
 #include "mime.h"
 #include "sendmail.h"
+#include "charset.h"
 
 extern disorder_client *dcgi_client;
 extern char *dcgi_cookie;
index 2dc8098..eff6313 100644 (file)
@@ -149,7 +149,7 @@ static int exp_part(int nargs,
                    void attribute((unused)) *u) {
   const char *track = args[0], *part = args[1];
   const char *context = nargs > 2 ? args[2] : "display";
-  char *s;
+  const char *s;
 
   if(track[0] != '/') {
     struct queue_entry *q = dcgi_findtrack(track);
@@ -160,11 +160,14 @@ static int exp_part(int nargs,
       return 0;
   }
   if(dcgi_client
-     && !disorder_part(dcgi_client, &s,
+     && !disorder_part(dcgi_client, (char **)&s,
                        track,
                        !strcmp(context, "short") ? "display" : context,
-                       part))
+                       part)) {
+    if(!strcmp(context, "short"))
+      s = truncate_for_display(s, config->short_display);
     return sink_writes(output, cgi_sgmlquote(s)) < 0 ? -1 : 0;
+  }
   return 0;
 }