Add report-time setting.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 15 Nov 2007 18:49:33 +0000 (19:49 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 15 Nov 2007 18:49:33 +0000 (19:49 +0100)
NEWS
doc/commands.xml
src/admin.c

diff --git a/NEWS b/NEWS
index 292e26a69eef8976c4c7026f63a204b82f81c9b3..1b5fcd755edace1df5992f344011d48f4c02a0cc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,7 +11,8 @@ Ctrlproxy 3.0.4 UNRELEASED
 
     * Announce number of clients/channels during client login.
 
-       * Add "set" command in the administration interface.
+       * Add "set" command in the administration interface, including 
+         initial settings "log_level", "motd-file" and "report-time".
 
   BUG FIXES
 
index da885c1cc9be8498209a9e36c6a85450584b0344..2e2932d9d4b90e9007f351e62702e01520ee5afa 100644 (file)
                        <para>View or change the CtrlProxy internal log level.</para></description>
        </ctrlproxy-command>
 
+       <ctrlproxy-command name="set report-time">
+               <short-description>Change whether time should be printed when displaying backlog</short-description>
+               <syntax>set report-time [&lt;true|false&gt;]</syntax>
+               <description>
+                       <para>Whether or not time should be displayed when sending backlog to the user.</para></description>
+       </ctrlproxy-command>
+
        <ctrlproxy-command name="set motd-file">
                <short-description>Change or display the MOTD path</short-description>
                <syntax>set log_level [&lt;level&gt;]</syntax>
index 2c8854b3260df1f4d2f7bfcb9e213f0efb8eca01..5ed2f5f9d8ab78219d4505f412937870b10d0fb7 100644 (file)
@@ -959,6 +959,35 @@ static char *motd_file_get(admin_handle h)
        return g_strdup(g->config->motd_file);
 }
 
+static char *report_time_get(admin_handle h)
+{
+       struct global *g = admin_get_global(h);
+
+       return g_strdup(g->config->report_time?"true":"false");
+}
+
+static gboolean interpret_boolean(admin_handle h, const char *value,
+                                                                 gboolean *ret)
+{
+       if (!g_strcasecmp(value, "true")) {
+               *ret = TRUE;
+               return TRUE;
+       } else if (!g_strcasecmp(value, "false")) {
+               *ret = FALSE;
+               return TRUE;
+       }
+
+       admin_out(h, "Invalid boolean value `%s'", value);
+       return FALSE;
+}
+
+static gboolean report_time_set(admin_handle h, const char *value)
+{
+       struct global *g = admin_get_global(h);
+
+       return interpret_boolean(h, value, &g->config->report_time);
+}
+
 static struct admin_setting {
        const char *name;
        char *(*get) (admin_handle h);
@@ -966,6 +995,7 @@ static struct admin_setting {
 } settings[] = {
        { "log_level", log_level_get, log_level_set },
        { "motd-file", motd_file_get, motd_file_set },
+       { "report-time", report_time_get, report_time_set },
 };
 
 static void cmd_set(admin_handle h, char **args, void *userdata)