about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-01-23 11:35:33 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-01-23 11:35:33 +0100
commit3066fd77fcc08eb1d54173e28fd6899618b83605 (patch)
treefef7fdcc488b67464b7a9f81f57e0e35dd66f5d7
parentd4c27f2f78fd28e9ba3a203a40804da813c6639c (diff)
downloadprofani-tty-3066fd77fcc08eb1d54173e28fd6899618b83605.tar.gz
Save MUC room name in ProfMucWin
We will need this if we want to display the Name instead of the JID.
-rw-r--r--src/ui/win_types.h1
-rw-r--r--src/ui/window.c1
-rw-r--r--src/xmpp/iq.c4
3 files changed, 6 insertions, 0 deletions
diff --git a/src/ui/win_types.h b/src/ui/win_types.h
index 5307a483..68ed719e 100644
--- a/src/ui/win_types.h
+++ b/src/ui/win_types.h
@@ -165,6 +165,7 @@ typedef struct prof_chat_win_t {
 typedef struct prof_muc_win_t {
     ProfWin window;
     char *roomjid;
+    char *room_name;
     int unread;
     gboolean unread_mentions;
     gboolean unread_triggers;
diff --git a/src/ui/window.c b/src/ui/window.c
index c062e694..9f360cbb 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -493,6 +493,7 @@ win_free(ProfWin* window)
     {
         ProfMucWin *mucwin = (ProfMucWin*)window;
         free(mucwin->roomjid);
+        free(mucwin->room_name);
         free(mucwin->enctext);
         free(mucwin->message_char);
         break;
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index 7589c547..0e4dd151 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -2077,6 +2077,10 @@ _room_info_response_id_handler(xmpp_stanza_t *const stanza, void *const userdata
 
                     if (name) {
                         identity->name = strdup(name);
+                        ProfMucWin *mucwin = wins_get_muc(cb_data->room);
+                        if (mucwin) {
+                            mucwin->room_name = strdup(name);
+                        }
                     } else {
                         identity->name = NULL;
                     }