List ignored bookmarks

`/bookmarl ignore` lists the ignored bookmarks.

Regards https://github.com/profanity-im/profanity/issues/1115
This commit is contained in:
Michael Vetter
2020-05-24 17:17:20 +02:00
parent ca3972b3ca
commit f121554088
7 changed files with 54 additions and 2 deletions

View File

@@ -795,7 +795,9 @@ static struct cmd_t command_defs[] =
{ "/bookmark",
parse_args, 0, 8, NULL,
CMD_NOSUBFUNCS
CMD_SUBFUNCS(
{ "ignore", cmd_bookmark_ignore }
)
CMD_MAINFUNC(cmd_bookmark)
CMD_TAGS(
CMD_TAG_GROUPCHAT)
@@ -806,7 +808,8 @@ static struct cmd_t command_defs[] =
"/bookmark update <room> [nick <nick>] [password <password>] [name <roomname>] autojoin on|off]",
"/bookmark remove [<room>]",
"/bookmark join <room>",
"/bookmark invites on|off")
"/bookmark invites on|off",
"/bookmark ignore")
CMD_DESC(
"Manage bookmarks and join bookmarked rooms. "
"In a chat room, no arguments will bookmark the current room, setting autojoin to \"on\".")

View File

@@ -68,6 +68,7 @@
#include "tools/autocomplete.h"
#include "tools/parser.h"
#include "tools/tinyurl.h"
#include "tools/bookmark_ignore.h"
#include "plugins/plugins.h"
#include "ui/ui.h"
#include "ui/window_list.h"
@@ -4766,6 +4767,30 @@ cmd_bookmark(ProfWin *window, const char *const command, gchar **args)
return TRUE;
}
gboolean
cmd_bookmark_ignore(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
cons_alert();
return TRUE;
}
// `/bookmark ignore` lists them
if (args[1] == NULL) {
gsize len;
gchar **list = bookmark_ignore_list(&len);
cons_show_bookmarks_ignore(list, len);
g_strfreev(list);
return TRUE;
}
cons_bad_cmd_usage(command);
return TRUE;
}
gboolean
cmd_disco(ProfWin *window, const char *const command, gchar **args)
{

View File

@@ -115,6 +115,7 @@ gboolean cmd_reconnect(ProfWin *window, const char *const command, gchar **args)
gboolean cmd_room(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_rooms(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_bookmark(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_bookmark_ignore(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_roster(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_software(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_splash(ProfWin *window, const char *const command, gchar **args);