about summary refs log tree commit diff stats
path: root/src/command/cmd_funcs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/command/cmd_funcs.c')
-rw-r--r--src/command/cmd_funcs.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index ebba224e..e76831fc 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -9054,6 +9054,57 @@ cmd_paste(ProfWin* window, const char* const command, gchar** args)
 }
 
 gboolean
+cmd_stamp(ProfWin* window, const char* const command, gchar** args)
+{
+    if (g_strv_length(args) == 0) {
+        char* def = prefs_get_string(PREF_OUTGOING_STAMP);
+        if (def) {
+            cons_show("The outgoing stamp is: %s", def);
+            free(def);
+        } else {
+            cons_show("The default outgoing stamp is used.");
+        }
+        def = prefs_get_string(PREF_INCOMING_STAMP);
+        if (def) {
+            cons_show("The incoming stamp is: %s", def);
+            free(def);
+        } else {
+            cons_show("The default incoming stamp is used.");
+        }
+        return TRUE;
+    }
+
+    if (g_strv_length(args) == 1) {
+        cons_bad_cmd_usage(command);
+        return TRUE;
+    }
+
+    if (g_strv_length(args) == 2) {
+        if (g_strcmp0(args[0], "outgoing") == 0) {
+            prefs_set_string(PREF_OUTGOING_STAMP, args[1]);
+            cons_show("Outgoing stamp set to: %s", args[1]);
+        } else if (g_strcmp0(args[0], "incoming") == 0) {
+            prefs_set_string(PREF_INCOMING_STAMP, args[1]);
+            cons_show("Incoming stamp set to: %s", args[1]);
+        } else if (g_strcmp0(args[0], "unset") == 0) {
+            if (g_strcmp0(args[1], "incoming") == 0) {
+                prefs_set_string(PREF_INCOMING_STAMP, NULL);
+                cons_show("Incoming stamp unset");
+            } else if (g_strcmp0(args[1], "outgoing") == 0) {
+                prefs_set_string(PREF_OUTGOING_STAMP, NULL);
+                cons_show("Outgoing stamp unset");
+            } else {
+                cons_bad_cmd_usage(command);
+            }
+        } else {
+            cons_bad_cmd_usage(command);
+        }
+    }
+
+    return TRUE;
+}
+
+gboolean
 cmd_color(ProfWin* window, const char* const command, gchar** args)
 {
     if (g_strcmp0(args[0], "on") == 0) {