1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00
Commit Graph

329 Commits

Author SHA1 Message Date
Steffen Jaeckel
b535921484 introduce auto_jid and refcounting in Jid
This also fixes a memory leak from within `_handle_groupchat()` in [0].

[0] src/xmpp/message.c

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-01-19 10:40:25 +01:00
Steffen Jaeckel
1a85448bf2 improve const correctness
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-01-18 20:11:13 +01:00
Michael Vetter
3adc399da0 Update copyright year 2023-01-10 10:37:25 +01:00
Michael Vetter
449c7ce2ba ox: add helper message in case signcrypt doesnt work
Most likely they didnt trust/sign the key. Which is described in the
profanity-ox-setup man page.
2022-06-29 13:26:15 +02:00
Michael Vetter
a40a0f5189 Split ox functions from gpg.c to ox.c 2022-06-29 09:17:15 +02:00
Michael Vetter
4d6bc1adf8
Merge pull request #1717 from MarcoPolo-PasTonMolo/fix/chat-with-self-duplicate-msgs
Fix duplicate messages in chat with oneself.
2022-06-11 12:33:56 +02:00
MarcoPolo-PasTonMolo
91e8a89b59 Fix duplicate messages in chat with oneself.
Messages would get duplicated when you chat with yourself, worse if you
had omemo enabled the duplicated message would say something along the
lines of "Your client doesn't support OMEMO". The cause was carbons
when the message was sent from another client, whilst it was a sent
and received message when profanity was the one to send it. This commit
ignores the carbon message in the 1st case and ignores the received one
in the 2nd.

Fixes https://github.com/profanity-im/profanity/issues/1595
2022-05-31 15:55:02 +03:00
MarcoPolo-PasTonMolo
4839093a8b Make muc config update after form submit
Muc configuration in profanity used to not update until next login, ie:
make muc non_anonymous and members_only but be unable to start omemo
until next login. Now a disco info request is sent after forrm submit
and chatroom details are changed accordingly.

Fixes https://github.com/profanity-im/profanity/issues/1347
2022-05-27 18:51:35 +03:00
Michael Vetter
1330ad4e1e Update copyright year 2022-05-09 15:43:33 +02:00
Michael Vetter
66eeccf408 ox: only process proper messages
We only want to have the decrypted message or the alternative body in
message->plain.

Also let's print error messages if it makes sense and log other issues.

Partly addresses the commit in the comit mesage of:
2dc0cc489c
2022-05-04 16:11:00 +02:00
Michael Vetter
1eaa2c1529 ox: prefix function _openpgp_signcrypt with ox_
To make the destinction clearer and easier to search.
2022-05-04 14:26:43 +02:00
Stefan Kropp
c9e6a89aea Bugfix OX rpad generation
________________________________________
< No comment - should be much better now >
 ----------------------------------------
 \
  \
   \ >()_
      (__)__ _
2022-05-03 23:00:11 +02:00
Michael Vetter
2dc0cc489c ox: dont print empty body message
Fix https://github.com/profanity-im/profanity/issues/1693

```
@StefanKropp @DebXWoody please check `_handle_ox_chat()` I don't
understand what you are doing there.
1)
First plain is assigned `message->plain =
p_ox_gpg_decrypt(xmpp_stanza_get_text(ox));`
and then in the same if block you overwrite this with `message->plain =
xmpp_stanza_get_text(b);` without freeing the old value as far as I can
see.

2)
Sometimes even doing `message->plain = "OX error: No payload found";`.
Shouldn't there be a `strdup()`? I think later on we try to free the
whole message struct. So we can't mix this static things.
```
2022-04-27 17:00:30 +02:00
Michael Vetter
8ee3a43983 ox: remove comment 2022-04-27 16:36:30 +02:00
Michael Vetter
0293b639c7 Fix typo: paylod -> payload 2022-04-12 20:52:39 +02:00
Michael Vetter
57fb10f0bf Fix typos in comments 2022-02-18 18:59:32 +01:00
Michael Vetter
b67054aa39
Merge branch 'master' into xep/xep0107-user-mood 2021-12-06 13:49:04 +01:00
Michael Vetter
6c3e6a5262 xep-0107: adapting the pubsub/headline code
Like mentioned on the review at
https://github.com/profanity-im/profanity/pull/1605 I don't ge why
@DebXWoody changed the code like he did.

I changed it to something that made more sense to me now.
Instead of looking for headline in two places and checking for pubsub in
a headline place (only).

I didn't check this deeply. And still have a feeling that this is not
the best way to go. But I didn't read the XEP yet.

Added a TODO to the code regarding this too.

A quick skimming through https://xmpp.org/extensions/xep-0107.html
doesn't show me anything regarding headline. So I really don't see why
this needs to go here.

Hopefully @DebXWoody checks this in the future. But since he didn't
react on the PR I decided to make some adjustments myself so we can
merge it.
2021-12-06 13:44:04 +01:00
DebXWoody
23e886ed5e Add xep-0107: User Mood support
Implementation of XEP 0107 - User Mood
2021-12-06 13:32:54 +01:00
Michael Vetter
2f7317cc18 Fix carbons criteria
We came into the carbons checking code when we received `<private
xmlns="urn:xmpp:carbons:2"/>`. Which actually marks a message to _not_
be a carbon.

In this code we also make sure that carbons only come from us.
If not we don't call the message handler code.

So we should actually only check for `<sent xmlns='urn:xmpp:carbons:2'>`
and `<received xmlns='urn:xmpp:carbons:2'>`.

Thanks pukkamustard and Holger.

Fixes https://github.com/profanity-im/profanity/issues/1614
2021-11-25 15:33:49 +01:00
Steffen Jaeckel
ffc0b49ab1 first step to remove libmesode
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2021-10-27 22:45:44 +02:00
Michael Vetter
3a9cffe013
Merge pull request #1566 from DebXWoody/bugfixing/ox
Bugfixes for OX implementation
2021-07-01 18:26:06 +02:00
DebXWoody
d01ba72535
OX bug fix
* Help / message description
 * C-Code format
2021-07-01 18:08:40 +02:00
Michael Vetter
06482fdaef Add option to only allow messages from jids in roster
`/silence on` will throw away all messages (type: chat, normal) that
come from jids that are not in the roster.

Implement https://github.com/profanity-im/profanity/issues/955
2021-07-01 18:02:03 +02:00
DebXWoody
6173e015f5
OX bug fixing
* Don't decryption if there is no private key
 * Decryption error messages
2021-06-29 20:25:50 +02:00
DebXWoody
2a011e69ac
Bugfixes for OX implementation
* autocomplete for /ox discover
 * fixed help description
 * Implemented /ox char command
 * Validated KeyID length
2021-06-28 21:28:58 +02:00
Michael Vetter
46cd09cce4 XEP-0353: Display a notice when receiving a call
Display a notice in the console when someone tries to call us.

Implement https://github.com/profanity-im/profanity/issues/1525
2021-06-09 20:14:57 +02:00
DebXWoody
183eeca632
Message received without body error log
This is not an error, the message has no body because of
XEP-0085: Chat State Notifications.

Changed log level from error to info.
2021-06-03 19:55:13 +02:00
DebXWoody
de06cd395b
Improved OMEMO logging
The most loggings has been set to debug. Just in case of error / problem the
logging should be done with log-level ERROR or WARNING.

We will see later, which loggings should be switched to log-level INFO.

This improvement has been done to find OMEMO bugs.

See also: #1070 #1530 #1538
2021-05-28 17:45:15 +02:00
Michael Vetter
56efb1a298 message: correct type checking
Found by DebXWoody.
Led to always be true (which still made it work in most cases).
2021-05-14 16:12:38 +02:00
Michael Vetter
8c50b63e56 Goodbye beautiful IDs
It was a great ride!

IDs look instead of
`TE5BTDc2ZTc3YTMwZGU3MDgzMzllOTliNGExNjVmMjZkMTY1ZmUyZGEyNTUxMjVmODBkMmQzOGMxYWI2ZjAxNzdiM2Q=`
more like `7HcnNSoO1MVvb0p9a9e293152922853e910b8b1a65bb26e225a0568` now.

Regards https://github.com/profanity-im/profanity/issues/1520

We still has our identifier into it to filter MUC reflected messages.

profident maybe should be changed to be longer or be generated upon each
start.
2021-04-14 22:47:58 +02:00
Michael Vetter
3884a4d35b message: parse stanzaid in MUC case
There was a todo for this in message.c which got forgotten.

This was most likely also the reason why there were NULL entries for
this in the DB which DebXWoody mentioned in the MUC.

Thus comparison was with NULL and no new entries were added to the
database.

Edit:
After checking pull requests I see Stefans draft PR:
https://github.com/profanity-im/profanity/pull/1505

So let's add him as co-author.

Co-authored-by: Stefan Kropp <stefan@debxwoody.de>
2021-03-25 17:09:52 +01:00
Michael Vetter
8df5e99981 message: make _handle_error safer 2021-03-25 16:50:10 +01:00
Michael Vetter
1f96e14ce7 message: simplify _handle_headline 2021-03-25 15:43:57 +01:00
Michael Vetter
b2a02424ed message: make _receipt_request_handler safer 2021-03-25 15:38:48 +01:00
Michael Vetter
099260a4e3 message: make _handle_receipt_received safer 2021-03-25 15:37:54 +01:00
Michael Vetter
2236242407 message: make _handle_groupchat safer 2021-03-25 15:36:17 +01:00
Michael Vetter
ca9c946ddc message: simplify _handle_conference 2021-03-25 15:33:30 +01:00
Michael Vetter
2601fc5571 message: make _handle_form safer 2021-03-25 15:27:59 +01:00
Michael Vetter
b1bd1ecca8 message: make _message_handler safer 2021-03-25 15:26:16 +01:00
Michael Vetter
11382a8bf3 mesage: make _handle_ox_chat safer
And on the way fix a memleak
2021-03-25 15:20:53 +01:00
Michael Vetter
8a6d256fc1 message: make _handle_chat safer 2021-03-25 15:07:09 +01:00
Michael Vetter
ee87e5b036 message: make _handle_muc_private_message safer 2021-03-25 15:03:35 +01:00
Michael Vetter
d2dc440535 message: fix potential segfault in _receipt_request_handler 2021-03-25 11:56:38 +01:00
Michael Vetter
e396e863dd message: safeguard _handle_receipt_received
This shouldnt be necessary since we check for the receipt outside
alreayd. Let's be on the safe side though in case code gets changed
later.
2021-03-25 11:54:59 +01:00
Michael Vetter
9cfe5ec787 message: reorder _handle_groupchat 2021-03-25 11:51:42 +01:00
Michael Vetter
96b228728e message: fix possible segfault in _handle_conference 2021-03-25 11:43:42 +01:00
Michael Vetter
f21a99eaf8 message: fix possible segfault in _handle_muc_user 2021-03-25 11:38:22 +01:00
Michael Vetter
e656bdb83c message: fix possible segfault in _message_handler 2021-03-25 11:34:14 +01:00
Michael Vetter
5cec47c86a Add support to approve MUC voice requests
A form will open. One can then use `/field4 on` `/form submit`.

Implements https://github.com/profanity-im/profanity/issues/1507
2021-03-17 16:16:59 +01:00