1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-30 21:55:24 +00:00
Commit Graph

209 Commits

Author SHA1 Message Date
Michael Vetter
22bf281399 Make prof_identifier const 2019-10-22 12:47:32 +02:00
Michael Vetter
ba18752405 Use UUID in origin-id and id
Let's use UUID to have a more random string then just 10 alphanumeric
values.
2019-10-22 11:10:37 +02:00
Michael Vetter
2a4d1b8410 Free hmac and msgid 2019-10-19 08:18:37 +02:00
Michael Vetter
4d7a496ae2 Change origin-id/id algo
Hash twice.
Use HMAC SHA256 from glib.
2019-10-18 16:12:26 +02:00
Michael Vetter
06f300a42c Move message sent by us logic in own function 2019-10-18 14:50:25 +02:00
Michael Vetter
53640f6e97 Remove prefix from stanza id
We sent `prof_prefix_uuid` as id. Where the prefix was also optional.
We don't need this at all.
2019-10-17 15:40:40 +02:00
Michael Vetter
b3ed213668 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
2019-10-07 00:05:37 +02:00
Michael Vetter
f1d31e024c Fix typo handel -> handle 2019-10-06 23:00:08 +02:00
Michael Vetter
6ab6fe8649 Detect MUC history correctly with some Prosody versions
Some versions of prosody send the domainpart.
See https://issues.prosody.im/1416

Workaround to handle those cases.
Thanks to Holger Weiss for helping with this!

Fix https://github.com/profanity-im/profanity/issues/1190
2019-09-30 10:01:19 +02:00
Michael Vetter
09c5f38f11 Set message->plain in carbon case
message->plain should always contain something. In the case of the
carbons we forgot to set if rom the body in case it's empy.
2019-09-04 10:27:03 +02:00
Holger Weiß
3228ab47d3 Don't render (all) delayed messages as MUC history
Double-check that a <delay/> tag on a groupchat message was actually
added by the MUC service (rather than the sending client) before
assuming it was received from the MUC history.

Fixes #1173.
2019-08-20 17:51:26 +02:00
Paul Fariello
c0e8f72276 Fix plaintext private message handling 2019-07-04 14:02:42 +02:00
Michael Vetter
4a6b1665f3 Use correct jid variable 2019-07-03 15:28:46 +02:00
Michael Vetter
f504a02167 Define goto out in _private_chat_handler() 2019-07-03 15:27:31 +02:00
Michael Vetter
19902e8e21 Set plain message in _private_chat_handler
In case that plain is NULL we need to copy over from body.

Fix https://github.com/profanity-im/profanity/issues/1144
2019-07-03 15:16:19 +02:00
Paul Fariello
45e8467231 Fix a segfault when carbon has no body 2019-06-21 16:49:52 +02:00
Paul Fariello
498b75afa9 Don't highlight cleartext message as untrusted 2019-06-21 15:50:41 +02:00
Paul Fariello
ac96a6951d Fix segfault when receiving messages without ID 2019-06-21 12:03:08 +02:00
Paul Fariello
a444137e66 Fix NULL pointer when handling non encrypted message in MUC 2019-06-21 11:34:36 +02:00
Paul Fariello
f831f65737 Rename prof_message_t into ProfMessage 2019-06-20 14:30:45 +02:00
Paul Fariello
44d16e9141 Add prof_message_t to wrap all message attributes
Probably missing copy of body to plain in carbon and privmessage.
Only covers the incoming message path because goal is OMEMO decryption
of untrusted message.
Cover some of the log functions but not all.
2019-06-20 14:30:42 +02:00
Paul Fariello
3bb3cc625d Use flags in xmmp/message.c for encryption and trust 2019-06-20 14:30:37 +02:00
Paul Fariello
a650ecc67d Add trusted state after OMEMO decryption
Use it to print message on red background if not trusted.
2019-06-20 14:29:55 +02:00
Michael Vetter
b8c8059402 Call message_handlers_clear() upon disconnect
Free pubsub_event_handlers. Fix memory leaks.
2019-06-20 12:37:32 +02:00
Paul Fariello
e69f947547 Rework MUC reflected message filtering
Reflected messages can't be filtered by nick only otherwise you might
ignore messages comming from you on another devices.

Consequently we maintain a list of sent messages id in mucwin.
To be sure the id will be correctly reflected we use the origin-id
stanza.
2019-04-10 17:23:46 +02:00
Paul Fariello
65b3f82c5f Fix devicelist notification handler
devicelist handler should be kept after trigger
2019-04-10 17:23:46 +02:00
Paul Fariello
2015ba201d Ensure encrypted carbon of own message are marked as encrypted 2019-04-10 17:23:45 +02:00
Paul Fariello
91ee289c77 Add support for disconnect in OMEMO 2019-04-10 17:12:31 +02:00
Paul Fariello
4e1ffa6bdb Log and print outgoing encrypted message 2019-04-10 17:12:31 +02:00
Paul Fariello
a9d55dec92 Add support for sending encrypted message in MUC 2019-04-10 17:12:31 +02:00
Paul Fariello
a3897abba1 Add MUC message decryption 2019-04-10 17:12:31 +02:00
Paul Fariello
36ce21fc6d Add store hints for OMEMO encrypted messages
Store hints are required has some server might discard messages without
body. Here we ensure OMEMO messages are stored on server and delivered
to client when they connect back.

It's really important since it avoid libsignal to desynchronize
counters.
2019-04-10 17:12:31 +02:00
Paul Fariello
97c661271b Add support for libsignal-protocol-c 2.3.2 2019-04-10 17:12:31 +02:00
Paul Fariello
695694051e Remove hints preventing carbons to work properly 2019-04-10 16:31:45 +02:00
Paul Fariello
bcd582be42 Don't explicitely disable carbons for OMEMO messages 2019-04-10 16:31:45 +02:00
Paul Fariello
9b8c1d7d2c Add support for encrypted carbon
Fix {signed,}_pre_key store
2019-04-10 16:31:45 +02:00
Paul Fariello
810ea32223 Follow normal workflow for OMEMO message reception
We try to decrypt all messages, if it's successful we use
sv_ev_incoming_message even for OMEMO messages. We pass an OMEMO
boolean to let UI be aware that message were encrypted.
2019-04-10 16:03:50 +02:00
Paul Fariello
d871efdcf9 Add chat session state to OMEMO message stanza 2019-04-10 16:03:50 +02:00
Paul Fariello
904904d74e Add default body on OMEMO message 2019-04-10 16:03:50 +02:00
Paul Fariello
0fb27dc496 Add OMEMO message encryption and decryption 2019-04-10 16:03:50 +02:00
Paul Fariello
756fefb09a Fix devicelist subscription and handle pubsub event
Devicelist subscription can be done directly with caps_add feature.
2019-04-10 16:03:50 +02:00
Paul Fariello
1ae5d9f1f8 Add pubsub event callback
Also add generic message callback struct
2019-04-10 16:03:50 +02:00
Michael Vetter
4792984f1e XEP-0027: Mention XEP in message body
With all the different kinds of encryption (OMEMO, OTR3 OTR4, PGP in XEP-0027 and XEP-0373) it might be helpful to know which kind of encryption is used.
2019-02-20 10:48:28 +01:00
Michael Vetter
706af9a900 Update copyright to include 2019 2019-01-22 11:31:45 +01:00
Michael Vetter
6d80700329 Move ID generation to xmpp folder
create_unique_id() was changed to use UUIDs instead of a counter in the
last commit. Since now it depends on connection_create_uuid() which is
in the xmpp subfolder the function should also be moved there.

Renamed it to connection_create_stanza_id() and moved it to
src/xmpp/connection.c.

Discussion happened in https://github.com/boothj5/profanity/pull/1010
2018-08-30 11:17:04 +02:00
James Booth
250e972b7a Update copyright 2018-01-21 15:00:02 +00:00
James Booth
68a3daedb9 Update Copyright 2017-01-28 17:24:22 +00:00
James Booth
b712820c99 Check barejid in carbons 2017-01-24 13:37:28 +00:00
James Booth
8e75437a7e Add carbons from check 2017-01-23 22:25:36 +00:00
James Booth
fca59a3110 log_info on private carbons 2016-08-28 17:27:26 +01:00