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:
Michael Vetter
2021-06-09 15:45:09 +02:00
parent d7adec69ce
commit 8ef35290bd
9 changed files with 68 additions and 5 deletions

View File

@@ -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;
}