diff options
author | Artjom Vejsel <akawolf0@gmail.com> | 2022-03-29 20:34:34 +0300 |
---|---|---|
committer | Artjom Vejsel <akawolf0@gmail.com> | 2022-04-02 00:23:08 +0300 |
commit | 2c003dd2e1a1fb956de6ed58c073e5b9d1cc5f3c (patch) | |
tree | 4ea53ea97f0e0a011b84001225008bbdb2f91c66 /src/command/cmd_funcs.c | |
parent | abfab2aff7561aee98957e805b637b83abc3bdd7 (diff) | |
download | profani-tty-2c003dd2e1a1fb956de6ed58c073e5b9d1cc5f3c.tar.gz |
add /stamp command
command allow override standard stamps of incoming and outgoing messages
Diffstat (limited to 'src/command/cmd_funcs.c')
-rw-r--r-- | src/command/cmd_funcs.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 685369c4..39fc087a 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -9020,6 +9020,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_STR); + if (def) { + cons_show("The outgoing stamp is: %s", def); + free(def); + } else { + cons_show("No outgoing stamp."); + } + def = prefs_get_string(PREF_INCOMING_STR); + if (def) { + cons_show("The incoming stamp is: %s", def); + free(def); + } else { + cons_show("No incoming stamp."); + } + return TRUE; + } + + if (g_strv_length(args) == 1) { + cons_show("Wrong usage: need a parameter."); + return TRUE; + } + + if (g_strv_length(args) == 2) { + if (g_strcmp0(args[0], "outgoing") == 0) { + prefs_set_string(PREF_OUTGOING_STR, args[1]); + cons_show("Outgoing stamp set to: %s", args[1]); + } else if (g_strcmp0(args[0], "incoming") == 0) { + prefs_set_string(PREF_INCOMING_STR, 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_STR, NULL); + cons_show("Incoming stamp unset"); + } else if (g_strcmp0(args[1], "outgoing") == 0) { + prefs_set_string(PREF_OUTGOING_STR, 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) { |