diff options
author | Michael Vetter <jubalh@iodoru.org> | 2020-05-22 13:56:00 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2020-05-22 13:56:00 +0200 |
commit | fad296b79e42a0df6c0f118e1c011f480462551f (patch) | |
tree | f6648c70bc2983c1998b5f2d739188b7ac89996f /src/xmpp | |
parent | cb78ee46656972a5481ad0241fb50dc0e0d02413 (diff) | |
download | profani-tty-fad296b79e42a0df6c0f118e1c011f480462551f.tar.gz |
Display bookmark name
Have field in struct and display the name in `/bookmark list`. Regards https://github.com/profanity-im/profanity/issues/697
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/bookmark.c | 4 | ||||
-rw-r--r-- | src/xmpp/xmpp.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/xmpp/bookmark.c b/src/xmpp/bookmark.c index b9bbfc32..81d7e19e 100644 --- a/src/xmpp/bookmark.c +++ b/src/xmpp/bookmark.c @@ -277,6 +277,8 @@ _bookmark_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata) log_debug("Handle bookmark for %s", barejid); + const char *room_name = xmpp_stanza_get_attribute(child, "name"); + char *nick = NULL; xmpp_stanza_t *nick_st = xmpp_stanza_get_child_by_name(child, "nick"); if (nick_st) { @@ -300,6 +302,7 @@ _bookmark_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata) bookmark->barejid = strdup(barejid); bookmark->nick = nick; bookmark->password = password; + bookmark->name = room_name ? strdup(room_name) : NULL; bookmark->autojoin = autojoin_val; g_hash_table_insert(bookmarks, strdup(barejid), bookmark); @@ -326,6 +329,7 @@ _bookmark_destroy(Bookmark *bookmark) free(bookmark->barejid); free(bookmark->nick); free(bookmark->password); + free(bookmark->name); free(bookmark); } } diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h index fa26cfbf..c06939cb 100644 --- a/src/xmpp/xmpp.h +++ b/src/xmpp/xmpp.h @@ -93,6 +93,7 @@ typedef struct bookmark_t { char *barejid; char *nick; char *password; + char *name; gboolean autojoin; } Bookmark; |