about summary refs log tree commit diff stats
path: root/src/xmpp/message.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-10-07 00:01:18 +0200
committerMichael Vetter <jubalh@iodoru.org>2019-10-07 00:05:37 +0200
commitb3ed21366879c53792277c069766e2d7f6cd5c5b (patch)
treebe1c3076f44e3368126b79bd4e13a0fb476ace2f /src/xmpp/message.c
parentf1d31e024cd25be5978d933968b311d3df2a71b9 (diff)
downloadprofani-tty-b3ed21366879c53792277c069766e2d7f6cd5c5b.tar.gz
Improve MUC 1:1 logging
If we get a private message from a user in a MUC profanity shows this
like:
`profanity@roomsASDF.dismail.de/Martin: Hi`

This was so far logged at:
`~/.local/share/profanity/chatlogs/my-account-at-server/profanity_at_rooms.dismail.de/2019_09_04.log` as:

```
10:48:13 - profanity@rooms.dismail.de: Hi
```

So the nickname was not saved anywhere. This is due to us not knowing
whether we got a regular message from user@server.org/resource or a MUC
PM from room@server.org/user.

We now check for `<x xmlns='http://jabber.org/protocol/muc#user' />` and
add the resourcepart to the logging if we get it.

The file will be created at
`~/.local/share/profanity/chatlogs/my-account-at-server/profanity_at_rooms.dismail.de_nick` and look like:

```
23:59:43 - nick: Hi
```

Fix https://github.com/profanity-im/profanity/issues/1184
Diffstat (limited to 'src/xmpp/message.c')
-rw-r--r--src/xmpp/message.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 1df853ac..00f5baf3 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -1089,6 +1089,10 @@ _handle_chat(xmpp_stanza_t *const stanza)
     ProfMessage *message = message_init();
     message->jid = jid;
 
+    if (mucuser) {
+        message->mucuser = TRUE;
+    }
+
     message->timestamp = stanza_get_delay(stanza);
     if (body) {
         message->body = xmpp_stanza_get_text(body);