1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Display bookmark name

Have field in struct and display the name in `/bookmark list`.

Regards https://github.com/profanity-im/profanity/issues/697
This commit is contained in:
Michael Vetter 2020-05-22 13:56:00 +02:00
parent cb78ee4665
commit fad296b79e
3 changed files with 10 additions and 1 deletions

View File

@ -696,7 +696,11 @@ cons_show_bookmarks(const GList *list)
if (muc_active(item->barejid) && roomwin) { if (muc_active(item->barejid) && roomwin) {
presence_colour = THEME_ONLINE; presence_colour = THEME_ONLINE;
} }
if (item->name) {
win_print(console, presence_colour, "-", " %s - %s", item->name, item->barejid);
} else {
win_print(console, presence_colour, "-", " %s", item->barejid); win_print(console, presence_colour, "-", " %s", item->barejid);
}
if (item->nick) { if (item->nick) {
win_append(console, presence_colour, "/%s", item->nick); win_append(console, presence_colour, "/%s", item->nick);
} }

View File

@ -277,6 +277,8 @@ _bookmark_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
log_debug("Handle bookmark for %s", barejid); log_debug("Handle bookmark for %s", barejid);
const char *room_name = xmpp_stanza_get_attribute(child, "name");
char *nick = NULL; char *nick = NULL;
xmpp_stanza_t *nick_st = xmpp_stanza_get_child_by_name(child, "nick"); xmpp_stanza_t *nick_st = xmpp_stanza_get_child_by_name(child, "nick");
if (nick_st) { if (nick_st) {
@ -300,6 +302,7 @@ _bookmark_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
bookmark->barejid = strdup(barejid); bookmark->barejid = strdup(barejid);
bookmark->nick = nick; bookmark->nick = nick;
bookmark->password = password; bookmark->password = password;
bookmark->name = room_name ? strdup(room_name) : NULL;
bookmark->autojoin = autojoin_val; bookmark->autojoin = autojoin_val;
g_hash_table_insert(bookmarks, strdup(barejid), bookmark); g_hash_table_insert(bookmarks, strdup(barejid), bookmark);
@ -326,6 +329,7 @@ _bookmark_destroy(Bookmark *bookmark)
free(bookmark->barejid); free(bookmark->barejid);
free(bookmark->nick); free(bookmark->nick);
free(bookmark->password); free(bookmark->password);
free(bookmark->name);
free(bookmark); free(bookmark);
} }
} }

View File

@ -93,6 +93,7 @@ typedef struct bookmark_t {
char *barejid; char *barejid;
char *nick; char *nick;
char *password; char *password;
char *name;
gboolean autojoin; gboolean autojoin;
} Bookmark; } Bookmark;