mirror of
https://github.com/profanity-im/profanity.git
synced 2024-09-22 19:45:54 -04:00
Added /subject prepend <text>
This commit is contained in:
parent
86354a2bc5
commit
f3c65496c7
@ -561,14 +561,16 @@ static struct cmd_t command_defs[] =
|
|||||||
CMD_TAG_GROUPCHAT)
|
CMD_TAG_GROUPCHAT)
|
||||||
CMD_SYN(
|
CMD_SYN(
|
||||||
"/subject set <subject>",
|
"/subject set <subject>",
|
||||||
|
"/subject prepend <text>",
|
||||||
"/subject append <text>",
|
"/subject append <text>",
|
||||||
"/subject clear")
|
"/subject clear")
|
||||||
CMD_DESC(
|
CMD_DESC(
|
||||||
"Set, append to, or clear room subject.")
|
"Set, modify, or clear room subject.")
|
||||||
CMD_ARGS(
|
CMD_ARGS(
|
||||||
{ "set <subject>", "Set the room subject." },
|
{ "set <subject>", "Set the room subject." },
|
||||||
{ "append <text>", "Append text to the current room subject, use double quotes if a preceeding space is needed." },
|
{ "prepend <text>", "Prepend text to the current room subject, use double quotes if a trailing space is needed." },
|
||||||
{ "clear", "Clear 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
|
CMD_NOEXAMPLES
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -2137,6 +2139,7 @@ cmd_init(void)
|
|||||||
|
|
||||||
subject_ac = autocomplete_new();
|
subject_ac = autocomplete_new();
|
||||||
autocomplete_add(subject_ac, "set");
|
autocomplete_add(subject_ac, "set");
|
||||||
|
autocomplete_add(subject_ac, "prepend");
|
||||||
autocomplete_add(subject_ac, "append");
|
autocomplete_add(subject_ac, "append");
|
||||||
autocomplete_add(subject_ac, "clear");
|
autocomplete_add(subject_ac, "clear");
|
||||||
|
|
||||||
|
@ -2851,6 +2851,23 @@ cmd_subject(ProfWin *window, const char *const command, gchar **args)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_strcmp0(args[0], "prepend") == 0) {
|
||||||
|
if (args[1]) {
|
||||||
|
char *old_subject = muc_subject(mucwin->roomjid);
|
||||||
|
if (old_subject) {
|
||||||
|
GString *new_subject = g_string_new(args[1]);
|
||||||
|
g_string_append(new_subject, old_subject);
|
||||||
|
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], "append") == 0) {
|
if (g_strcmp0(args[0], "append") == 0) {
|
||||||
if (args[1]) {
|
if (args[1]) {
|
||||||
char *old_subject = muc_subject(mucwin->roomjid);
|
char *old_subject = muc_subject(mucwin->roomjid);
|
||||||
|
Loading…
Reference in New Issue
Block a user