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

1219 Commits

Author SHA1 Message Date
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
7f646e3668 use new libstrophe API
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2021-10-27 22:45:44 +02: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
46c8245af9 Format new register code correctly 2021-10-13 21:32:44 +02:00
Michael Vetter
e0e45b7b24
Merge pull request #1574 from binex-dsk/master
Add in-band account registration
Fix https://github.com/profanity-im/profanity/issues/199
2021-10-13 21:19:22 +02:00
swirl
0653200965 registration: memory leaks, error checking 2021-10-13 15:02:05 -04:00
swirl
feaa770444 fixed crashes when server doesn't support registration 2021-10-10 15:43:14 -04:00
Michael Vetter
f21595597f Format code correctly 2021-10-05 10:01:27 +02:00
MarcoPolo-PasTonMolo
97551aa131 Fix history timestamp
Fixes https://github.com/profanity-im/profanity/issues/1423

Oldest stanza is fetched like before but now the timestamp is generated by creating date_time_from_iso8601 and then to_local, instead of trusting that the timestamp is in utc.
The procedure previously was stamp = time_val_from_iso8601() then date_time = date_time_from_utc(stamp) then local_date_time = to_local(date_time)
2021-10-05 09:56:24 +02:00
Michael Vetter
8e43ab05da Fix typos 2021-09-22 13:01:55 +02:00
Paul Fariello
314d0034ed Fix memleak 2021-08-20 15:33:31 +02:00
Paul Fariello
35814d8bd0 Log error received while publishing OMEMO device list 2021-08-20 15:32:00 +02:00
Paul Fariello
4d93df4aba OMEMO: Fix precondition-not-met handling 2021-08-19 10:02:07 +02:00
Paul Fariello
d8cee98cc7 Create devicelist if it doesn't exists 2021-08-19 10:02:07 +02:00
Paul Fariello
0b6cf20183 OMEMO: try device list creation and reconfigure on precondition-not-met 2021-08-19 10:02:07 +02:00
Paul Fariello
46fe69de9b Ensure devicelist access model is configured before updating it 2021-08-19 10:02:06 +02:00
swirl
87d2c95c87 registration: remove auth param and excess functions 2021-08-17 14:09:48 -04:00
Michael Vetter
f53b4353fd REGISTRATION FIXED 2021-08-17 14:09:48 -04:00
swirl
8a6f1b52d7 progress on fixing registration
doesnt segfault on register, but aborts when you type after registering

need to find a way to disconnect later
2021-08-17 14:09:48 -04:00
swirl
4d3f26154e hacky fix(?) for register
very bad and spaghetti will fix later
2021-08-17 14:09:48 -04:00
swirl
2cc354b6ae fixed some bugs, added some more
- Added JABBER_RAW_CONNECT[ING/ED] connection states
- Added cl_ev_connect_raw and session_connect_raw to conform to normal
connection functions
- Fixed SIGABRT during registration
- Added a check in cmd_register to ensure it's actually connected before
registering--but this will always fail atm
2021-08-17 14:09:48 -04:00
swirl
d9366a26d6 initial register command test 2021-08-17 14:09:48 -04:00
Michael Vetter
07bb790565 XEP-0377: Add forgotten namespace 2021-07-01 19:31:55 +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
Michael Vetter
226cffe75b
Merge pull request #1569 from profanity-im/feature/1434-spam-reporting
Add XEP-0377: Spam Reporting
2021-07-01 17:04:04 +02:00
Michael Vetter
7f737a3b47 Mention feature details when not supported
So that we will get aware of a version mismatch.
2021-07-01 10:36:52 +02:00
Michael Vetter
aae252e1b5
Merge pull request #1529 from dustinlagoy/access-roster-from-plugins
Access roster from plugins
2021-07-01 09:41:07 +02:00
Michael Vetter
31ebd6ab1c Add XEP-0377: Spam Reporting
Report and block:
`/blocked add someone@domain.org report-abuse This is not nice`
`/blocked add someone@domain.org report-spam This is not nice`

Regular block:
`/blocked add someone@domain.org`

Implement https://github.com/profanity-im/profanity/issues/1434
2021-07-01 00:14:32 +02:00
Michael Vetter
817a6bff54 XEP-0157: Print all available addresses 2021-06-30 11:23:22 +02:00
Michael Vetter
ef96bea82e XEP-0157: Print contact addresses 2021-06-30 10:45:59 +02:00
Michael Vetter
2f5aa124ca XEP-0157: Parse contact address stanza 2021-06-29 22:52:45 +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
Michael Vetter
8ef35290bd Add command to show single bookmark details
`/bookmark list` lists all bookmarks with its details.
`/bookmark list <jid>` shows the details of a single bookmark.

Implement https://github.com/profanity-im/profanity/issues/1558
2021-06-09 15:53:21 +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
41913a0aea OMEMO - Unable to publish own device list
If we are not able to publish our own device list, we just ignored it.
This commit will show at least an error message and informs the user that this
device is currently not in the list of devices.

See Issue: #1538

Next task will be to handle the <precondition-not-met/> conflict properly.
2021-06-01 09:44:48 +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
Dustin Lagoy
ed4d2fcfb2 Add plugin prof_get_nick_from_roster function 2021-04-28 09:17:02 -04: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
1ec606540e Get rid of asprintf and _GNU_SOURCE define
_GNU_SOURCE was even in some files where it was not needed at all
(http*).

Let's replace asprintf() with g_strdup_printf().
2021-03-30 17:38:13 +02:00
Michael Vetter
057c9ad776 Add config.h in files were it was missing
Related to https://github.com/profanity-im/profanity/issues/1512
2021-03-26 19:54:22 +01:00
Michael Vetter
acda845b2a iq: use define for 'cancel' 2021-03-26 10:05:24 +01: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
a1a37cf9bf ox: fix memleak in ox_announce_public_key 2021-03-25 17:02:59 +01:00
Michael Vetter
8df5e99981 message: make _handle_error safer 2021-03-25 16:50:10 +01:00
Michael Vetter
e09f3fb615 avatar: make _avatar_request_item_result_handler safer 2021-03-25 16:35:43 +01:00
Michael Vetter
44343a5c37 avatar: make _avatar_metadata_handler safer 2021-03-25 16:34:20 +01:00
Michael Vetter
b584a1ecd0 ox: make _ox_public_key_result safer 2021-03-25 16:30:19 +01:00
Michael Vetter
10df93ee3e ox: guard printing of fingerprint 2021-03-25 16:25:18 +01:00
Michael Vetter
fb81b80499 ox: improve error log in _ox_metadata_result 2021-03-25 16:24:07 +01:00
Michael Vetter
31a78e2629 ox: add logging prefix 2021-03-25 16:22:47 +01:00
Michael Vetter
f81ed759f5 stanza: guard mallocs
If this happens we have more serious problems :-)
But anyways..
2021-03-25 16:14:40 +01:00
Michael Vetter
d23c3dd065 stanza: simplify stanza_get_muc_destroy_alternative_room 2021-03-25 15:59:48 +01:00
Michael Vetter
caa2c7afd0 stanza: replae strcmp with g_strcmp0
since its NULL safe
2021-03-25 15:55:18 +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
fde0a0d1c6 Add support to register with a room
`/affiliation register` can now be used to register a nickname with a
MUC.

Tested with a server without forms. Couldn't find a server which
supports forms yet.

Implements https://github.com/profanity-im/profanity/issues/1210
2021-03-25 11:05:58 +01:00
Michael Vetter
ebb1be9e58 form.c: fix memleak in form_tag_exists 2021-03-17 16:18:56 +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
Thorben Günther
ec6f9df486
MUC: Add voice request
closes https://github.com/profanity-im/profanity/issues/1211
2021-03-12 14:57:00 +01:00
Michael Vetter
a7ecda7773
Merge pull request #1501 from xenrox/change-password
Add command to change password of logged in user
2021-03-11 18:18:03 +01:00
Thorben Günther
b0aea2bcff
Add command to change password of logged in user 2021-03-11 17:42:53 +01:00
Maximilian Wuttke
e217ed0b79 Update to the newest version of XEP 0363 (HTTP Upload)
Main changes:

1. Attributes instead of tags
2. Read the optional <header> tags and send them in the HTTP PUT header:

   * Authorization
   * Cookie
   * Expires

Co-authored-by: Martin Dosch <martin@mdosch.de>
2021-03-11 17:11:22 +01:00
Maximilian Wuttke
2b1ada7722 [OMEMO]: Fix bundle publishing
Use the following options in `omemo_bundle_publish()`:

- "pubsub#persist_items" = "true"
- "pubsub#access_model" = "open"

The same options are also used in Gajim.

I've tested this on two different servers. The bundle was successfully
added as a new PEP node. Test cases:

1. Normal use on my main account
2. Log in into a fresh tesst account on a different server
3. `/omemo clear_device_list`. In this case, the client(s) may have to
   be restarted.

Note: In `_omemo_bundle_publish_result`, there's a route that is taken
when the bundle publish stanza failed. In this case, the node is
configured manually, i.e. the access_model is set to 'open'. I have
manually tested this case, but this case didn't naturally occur for me.

Note: The option "pubsub#max_items=max" is REQUIRED for the bundle
publication, as per XEP-0384. However, this is not done in other clients
(I've checked the source code of Gajim and Conversations), and it is
also not supported by Prosody. Cf. <https://github.com/xsf/xeps/pull/988>.
2021-03-09 17:48:29 +01:00
Maximilian Wuttke
68469149cd Logging [OMEMO]
Also "handle" some errors in `_omemo_bundle_publish_configure` if the
stanzas can't be found
2021-03-09 17:47:43 +01:00
Maximilian Wuttke
4124856100 Variadic version of stanza_attach_publish_options 2021-03-09 17:47:37 +01:00
Maximilian Wuttke
8481698705 Logging [OMEMO] 2021-03-09 17:47:27 +01:00
Stefan
637c2c2d62 Logging [CONNECTION] 2021-03-09 17:47:22 +01:00
Michael Vetter
69e923df3b Remove forgotten debug line 2021-02-15 09:58:37 +01:00
Michael Vetter
1435c7ae14 Use correct time for MAM messages
We need the delay value from the <forward> element.

Regards https://github.com/profanity-im/profanity/issues/660
2021-02-04 21:13:31 +01:00
Michael Vetter
c2ec3e7033 Enable error logging on MAM RSM 2021-01-28 14:44:53 +01:00
Michael Vetter
840238b126 Get MAM from last 7 days
Probably should make this configurable later.
2021-01-28 14:44:53 +01:00
Michael Vetter
d3303517f7 MAM: Request more pages via RSM
Send another request with same jid and last id we got.
2021-01-28 14:44:53 +01:00
Michael Vetter
6e1e01dbb8 Adapt MAM RSM code to latest functions
Some functions changed in the meantime.
stanza_get_child_by_name_and_ns() got dropped and
xmpp_stanza_get_child_by_name_and_ns() from newer libstrophe is used.
2021-01-28 14:44:53 +01:00
Michael Vetter
db65255a5a wip: add rsm after we get the first couple of mam messages 2021-01-28 14:44:53 +01:00
Michael Vetter
69e35e86b2 mam: Use correct ID in rsm handler
Thanks to DebXWoody for the help.
2021-01-28 14:44:53 +01:00
Michael Vetter
d06ca64098 mam: fix logging message 2021-01-28 14:44:53 +01:00
Michael Vetter
014e03c72e Start working on MAM RSM to get more pages
Regards https://github.com/profanity-im/profanity/issues/660
2021-01-28 14:44:35 +01:00
Michael Vetter
8c08e64f37 Update copyright 2021-01-08 16:36:30 +01:00
Michael Vetter
881b99c062 Remove not needed include 2020-12-16 14:46:01 +01:00
Michael Vetter
a94378f206 Fix various typos 2020-12-10 09:24:32 +01:00
Michael Vetter
35aecd425f Declare counter var inside loop
We require c99/gnu99 anyways.
2020-11-09 11:33:33 +01:00
Michael Vetter
3b3c9bf4d5 Print all error stanzas
Regards https://github.com/profanity-im/profanity/issues/1435

So far we didn't print the error if it contained `<error
type="cancel">`. It appears that the code always thought this is a
service-not-available (so one is either blocked or the account doesn't
exist) and printed `Recipient not found`.

But there can be other errors as well. Like in above mentioned issue
`not-allowed`.

Let's just print the text.

In case of the cancel type we still remove the jid from the chat
sessions. I'm not entirely sure whether this needs to be done in other
cases too.
2020-10-30 15:09:40 +01:00
DebXWoody
15f45fcfe1 Fixed Date format for MAM request
Using g_date_time_new_now_utc instead of g_date_time_new_now_local
Using g_date_time_format(timestamp, "%FT%TZ") instead of "%FT%T%:::z"

Edit:
DebXWoody created this patch because ejabberd returned an error with the
old date format.
2020-10-28 09:06:49 +01:00
Dmitry Podgorny
3a86b997ca xmpp/bookmark: don't use uninitialised field
When a bookmark is created with '/bookmark add' command,
ext_gajim_minimize remains uninitialised in new bookmark object and
is read further in _send_bookmarks().

Initialise the field with 0.

Fixes #1432.
2020-10-19 00:00:00 +03:00
Philipp Klaus Krause
6a276e74e3 Since the string from strerror should never be modified, use const. 2020-10-14 09:52:26 +02:00
Michael Vetter
4d4c094b5f Enable _handle_ox_chat() payload/body decryption
This part of the code was waiting for xmpp_stanza_new_from_string() from
libstrophe 0.10.0.
2020-10-09 09:38:47 +02:00
Michael Vetter
17b1b431f5 Replace stanza_get_child_by_name_and_ns with xmpp_stanza_get_child_by_name_and_ns
Replace our own stanza_get_child_by_name_and_ns() with the upstreamed
xmpp_stanza_get_child_by_name_and_ns() provided by the new
libstrophe/libmesode 0.10.0.
2020-09-30 19:41:08 +02:00
Michael Vetter
0a9200e268 Require libstrophe/libmesode 0.10.0 2020-09-30 19:30:40 +02:00
Dmitry Podgorny
7553676b40 Fix memory leak in _handle_chat()
jid_create() for attribute "to" was called twice and the 1st object was
lost.
2020-08-07 00:47:45 +03:00
Michael Vetter
8852db03d6 Parse stanza-id
Add stable stanza IDs to ProfMessage struct.

We parse this for 1:1 messages (MUC needs to be done too).

<stanza-id> for live messages
<result id="x"> for MAM messages

Regards MAM: https://github.com/profanity-im/profanity/issues/660
Regards Stable IDs: https://github.com/profanity-im/profanity/issues/1207
2020-07-23 14:21:27 +02:00
Michael Vetter
d7b7f54782 ox review: Use english not german 2020-07-10 13:41:48 +02:00
DebXWoody
0552e50c78 OX: XEP-0373: OpenPGP for XMPP - Version 0.5.0 (2020-06-19)
Discovering Public Keys via PEP

* 4.3 Discovering Public Keys of a User
* 4.4 Requesting Public Keys

* Import Public Keys into GnuPG's local keyring.

Issue: #1331
2020-07-10 13:40:00 +02:00
Michael Vetter
a2726b6a7d Apply coding style 2020-07-07 14:18:57 +02:00
Michael Vetter
bddbfa58c0 OX: Fix tests
Fix:
```
/usr/bin/ld: src/xmpp/ox.o: in function `ox_announce_public_key':
src/xmpp/ox.c:90: undefined reference to `p_ox_gpg_readkey'
```
2020-07-07 14:07:38 +02:00
Michael Vetter
a4cadf78fa Revert "Apply coding style"
This reverts commit 9b55f2dec0.

Sorting the includes creates some problems.
2020-07-07 13:53:30 +02:00
Michael Vetter
9b55f2dec0 Apply coding style
Regards https://github.com/profanity-im/profanity/issues/1396
2020-07-07 09:43:28 +02:00
DebXWoody
5a17957253 OX: Announce public key on PEP
src/pgp/gpg.c:p_ox_gpg_readkey

Used to read a public key from a file. The function will return the fingerprint
of the file and the base64 encoded key.

src/xmpp/ox.[hc]

ox_announce_public_key(const char* const filename) can be called from the /ox
announce <filename> command. The key within the file will be pushed on PEP and
the Metadata node will be set.

Issue: #1331
2020-07-06 13:19:18 +02:00
Michael Vetter
bf170d6c91 Merge branch 'omemofix' 2020-07-04 17:38:44 +02:00
DebXWoody
54667c022f Messages are not shown in ChatSecure
In 0.9.x we fixed an issue, because OMEMO devices should be defined in "item"
with id "current". This should work, but it won't work if there is no "current".
If there is no "current" we will just use the first item.

Issue #1384
2020-07-04 17:38:30 +02:00
Michael Vetter
aecbeff8ba message.c: Use message->to_jid instead of to_jid
This one will always be set.
2020-07-03 18:04:07 +02:00
Michael Vetter
b1343cd3ac message.c: _handle_carbons() check from field outside of function
So that we don't have to pass the wrapping stanza and can handle
the error nicer.
2020-07-03 17:55:15 +02:00
Michael Vetter
896e6c4e87 message.c: Dont duplicate code in _handle_carbon and _handle_chat
Trying to simplify the conditions so we don't have duplicate code
in both of those functions.
2020-07-03 17:51:42 +02:00
Michael Vetter
8ce299838d message.c: Remove from/to setting out of condition
Since its done in both cases.
2020-07-03 16:38:05 +02:00
Michael Vetter
0412ec9662 message.c: Small code improvements 2020-07-03 16:26:33 +02:00
Michael Vetter
c66d3c6389 message.c: Put XEP-0085 code in helper function 2020-07-03 16:17:18 +02:00
Michael Vetter
14f33e54f6 Change formatting 2020-07-03 12:35:48 +02:00
Michael Vetter
8d8ef675cd handle_headline(): Free text correctly 2020-07-03 12:05:46 +02:00
Stefan Kropp
3640900cf6 Handle headline stanza
Authored by DebXWoody in:
https://github.com/profanity-im/profanity/pull/1369

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

Since I'm in the process of cleaning up message.c I take this now
so he doesn't have to rebase.

I also omitted the _handle_normal() case since I'm not sure that would
be correct.

Probably will be addressed again when continuing the cleanup.
2020-07-03 12:02:41 +02:00
William Wennerström
d5aae08c41
Fix messages with receipt request not displayed
Messages from Conversations contains:
  <request xmlns='urn:xmpp:receipts'/>

And would not be displayed in Profanity as it never reached
_handle_chat(..).
2020-07-02 20:50:26 +02:00
Michael Vetter
83ed9ba24b message.c: Put plugin handler code in helper function 2020-07-02 17:53:28 +02:00
Michael Vetter
6be5b51a46 message.c: Log invalid message type
So far we logged when we receive a message without a type. Which is
actually quite common and makes no sense.
2020-07-02 17:47:07 +02:00
Michael Vetter
46a00317ee message.c: Check for message type
RFC 6121 allows only few types.
So we can also remove that check in _handle_chat().
2020-07-02 17:40:58 +02:00
Michael Vetter
19d9e80a79 message.c: Remove handled cases form _handle_chat()
Both cases are tested before entering that function.
2020-07-02 17:32:14 +02:00
Michael Vetter
d9cfa2e48a message.c: Break out of _message_handler() after handling code
AFAIK it can only be one.
Except at STANZA_NS_MUC_USER which is used in several cases.
2020-07-02 17:31:56 +02:00
Michael Vetter
ad3dd72325 Add HEADLINE stanza define 2020-07-02 17:17:28 +02:00
Michael Vetter
b14b711492 message.c: Parse incoming message stanzas according to type 2020-07-02 17:15:42 +02:00
Michael Vetter
728cb55b68 message.c: Add pubsub helper function 2020-07-02 16:48:57 +02:00
Michael Vetter
f2b415079a message.c: Add XEP information 2020-07-02 16:37:20 +02:00
Michael Vetter
1f50647865 message.c: Add my copyright 2020-07-02 15:22:58 +02:00
Michael Vetter
3350139ed0 message.c: Make several functions static 2020-07-02 15:21:54 +02:00
Michael Vetter
10190b5fb0 message.c: Adjust function formatting 2020-07-02 15:20:17 +02:00
Michael Vetter
e5ac12afa6 Remove prefs_free_string()
It just does a free.
Related to b580b9ef11
2020-07-02 11:34:12 +02:00
Michael Vetter
8de6a7bfb0 And ifdefs around new OX functions
Fix for some build cases introduced in 2c94ee5a88
Fix https://github.com/profanity-im/profanity/issues/1376
2020-06-30 11:10:27 +02:00
DebXWoody
2c94ee5a88 Feature request - XEP-0373: OpenPGP for XMPP (OX)
Basic implementation of XEP-0373: OpenPGP for XMPP.
https://xmpp.org/extensions/xep-0373.html

Command /ox

Issue: #1331
2020-06-29 19:05:41 +02:00
Dmitry Podgorny
409bbd6f2d Fix possible segfault in xmpp/message.c
Check for pointer to be NULL before dereferencing it.
2020-06-16 17:52:01 +03:00
Michael Vetter
914c6752dd Fix reading/writing linked files
"base" was not really base but the filename :-)

Fix https://github.com/profanity-im/profanity/issues/1362
2020-06-13 15:02:43 +02:00
Dmitry Podgorny
424918c5ed Make legacy auth optional
Some systems don't provide recent libstrophe releases. When older
version of libstrophe is detected, don't build legacy auth support.

To simplify this patch, report about unsupported legacy auth and
keep commands option as is.
2020-06-11 02:51:07 +03:00
Dmitry Podgorny
ac410445af Add option for legacy authentication
New options:
  /connect <account> [auth default|legacy]
  /account <account> set auth default|legacy

Fixes #1236.
2020-06-05 11:37:51 +03:00
Pierre Mazière
d92c576aa5 Get output and error streams from the command spawned by external_call()
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2020-06-03 13:09:29 +02:00
Michael Vetter
e19bf0e303 Merge branch 'bugfix/1329' 2020-05-29 10:29:20 +02:00
Michael Vetter
24e8243a98 _omemo_receive_devicelist() use if/else 2020-05-29 10:28:41 +02:00
Michael Vetter
8d9cbef1e3
Merge pull request #1343 from DebXWoody/bugfix/1333
Incoming iq stanza - Reset the autoping timer
2020-05-29 10:21:51 +02:00
Michael Vetter
d4692b1b2d Fix carbon logging
Regards https://github.com/profanity-im/profanity/issues/1342
2020-05-27 22:06:04 +02:00
Michael Vetter
de8975c008 Add and use connection_get_barejid()
Instead of connection_get_fulljid() and then creating a Jid from it.
2020-05-25 13:04:19 +02:00
Michael Vetter
a2af4c3184 Fix memleak in bookmark minimize
Introduced in 36f2569e53
2020-05-24 13:35:09 +02:00
DebXWoody
b882fd495a
OMEMO - Request only "current" item
NOTE: as per XEP-0060 §12.20, it is RECOMMENDED for the publisher to specify an
ItemID of "current" to ensure that the publication of a new item will overwrite
the existing item.
https://xmpp.org/extensions/xep-0384.html#devices

Issue: 1329
2020-05-23 07:41:06 +02:00
DebXWoody
3cd3bced70
Incoming iq stanza - Reset the autoping timer
A autoping is to make sure that there is still a connection between server and
client. If the application receives incoming stanza, the connection is fine.
There is no need to wait for response, if there are other incomings.

Issue: #1333 and #1315
2020-05-23 06:52:03 +02:00
Michael Vetter
c8be052ec8 Fix segfault in new bookmark feature
Fix 88c36745fe
Copy paste mistake.
2020-05-22 16:20:02 +02:00
Michael Vetter
36f2569e53 Preserve Gajims minimize flag in bookmarks
Implement https://github.com/profanity-im/profanity/issues/1326
2020-05-22 16:18:28 +02:00
Michael Vetter
88c36745fe Add option to add bookmark name
`/bookmark add|update` got `name` field.
By default localpart of JID is used (like before) but now we can set the
name ourselves.

Regards https://github.com/profanity-im/profanity/issues/697
2020-05-22 14:18:20 +02:00
Michael Vetter
fad296b79e Display bookmark name
Have field in struct and display the name in `/bookmark list`.

Regards https://github.com/profanity-im/profanity/issues/697
2020-05-22 13:56:00 +02:00
Michael Vetter
e41ae21bea Fix typing notification
With d1d0ad8d1a we set a timestamp to now
for all messages upon receival. Even if the original message didn't
contain any timestamp. So we can use the timestamp of retrieval for
logging and displaying and don't get them at each of those location
where they might differ.

This means that timestamp will never be NULL.

I don't see why we would want to check for the chat state only if
timestamp isn't there.

Probably because in XEP-0085 there is not timestamp defined.
So if it thats stanza it's not there and we can parse quicker, but there
is nothing forbidden it to be there.

Related to https://github.com/profanity-im/profanity/issues/1339
2020-05-21 12:24:03 +02:00
Michael Vetter
fc5fa62951 Create call_external() helper function 2020-05-20 10:54:58 +02:00
Michael Vetter
9c853d9f46 xep-0092: make it possible to ask servers or components for software
This adds the new `/serversoftware` command.

```
/software user@domain.org/resource
/serversoftware domain.org
```

Fix https://github.com/profanity-im/profanity/issues/1338
2020-05-14 19:13:27 +02:00
Michael Vetter
5ec1b03cbc _handle_carbons(): fix potential memleak 2020-04-21 17:11:04 +02:00
Michael Vetter
b9c384d6ca _iq_id_handler_free() dont set NULL
No effect here.
2020-04-20 16:17:09 +02:00
Michael Vetter
9e460973fa Fix potential memleak in stanza_create_caps_from_query_element()
Each of those should only occur one time. But let's make sure we only
write/alloc one time to be on the safe side.
2020-04-20 15:31:48 +02:00
DebXWoody
6268f5f0d7
OMEMO Device List only for non anonymous MUCs
Profanity request the OMEMO Device List for all members, also if the MUC is
anonymouse. If the user is Admin / Owner, the device list will be requtest.

Issue #1315
2020-04-17 19:53:34 +02:00
Michael Vetter
9be7d29f1b Don't expose upload_processes
That's actually not good practise.
Realized this when checking for multiple symbol definition in issue
mentioned below.

Regards https://github.com/profanity-im/profanity/issues/1314
2020-04-17 10:05:09 +02:00
Michael Vetter
616250b2b4 Review logging in iq.c 2020-04-14 18:53:08 +02:00
Michael Vetter
48290d3d61 Review logging for blocking.c 2020-04-14 18:32:43 +02:00
Michael Vetter
b73606cc60 Review logging in presence.c
Some stuff just floods the log file. We only need this when debugging.
Others are useless without more info.
2020-04-14 18:29:15 +02:00
Michael Vetter
18c64c0580 Free timestamp correctly
g_date_time_add_days() actually creates a new one.
2020-04-13 10:04:37 +02:00
Michael Vetter
98200ebd43 Check if server suppors MAM 2020-04-12 00:24:00 +02:00
Michael Vetter
aedecee962 Get MAM since yesterday
Later we will have several options.
Getting everything since last timestamp (if none everything at all).
Getting everything since today + configure time (1 week).

Should also have a reload all command like conversations once you
cleared the history.

All MAM messages should be written into sql db.
And then probably displayed from there so that regular history works
too.
2020-04-12 00:06:36 +02:00
Michael Vetter
dd566d8d56 MAM: Correctly display incoming MAM chat message 2020-04-11 23:56:01 +02:00
Michael Vetter
180ec2b474 Add to_jid field to ProfMessage struct
Is usefult in many cases if we want cleaner code.
Hope this edit didn't break anything though ;-)
2020-04-11 17:11:53 +02:00
Michael Vetter
38273fef5c First test with receiving MAM 2020-04-11 16:05:14 +02:00
Michael Vetter
f3b8cc407d _handle_chat: return if no 'from'
Let's not crash :-)
2020-04-11 16:05:14 +02:00
Michael Vetter
e878b6d266 Don't crash if we get a message without from or type
MAM messages don't have a type nor a from.
If we detect a message without type let's log it and exit without
continuing to try to parse it.

Otherwise we go into _handle_chat() and crash on the no from.
2020-04-11 16:05:14 +02:00
Michael Vetter
fe9b520c42 First MAM test
Send a request (which we can't handle yet) :-)

Regards https://github.com/profanity-im/profanity/issues/660
2020-04-11 16:05:14 +02:00
Dmitry Podgorny
44377c6a5c Fix use-after-free in stanza_create_caps_from_query_element()
The function creates a form to find such strings as software, os, etc.
It remembers the strings allocated by form_create() and use them below
in caps_create(). The issue is that the form is destroyed before and as
result the strings are freed too.

As solution, allocate own copy of strings.
2020-04-09 15:22:11 +03:00
Michael Vetter
37c2bd9334 Fix comment 2020-04-06 22:34:45 +02:00
Michael Vetter
6218a53727 Add hint about future ProfMessage Id needs 2020-04-06 21:17:42 +02:00
Michael Vetter
0becb68341 Add comment what id is about 2020-04-06 21:15:51 +02:00
Michael Vetter
3524a53c7c Add type field to ProfMessage
The mucuser boolean is not now needed anymore.
2020-04-06 19:15:02 +02:00
Michael Vetter
067bc690f2 Adapt win_print_history() to work with muc too 2020-04-06 15:33:01 +02:00
Michael Vetter
a0a4fd0426 db: log all incoming and outgoing messages 2020-04-06 10:50:20 +02:00
Michael Vetter
a4b53550ca Rename PROF_MSG_ENC_PLAIN to PROF_MSG_ENC_NONE 2020-04-06 10:50:20 +02:00
Michael Vetter
d1d0ad8d1a Add timestamp for incoming messages if none is set
Timestamps are only set if a message is delayed.
If none is set let's set it upon recaival so we don't have to set it
when it gets displayed.

This means we will also have it for logs etc in the ProfMessage.
2020-04-06 10:50:20 +02:00
Dmitry Podgorny
ded48a7e40 Fix memory leak in stanza_attach_correction()
xmpp_stanza_add_child() takes own reference to the child stanza.
Therefore we have to release our reference or the child is lost
and not freed otherwise.
2020-04-05 15:58:28 +03:00
Dmitry Podgorny
6c649a9de8 Fix memory leak of presence object
The memory leak happens when a presence is received for a MUC room. The
JID is not present in the roster, so updating its status is ignored. We
have to free resource in this case, because it has no owner and is lost
otherwise.

==25736== 47 (32 direct, 15 indirect) bytes in 1 blocks are definitely lost in loss record 1,625 of 3,399
==25736==    at 0x4A330FF: malloc (vg_replace_malloc.c:309)
==25736==    by 0x13A962: resource_new (resource.c:47)
==25736==    by 0x145501: _available_handler (presence.c:665)
==25736==    by 0x145501: _presence_handler (presence.c:399)
==25736==    by 0x145501: _presence_handler (presence.c:358)
==25736==    by 0x80D5F34: handler_fire_stanza (in /usr/lib64/libstrophe.so.0.0.0)
==25736==    by 0x80D2B49: _handle_stream_stanza (in /usr/lib64/libstrophe.so.0.0.0)
==25736==    by 0x80E15CE: _end_element (in /usr/lib64/libstrophe.so.0.0.0)
==25736==    by 0x843EE9B: doContent (in /usr/lib64/libexpat.so.1.6.10)
==25736==    by 0x843F94B: contentProcessor (in /usr/lib64/libexpat.so.1.6.10)
==25736==    by 0x8441E77: XML_ParseBuffer (in /usr/lib64/libexpat.so.1.6.10)
==25736==    by 0x80D586B: xmpp_run_once (in /usr/lib64/libstrophe.so.0.0.0)
==25736==    by 0x13E07E: connection_check_events (connection.c:119)
==25736==    by 0x13869C: prof_run (profanity.c:129)

Fixes #1279.
2020-02-23 08:51:36 +02:00
Michael Vetter
52e7e596aa xep-0084/avatar: add option to open avatar directly
Change:
`/avatar me@somewhere.org` -> `/avatar get me@somewhere.org`

New:
`/avatar cmd feh`
`/avatar open me@somewhere.org`

Implement https://github.com/profanity-im/profanity/issues/1281
2020-03-10 07:12:13 +01:00
Michael Vetter
56836fb72d Use correct MUC message timestamp
win_println_incoming_muc_msg() always used the current time. Now let's
use whatever is sent int he message struct (from the delay stanza or
the current time that we set now once the message is received).

No playing with the time upon display anymore.
2020-03-09 12:22:36 +01:00
Michael Vetter
8112b8c84b Use proper OS names for OpenBSD and NetBSD 2020-03-09 11:24:14 +01:00
Dmitry Podgorny
d18ec23d0a Fix few memory leaks 2020-02-27 01:35:36 +02:00
Michael Vetter
779c2efc17 Set muc history correctly in _handle_groupchat()
Fix init. mistake introduced in e9c5c1979d
2020-02-25 16:34:43 +01:00
Michael Vetter
063b5243f1 Free jid in muc_members_add()
Fix memleak.
2020-02-25 16:31:41 +01:00
Michael Vetter
62730367d6 Fix memleak in stanza_get_oldest_delay
We need to unref the temp datetimes again.
2020-02-25 15:54:44 +01:00
Michael Vetter
e9c5c1979d Fix memleak in _handle_groupchat()
We need to unref the timestamp before setting a new one.
2020-02-25 15:26:33 +01:00
Michael Vetter
8ee2cdadc8 Parse mentions and triggers in muc history if display is 'regular'
Fix https://github.com/profanity-im/profanity/issues/1261
2020-02-20 10:28:24 +01:00