Option to bookmark room invites

issue #813
This commit is contained in:
James Booth
2016-05-23 23:53:44 +01:00
parent 0edd430925
commit 6559263b2f
10 changed files with 68 additions and 4 deletions

View File

@@ -517,6 +517,7 @@ cmd_ac_init(void)
autocomplete_add(bookmark_ac, "update");
autocomplete_add(bookmark_ac, "remove");
autocomplete_add(bookmark_ac, "join");
autocomplete_add(bookmark_ac, "invites");
bookmark_property_ac = autocomplete_new();
autocomplete_add(bookmark_property_ac, "nick");
@@ -1599,6 +1600,10 @@ _bookmark_autocomplete(ProfWin *window, const char *const input)
if (found) {
return found;
}
found = autocomplete_param_with_func(input, "/bookmark invites", prefs_autocomplete_boolean_choice);
if (found) {
return found;
}
found = autocomplete_param_with_ac(input, "/bookmark", bookmark_ac, TRUE);
return found;

View File

@@ -807,7 +807,8 @@ static struct cmd_t command_defs[] =
"/bookmark add <room> [nick <nick>] [password <password>] [autojoin on|off]",
"/bookmark update <room> [nick <nick>] [password <password>] [autojoin on|off]",
"/bookmark remove <room>",
"/bookmark join <room>")
"/bookmark join <room>",
"/bookmark invites on|off")
CMD_DESC(
"Manage bookmarks and join bookmarked rooms. "
"In a chat room, no arguments will bookmark the current room, setting autojoin to \"on\".")
@@ -819,7 +820,8 @@ static struct cmd_t command_defs[] =
{ "nick <nick>", "Nickname used in the chat room." },
{ "password <password>", "Password if required, may be stored in plaintext on your server." },
{ "autojoin on|off", "Whether to join the room automatically on login." },
{ "join <room>", "Join room using the properties associated with the bookmark." })
{ "join <room>", "Join room using the properties associated with the bookmark." },
{ "invites on|off", "Whether or not to bookmark accepted room invites, defaults to 'on'."})
CMD_NOEXAMPLES
},

View File

@@ -4337,7 +4337,19 @@ cmd_bookmark(ProfWin *window, const char *const command, gchar **args)
return TRUE;
}
if (strcmp(cmd, "list") == 0) {
if (strcmp(cmd, "invites") == 0) {
if (g_strcmp0(args[1], "on") == 0) {
prefs_set_boolean(PREF_BOOKMARK_INVITE, TRUE);
cons_show("Auto bookmarking accepted invites enabled.");
} else if (g_strcmp0(args[1], "off") == 0) {
prefs_set_boolean(PREF_BOOKMARK_INVITE, FALSE);
cons_show("Auto bookmarking accepted invites disabled.");
} else {
cons_bad_cmd_usage(command);
cons_show("");
}
return TRUE;
} else if (strcmp(cmd, "list") == 0) {
const GList *bookmarks = bookmark_get_list();
cons_show_bookmarks(bookmarks);
} else {