Michael Vetter
61f66966dd
Check for correct delay tag for muc timestamps
...
https://github.com/profanity-im/profanity/issues/1190 had another issue:
Sometimes servers send multiple </delay> and we just checked the first
one we got and only used it if the 'from' attribute was fitting.
However it could be that we actually wanted the second </delay> element
and there the 'from' would have been right.
So we need to loop through them until we get the one with the fitting
'from'.
Fix https://github.com/profanity-im/profanity/issues/1190
2019-11-13 09:41:19 +01:00
Michael Vetter
68af0aad65
_handle_groupchat(): get correct origin-id stanza
...
The problem is that in _handle_groupchat() we look for
STANZA_NS_STABLE_ID which will result in origin-id or stanza-id.
It seems like prosody servers send origin-id first, so this worked in
all my tests. But actually we cannot be sure of the order.
So far we stopped after the first element was found.
I only found xmpp_stanza_get_child_by_ns() and
xmpp_stanza_get_child_by_name() in libstrophe. But we need a combination
of both.
So I created stanza_get_child_by_name_and_ns() for Profanity. I need to
remember to upstream this to libstrophe later (if they really don't have
such a function).
Fix https://github.com/profanity-im/profanity/issues/1223
2019-11-08 15:05:49 +01:00
Michael Vetter
f71de61b9d
Don't override ProfMessage Id with origin-id
...
Profanity sends the same value for both. Other clients might not.
Safe both since we could need them later.
Once we implement Last Message Correction we will need the regular id.
If we override it with origin-id and another client chooses to not use
the same value for id and origin-id then we can't interpret the id sent
with the LMC request correctly.
2019-10-31 13:45:44 +01:00
Michael Vetter
7dd747b58d
Set mucuser in carbon case
...
Also we initialize mucuser properly.
Now in case of a carbon of a MUC PM we sv_ev_incoming_carbon() which
calls _sv_ev_incoming_plain() and then we log it via chat_log_msg_in()
in there.
But we also get the sv_ev_incoming_private_message() and call
chat_log_msg_in() in there too. So the incoming message get's logged
twice.
2019-10-29 10:41:07 +01:00
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
James Booth
948d63d855
Tidy _handle_carbons
2016-08-20 21:37:20 +01:00
James Booth
d61abd3577
Use libstrophe xmpp_message_get_body convenience function
2016-08-20 19:23:32 +01:00
James Booth
39ff399626
Use libstrophe xmpp_message_new convenience function
2016-08-20 19:08:13 +01:00
James Booth
45048e3ac8
Replace stanza_create_message with libstrophe convenience functions
2016-08-20 18:51:19 +01:00
James Booth
24c3eff428
Use libstrophe convenience functions for stanza attributes
2016-08-20 18:16:51 +01:00
James Booth
a978bb12bf
Send receipt request only when receiver supports feature
...
issue #829
2016-08-18 22:53:23 +01:00
James Booth
0a57c4de78
Tidy headers
2016-07-24 15:43:51 +01:00
James Booth
e8fc80f5c1
Update GPL link in headers
2016-07-24 01:14:49 +01:00
James Booth
d1c71e98f4
Move connection fulljid function
2016-05-06 01:12:54 +01:00
James Booth
88f423afea
Rename jabber_ functions
2016-05-06 00:53:03 +01:00
James Booth
f6fa63b374
Renamed connection.c -> session.c
2016-05-05 22:10:10 +01:00
James Booth
aabe3afff8
Rename stanza handler init functions
2016-05-02 22:34:43 +01:00
James Booth
31ab43ea2d
Free stanza text and DiscoInfo features
2016-05-02 00:40:16 +01:00
James Booth
2bacd43a16
Free stanza text on plugin send hooks
2016-05-01 23:41:57 +01:00
Dmitry Podgorny
efbf233c85
Define stanza's attributes as const char*
...
In most get-like funcitons libstrophe returns pointer to a string
that resides in an internal structure (e.g. xmpp_stanza_t). Hence,
Profanity must not change such strings. Define respective variables
as 'const char*' to reduce a chance of error and conform future
libstrophe's interface.
This patch mostly replaces 'char *' with 'const char*', but also
fixes two memory leaks after stanza_get_reason(). Add comment within
stanza_get_reason() to fix conflict with different allocator types.
2016-04-27 10:31:28 +00:00
Dominik Heidler
1b0ce852bb
Implement XEP-0363: HTTP File Upload
2016-04-26 23:50:55 +02:00
James Booth
9b177a9e01
Removed #AX_PREFIX_CONFIG_H
2016-03-31 21:05:02 +01:00
James Booth
94b9b1d8e4
Merge branch 'master' into stanza-hooks
2016-03-29 21:44:18 +01:00
James Booth
7b138b71db
PGP: Also encrypt using sender public key
2016-03-29 21:24:37 +01:00
James Booth
d39e48ba18
Use one stanza handler per type (message, iq, presence)
...
Allows plugins to stop stanza processing
2016-03-28 01:25:48 +01:00
James Booth
8933d59b03
Added basic stanza receive eooks
2016-03-27 21:36:29 +01:00
James Booth
7b34f72007
Use xmpp_send_raw_string instead of xmpp_send_raw
2016-03-26 16:44:02 +00:00
James Booth
d0397f3da5
Added stanza send hooks for plugins
2016-03-26 15:50:16 +00:00
James Booth
6f537c3818
Add PGP decryption for incoming/outgoing carbons
2016-03-22 00:20:29 +00:00
James Booth
1f90aca503
Merge branch 'master' into plugins-c
...
Conflicts:
src/main.c
src/ui/console.c
2016-02-14 23:00:52 +00:00
James Booth
e53e94f1e2
Updated copyright
2016-02-14 22:54:46 +00:00
James Booth
41fe8c22b1
Added C plugin code from plugins branch
2016-02-14 22:28:55 +00:00
James Booth
c8a6bdb381
Applied coding style to src/xmpp/
2015-10-26 00:14:23 +00:00
James Booth
2b88e2f1bf
Check for libmesode, fall back to libstrophe
2015-09-21 21:40:04 +01:00
James Booth
b266e4d035
Pass delay timestamp to all incoming chat events
2015-09-08 20:18:31 +01:00
James Booth
2af5c151a0
Tidied pgp memory allocations
2015-08-11 01:00:23 +01:00
James Booth
0410dd90f1
Free timestamp and id for receipts
2015-08-09 23:08:36 +01:00
James Booth
7151792b8c
Handle private messages that include muc#user namespace
2015-08-02 01:12:54 +01:00
Sam Whited
167ee28ec0
Add no-copy and no-store hints to OTR messages
2015-07-01 09:04:54 -05:00
James Booth
d5f79c7b35
Use reference counts for GDateTimes #516
2015-06-30 16:21:21 +01:00
James Booth
dd206ef637
WIP fix for #516 , needs memory cleanup
2015-06-29 23:48:41 +01:00
James Booth
240f6a3f79
Fixed various jid and account mem leaks
2015-06-24 20:53:04 +01:00
James Booth
5669799690
Encryption modes for sv_ev_incoming_message
2015-06-21 20:08:46 +01:00
James Booth
9b991ae058
Extracted chat session code from message senders
2015-06-21 17:11:23 +01:00
James Booth
e45afd5c09
Added pgp checks for message sending
2015-06-21 01:48:25 +01:00
James Booth
65ea572dae
Merge branch 'master' into pgp
2015-05-04 21:31:22 +01:00
James Booth
a0c872edf8
Extracted carbons handling
2015-05-04 21:31:05 +01:00
James Booth
a5677206e9
Merge branch 'master' into pgp
2015-05-04 21:20:40 +01:00
James Booth
ac940c2c8a
Revert "Added carbons handler"
...
This reverts commit ff867e7f2b
.
2015-05-04 21:18:53 +01:00
James Booth
0f3bece9e2
Merge branch 'master' into pgp
2015-05-03 02:35:15 +01:00
James Booth
ff867e7f2b
Added carbons handler
2015-05-03 02:34:58 +01:00
James Booth
f65c82e112
Merge branch 'master' into pgp
2015-05-03 01:48:32 +01:00
James Booth
f25f90b38b
Extracted receipt request processing in message.c
2015-05-03 01:48:12 +01:00
James Booth
d3f4347513
Merge branch 'master' into pgp
...
Conflicts:
src/xmpp/message.c
2015-05-03 01:30:14 +01:00
James Booth
530c060d2a
Extract private message hanlding in message.c
2015-05-03 01:25:33 +01:00
James Booth
79d21d4cd2
Merge branch 'master' into pgp
2015-05-03 00:35:47 +01:00
James Booth
236c854419
Tidy message.c
2015-05-03 00:35:31 +01:00
James Booth
03ef791401
Merge branch 'master' into pgp
2015-05-03 00:06:12 +01:00
James Booth
5a90e2862e
Extracted receipt received handler
2015-05-03 00:05:47 +01:00
James Booth
0bc4377ad7
Merge branch 'master' into pgp
2015-05-02 23:40:34 +01:00
James Booth
ddc64755a0
Tidy message.c
2015-05-02 23:40:14 +01:00
James Booth
cade9e7c4c
Merge branch 'master' into pgp
2015-05-01 00:55:58 +01:00
James Booth
0118178080
Removed server event delegation functions
2015-05-01 00:55:40 +01:00
James Booth
5d827cafec
Merge branch 'master' into pgp
...
Conflicts:
src/xmpp/message.c
2015-04-28 23:57:28 +01:00
James Booth
8aba52f4fe
Renamed event functions
2015-04-28 23:38:56 +01:00
James Booth
d612b9695a
Merge branch 'master' into pgp
...
Conflicts:
src/xmpp/message.c
2015-04-19 17:33:35 +01:00
James Booth
e688dd7d28
Renamed server event functions
2015-04-19 17:29:54 +01:00
James Booth
60f94722d4
Merge branch 'master' into pgp
2015-04-19 16:56:11 +01:00
James Booth
424f52c3fa
Moved server_events to event/
2015-04-19 16:54:16 +01:00
James Booth
7e4b756e44
Merge branch 'master' into pgp
2015-04-11 23:38:44 +01:00
James Booth
a2ccd89646
Autogenerate room name with UUID for /join with no args
2015-04-11 23:37:52 +01:00
James Booth
5305a3e3a6
Fixed message sending when not PGP key found
2015-04-05 16:03:50 +01:00
James Booth
c8c12a8f7a
Merge branch 'master' into pgp
2015-03-29 03:17:41 +01:00
James Booth
71c2be599b
Use password for chat room invites
2015-03-29 03:16:41 +01:00
James Booth
c36d4b3643
Merge branch 'master' into pgp
2015-03-29 02:51:05 +01:00
James Booth
1917d4c095
Added password to direct invites
2015-03-29 02:46:59 +01:00
James Booth
c1eceebcba
Merge branch 'master' into pgp
2015-03-29 00:59:42 +00:00
James Booth
fac2b2cf66
Added check members only room to send mediated invites
2015-03-28 22:51:41 +00:00
James Booth
0f6bc9b55d
Decrypt incoming messages
2015-03-25 00:05:32 +00:00
James Booth
eb5cb7b2f8
Send encrypted messages
2015-03-24 23:34:24 +00:00
James Booth
f1f047889e
Added individual options to send and request delivery receipts
2015-03-19 22:57:51 +00:00
James Booth
125719673b
Return after message receipt
2015-03-14 23:25:20 +00:00
James Booth
a79ea3cbe2
Merge branch 'master' into xep-0184
2015-03-14 16:45:44 +00:00
James Booth
ede3368f7a
Check for sent and received carbons
2015-03-14 16:44:21 +00:00
James Booth
060dcc24e3
Merge branch 'master' into xep-0184
...
Conflicts:
src/xmpp/message.c
2015-03-14 16:41:40 +00:00
James Booth
2fc7937dcd
Fixed error with /otr start with carbons enabled
2015-03-14 16:37:33 +00:00
James Booth
57c7564445
Show message received text for receipts
2015-03-11 23:47:11 +00:00
James Booth
78becceedb
Added basic delivery receipts
2015-03-11 23:18:28 +00:00
James Booth
2ff6873cf1
Send private carbons element with message when encrypted
2015-03-10 21:16:34 +00:00
James Booth
945f29873e
Merge remote-tracking branch 'oliverlemoal/xep-0280' into xep-0280
2015-03-08 21:51:50 +00:00
Olivier LE MOAL
ced5a8c2e0
merge
2015-02-23 10:47:54 +01:00
Olivier Le Moal
3eeafa2277
fix segfault on self sent message carbon
2015-02-21 22:22:21 +01:00
James Booth
b3be26a214
Updated copyright
2015-02-10 23:16:09 +00:00
Olivier LE MOAL
48f9f3b3b0
Add XEP-0280 support
2015-02-10 11:32:22 +01:00
Olivier LE MOAL
e3feacddd6
Add XEP-0280 support
2015-02-02 11:10:05 +01:00
James Booth
13f0166aa0
Only show UI events for chat states when in session
2015-01-11 23:04:22 +00:00
James Booth
c16871d143
Added remaining chat states
2015-01-11 20:20:17 +00:00
James Booth
76bd2ec13f
Send active chat state, handle composing and gone from recipients
2015-01-10 22:03:40 +00:00
James Booth
c3ad3c0ba6
Show resource in titlebar and on each message
2015-01-10 18:35:59 +00:00
James Booth
5e7d2f5f91
Removed chat states from chat_session module, WIP
2015-01-08 00:57:25 +00:00
James Booth
8bbf126e83
Refactored chat sessions in _chat_handler
2015-01-07 00:17:54 +00:00