mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-27 08:16:21 +00:00
Add command to show single bookmark details
`/bookmark list` lists all bookmarks with its details. `/bookmark list <jid>` shows the details of a single bookmark. Implement https://github.com/profanity-im/profanity/issues/1558
This commit is contained in:
@@ -2206,6 +2206,10 @@ _bookmark_autocomplete(ProfWin* window, const char* const input, gboolean previo
|
||||
if (found) {
|
||||
return found;
|
||||
}
|
||||
found = autocomplete_param_with_func(input, "/bookmark list", bookmark_find, previous, NULL);
|
||||
if (found) {
|
||||
return found;
|
||||
}
|
||||
|
||||
found = autocomplete_param_with_ac(input, "/bookmark", bookmark_ac, TRUE, previous);
|
||||
return found;
|
||||
|
||||
@@ -822,7 +822,7 @@ static struct cmd_t command_defs[] = {
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
"/bookmark",
|
||||
"/bookmark list",
|
||||
"/bookmark list [<jid>]",
|
||||
"/bookmark add [<room>] [nick <nick>] [password <password>] [name <roomname>] [autojoin on|off]",
|
||||
"/bookmark update <room> [nick <nick>] [password <password>] [name <roomname>] [autojoin on|off]",
|
||||
"/bookmark remove [<room>]",
|
||||
@@ -836,7 +836,7 @@ static struct cmd_t command_defs[] = {
|
||||
"If you are in a chat room and no arguments are supplied to `/bookmark add`, autojoin is set to \"on\". "
|
||||
"There is also an autojoin ignore list in case you want to autojoin in many clients but not on Profanity. ")
|
||||
CMD_ARGS(
|
||||
{ "list", "List all bookmarks." },
|
||||
{ "list [<jid>]", "List all bookmarks. Or the details of one." },
|
||||
{ "add [<room>]", "Add a bookmark, passing no room will bookmark the current room, setting autojoin to \"on\"." },
|
||||
{ "remove [<room>]", "Remove a bookmark, passing no room will remove the bookmark for the current room, if one exists." },
|
||||
{ "update <room>", "Update the properties associated with a bookmark." },
|
||||
@@ -853,6 +853,8 @@ static struct cmd_t command_defs[] = {
|
||||
"/bookmark join room@example.com",
|
||||
"/bookmark update room@example.com nick NEWNICK autojoin on",
|
||||
"/bookmark ignore room@example.com",
|
||||
"/bookmark list",
|
||||
"/bookmark list room@example.com",
|
||||
"/bookmark remove room@example.com")
|
||||
},
|
||||
|
||||
|
||||
@@ -4661,9 +4661,18 @@ cmd_bookmark(ProfWin* window, const char* const command, gchar** args)
|
||||
}
|
||||
|
||||
if (strcmp(cmd, "list") == 0) {
|
||||
GList* bookmarks = bookmark_get_list();
|
||||
cons_show_bookmarks(bookmarks);
|
||||
g_list_free(bookmarks);
|
||||
char* bookmark_jid = args[1];
|
||||
if (bookmark_jid == NULL) {
|
||||
// list all bookmarks
|
||||
GList* bookmarks = bookmark_get_list();
|
||||
cons_show_bookmarks(bookmarks);
|
||||
g_list_free(bookmarks);
|
||||
} else {
|
||||
// list one bookmark
|
||||
Bookmark *bookmark = bookmark_get_by_jid(bookmark_jid);
|
||||
cons_show_bookmark(bookmark);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user