about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2021-06-09 15:45:09 +0200
committerMichael Vetter <jubalh@iodoru.org>2021-06-09 15:53:21 +0200
commit8ef35290bdde58c6a0e7231c1870152f946d78e0 (patch)
tree4bdebbc7cd297460d76603667b90a5993b7ad46b /src/ui
parentd7adec69cefedce8949ead1309e9a8e56a8c4d8f (diff)
downloadprofani-tty-8ef35290bdde58c6a0e7231c1870152f946d78e0.tar.gz
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
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/console.c28
-rw-r--r--src/ui/ui.h1
2 files changed, 29 insertions, 0 deletions
diff --git a/src/ui/console.c b/src/ui/console.c
index 74a7740f..4494bce0 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -745,6 +745,34 @@ cons_show_bookmarks(const GList* list)
 }
 
 void
+cons_show_bookmark(Bookmark* item)
+{
+    cons_show("");
+    if (!item) {
+        cons_show("No such bookmark");
+    } else {
+        cons_show("Bookmark details:");
+        cons_show("Room jid           : %s", item->barejid);
+        if (item->name) {
+            cons_show("name               : %s", item->name);
+        }
+        if (item->nick) {
+            cons_show("nick               : %s", item->nick);
+        }
+        if (item->password) {
+            cons_show("password           : %s", item->password);
+        }
+        if (item->autojoin) {
+            cons_show("autojoin           : ON");
+        } else {
+            cons_show("autojoin           : OFF");
+        }
+    }
+
+    cons_alert(NULL);
+}
+
+void
 cons_show_disco_info(const char* jid, GSList* identities, GSList* features)
 {
     if ((identities && (g_slist_length(identities) > 0)) || (features && (g_slist_length(features) > 0))) {
diff --git a/src/ui/ui.h b/src/ui/ui.h
index f9ef5cff..0c58b09c 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -271,6 +271,7 @@ void cons_show_aliases(GList* aliases);
 void cons_show_login_success(ProfAccount* account, gboolean secured);
 void cons_show_account_list(gchar** accounts);
 void cons_show_room_list(GSList* room, const char* const conference_node);
+void cons_show_bookmark(Bookmark* item);
 void cons_show_bookmarks(const GList* list);
 void cons_show_bookmarks_ignore(gchar** list, gsize len);
 void cons_show_disco_items(GSList* items, const char* const jid);