about summary refs log tree commit diff stats
path: root/src/event
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-05-25 13:04:19 +0200
committerMichael Vetter <jubalh@iodoru.org>2020-05-25 13:04:19 +0200
commitde8975c008aa4016e7bc1b817a62d90f9f45cefa (patch)
tree20d979e8f67895d39ca8fee74e5b49999839ac2c /src/event
parent4b5711fad5585149de65319a8f27cb7ba3a439a5 (diff)
downloadprofani-tty-de8975c008aa4016e7bc1b817a62d90f9f45cefa.tar.gz
Add and use connection_get_barejid()
Instead of connection_get_fulljid() and then creating a Jid from it.
Diffstat (limited to 'src/event')
-rw-r--r--src/event/client_events.c7
-rw-r--r--src/event/server_events.c6
2 files changed, 6 insertions, 7 deletions
diff --git a/src/event/client_events.c b/src/event/client_events.c
index e57f3875..a7ee3028 100644
--- a/src/event/client_events.c
+++ b/src/event/client_events.c
@@ -84,10 +84,9 @@ cl_ev_connect_account(ProfAccount *account)
 void
 cl_ev_disconnect(void)
 {
-    const char *jid = connection_get_fulljid();
-    Jid *jidp = jid_create(jid);
-    cons_show("%s logged out successfully.", jidp->barejid);
-    jid_destroy(jidp);
+    char *mybarejid = connection_get_barejid();
+    cons_show("%s logged out successfully.", mybarejid);
+    free(mybarejid);
 
     ui_close_all_wins();
     ev_disconnect_cleanup();
diff --git a/src/event/server_events.c b/src/event/server_events.c
index ac93a951..542a974e 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -630,11 +630,11 @@ sv_ev_incoming_message(ProfMessage *message)
     char *looking_for_jid = message->from_jid->barejid;
 
     if (message->is_mam) {
-        Jid *my_jid = jid_create(connection_get_fulljid());
-        if (g_strcmp0(my_jid->barejid, message->from_jid->barejid) == 0) {
+        char *mybarejid = connection_get_barejid();
+        if (g_strcmp0(mybarejid, message->from_jid->barejid) == 0) {
             looking_for_jid = message->to_jid->barejid;
         }
-        jid_destroy(my_jid);
+        free(mybarejid);
     }
 
     chatwin = wins_get_chat(looking_for_jid);