diff options
author | Michael Vetter <jubalh@iodoru.org> | 2023-05-03 13:33:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-03 13:33:00 +0200 |
commit | faccf24c759d7bddb4d3062c7f044e0c7640ffe7 (patch) | |
tree | 18e8e70f804ca08722f3d3d7dec8b065404e8013 /src/command/cmd_funcs.c | |
parent | f4d418a95f25d1280c1d89ccecc86a4087f6e7fa (diff) | |
parent | ecdeb750f3353142e1d135226e81cba7f08cacd8 (diff) | |
download | profani-tty-faccf24c759d7bddb4d3062c7f044e0c7640ffe7.tar.gz |
Merge pull request #1843 from IsaacM88/master
Add ability to disable avatar publishing
Diffstat (limited to 'src/command/cmd_funcs.c')
-rw-r--r-- | src/command/cmd_funcs.c | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index e283395e..6e9ca259 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -9287,25 +9287,34 @@ gboolean cmd_avatar(ProfWin* window, const char* const command, gchar** args) { if (args[1] == NULL) { - cons_bad_cmd_usage(command); - return TRUE; - } - - if (g_strcmp0(args[0], "set") == 0) { -#ifdef HAVE_PIXBUF - if (avatar_set(args[1])) { - cons_show("Avatar updated successfully"); + if (g_strcmp0(args[0], "disable") == 0) { + if (avatar_publishing_disable()) { + cons_show("Avatar publishing disabled. To enable avatar publishing, use '/avatar set <path>'."); + } else { + cons_show("Failed to disable avatar publishing."); + } + } else { + cons_bad_cmd_usage(command); } + } else { + if (g_strcmp0(args[0], "set") == 0) { +#ifdef HAVE_PIXBUF + if (avatar_set(args[1])) { + cons_show("Avatar updated successfully"); + } #else - cons_show("Profanity has not been built with GDK Pixbuf support enabled which is needed to scale the avatar when uploading."); + cons_show("Profanity has not been built with GDK Pixbuf support enabled which is needed to scale the avatar when uploading."); #endif - } else if (g_strcmp0(args[0], "get") == 0) { - avatar_get_by_nick(args[1], false); - } else if (g_strcmp0(args[0], "open") == 0) { - avatar_get_by_nick(args[1], true); - } else if (g_strcmp0(args[0], "cmd") == 0) { - prefs_set_string(PREF_AVATAR_CMD, args[1]); - cons_show("Avatar cmd set to: %s", args[1]); + } else if (g_strcmp0(args[0], "get") == 0) { + avatar_get_by_nick(args[1], false); + } else if (g_strcmp0(args[0], "open") == 0) { + avatar_get_by_nick(args[1], true); + } else if (g_strcmp0(args[0], "cmd") == 0) { + prefs_set_string(PREF_AVATAR_CMD, args[1]); + cons_show("Avatar cmd set to: %s", args[1]); + } else { + cons_bad_cmd_usage(command); + } } return TRUE; |