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

926 Commits

Author SHA1 Message Date
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