chiark / gitweb /
disorder.h: more consistent approach to function attributes
[disorder] / lib / eclient.c
index c253b06b880ddfb12ca49744240d2461da17e227..fad416ad07be6fad813fb3173a696423e1d491ad 100644 (file)
@@ -586,7 +586,7 @@ static void authbanner_opcallback(disorder_eclient *c,
      || !(rvec = split(c->line + 4, &nrvec, SPLIT_QUOTES, 0, 0))
      || nrvec < 1) {
     /* Banner told us to go away, or was malformed.  We cannot proceed. */
-    protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
+    protocol_error(c, op, c->rc, "%s [%s]", c->line, c->ident);
     disorder_eclient_close(c);
     return;
   }
@@ -607,21 +607,21 @@ static void authbanner_opcallback(disorder_eclient *c,
     challenge = *rvec++;
     break;
   default:
-    protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
+    protocol_error(c, op, c->rc, "%s [%s]", c->line, c->ident);
     disorder_eclient_close(c);
     return;
   }
   c->protocol = atoi(protocol);
   if(c->protocol < 1 || c->protocol > 2) {
-    protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
+    protocol_error(c, op, c->rc, "%s [%s]", c->line, c->ident);
     disorder_eclient_close(c);
     return;
   }
   nonce = unhex(challenge, &nonce_len);
   res = authhash(nonce, nonce_len, config->password, algorithm);
   if(!res) {
-    protocol_error(c, op, c->rc, "%s: unknown authentication algorithm '%s'",
-                   c->ident, algorithm);
+    protocol_error(c, op, c->rc, "unknown authentication algorithm '%s' [%s]",
+                   algorithm, c->ident);
     disorder_eclient_close(c);
     return;
   }
@@ -639,7 +639,7 @@ static void authuser_opcallback(disorder_eclient *c,
   D(("authuser_opcallback"));
   if(c->rc / 100 != 2) {
     /* Wrong password or something.  We cannot proceed. */
-    protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
+    protocol_error(c, op, c->rc, "%s [%s]", c->line, c->ident);
     c->enabled = 0;
     disorder_eclient_close(c);
     return;
@@ -888,6 +888,16 @@ static void vstash_command(disorder_eclient *c,
       } else if(arg == disorder__body) {
        body = va_arg(ap, char **);
        nbody = va_arg(ap, int);
+      } else if(arg == disorder__integer) {
+        long n = va_arg(ap, long);
+        char buffer[16];
+        snprintf(buffer, sizeof buffer, "%ld", n);
+        vector_append(&vec, xstrdup(buffer));
+      } else if(arg == disorder__time) {
+        time_t n = va_arg(ap, time_t);
+        char buffer[16];
+        snprintf(buffer, sizeof buffer, "%lld", (long long)n);
+        vector_append(&vec, xstrdup(buffer));
       } else
         vector_append(&vec, arg);
     }
@@ -920,7 +930,7 @@ static void stash_command(disorder_eclient *c,
 static const char *errorstring(disorder_eclient *c) {
   char *s;
 
-  byte_xasprintf(&s, "%s: %s: %d", c->ident, c->line, c->rc);
+  byte_xasprintf(&s, "%s [%s]", c->line, c->ident);
   return s;
 }