diff options
author | James Booth <boothj5@gmail.com> | 2015-10-29 20:55:37 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-10-29 20:55:37 +0000 |
commit | 86354a2bc5edf9552b0d173d92ad3104476b343f (patch) | |
tree | 44fcd425bb13bb858dc20686cff60af380c3e03c | |
parent | 4e6ea6ad1bab30235cded55b73f484c15cf688ff (diff) | |
download | profani-tty-86354a2bc5edf9552b0d173d92ad3104476b343f.tar.gz |
Added /subject append <text>
-rw-r--r-- | src/command/command.c | 5 | ||||
-rw-r--r-- | src/command/commands.c | 17 | ||||
-rw-r--r-- | src/ui/core.c | 2 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/command/command.c b/src/command/command.c index d2ccef73..375d1b26 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -561,11 +561,13 @@ static struct cmd_t command_defs[] = CMD_TAG_GROUPCHAT) CMD_SYN( "/subject set <subject>", + "/subject append <text>", "/subject clear") CMD_DESC( - "Set or clear room subject.") + "Set, append to, or clear room subject.") CMD_ARGS( { "set <subject>", "Set the room subject." }, + { "append <text>", "Append text to the current room subject, use double quotes if a preceeding space is needed." }, { "clear", "Clear the room subject." }) CMD_NOEXAMPLES }, @@ -2135,6 +2137,7 @@ cmd_init(void) subject_ac = autocomplete_new(); autocomplete_add(subject_ac, "set"); + autocomplete_add(subject_ac, "append"); autocomplete_add(subject_ac, "clear"); form_ac = autocomplete_new(); diff --git a/src/command/commands.c b/src/command/commands.c index 799a006e..f17fec42 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -2851,6 +2851,23 @@ cmd_subject(ProfWin *window, const char *const command, gchar **args) return TRUE; } + if (g_strcmp0(args[0], "append") == 0) { + if (args[1]) { + char *old_subject = muc_subject(mucwin->roomjid); + if (old_subject) { + GString *new_subject = g_string_new(old_subject); + g_string_append(new_subject, args[1]); + message_send_groupchat_subject(mucwin->roomjid, new_subject->str); + g_string_free(new_subject, TRUE); + } else { + win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Room does not have a subject, use /subject set <subject>"); + } + } else { + cons_bad_cmd_usage(command); + } + return TRUE; + } + if (g_strcmp0(args[0], "clear") == 0) { message_send_groupchat_subject(mucwin->roomjid, NULL); return TRUE; diff --git a/src/ui/core.c b/src/ui/core.c index eb36ba22..a48d987b 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -1578,7 +1578,7 @@ ui_room_subject(const char *const roomjid, const char *const nick, const char *c } } else { if (nick) { - win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "*%s has cleared the room subject: ", nick); + win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "*%s has cleared the room subject.", nick); } else { win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Room subject cleared"); } |