1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00
Commit Graph

6015 Commits

Author SHA1 Message Date
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
c90a5d174e
Merge pull request #1307 from profanity-im/memleaks
Fix memory leaks in _rosterwin_resources()
2020-04-09 11:54:02 +02:00
Dmitry Podgorny
aa4faf6075 Fix memory leaks in _rosterwin_resources() 2020-04-09 15:17:34 +03:00
Michael Vetter
401ebce84e Downgrade sqlite to 3.22.0
Last version in Ubuntu LTS (bionic 18.04).
I think we don't use later functionality. Let's see.

glib version fits.
2020-04-08 20:10:23 +02:00
Michael Vetter
f42f856d37 Retrieve message type from database
So we don't have to check for MUC another way.
2020-04-08 12:50:23 +02:00
Michael Vetter
444ce95aae Log after displaying the message
Otherwise we print the freshly received message to the window twice.
Once when receiving (and immediately printing), then logging it, and
then again when we print the last 10 log entries.

Fix https://github.com/profanity-im/profanity/issues/1305
2020-04-08 12:21:07 +02:00
Michael Vetter
2c46a56e3c travis: enable osx again
Seems like homebrew reverted their pkgconfig change for now.
So finding gio should work again.

Regards https://github.com/profanity-im/profanity/issues/1302
2020-04-07 12:06:32 +02:00
Michael Vetter
74392564bf Update dependencies in spec files 2020-04-07 11:39:17 +02:00
Michael Vetter
7419d29451 Update database stub 2020-04-07 11:31:17 +02:00
Michael Vetter
d3a387a0ec Downgrade dependencies
Use g_date_time_format() instead of g_date_time_format_iso8601() to only
rely on glib 2.56.0 which is the latest version in Debian Buster
(current stable).

We also only use basic sqlite functions so 3.27.0 should be fine there
(also the one in Debian buster).

Thanks to @DebXWoody.
2020-04-07 11:10:41 +02:00
Michael Vetter
9aefbdcb53 Require at least glib 2.62.
g_date_time_format_iso8601() is only in glib since 2.62.
2020-04-06 22:42:39 +02:00
Michael Vetter
f5bdd67dec Add missing includes 2020-04-06 22:42:22 +02:00
Michael Vetter
e61238e9cd Require only sqlite 3.28.0
We don't need newer features and so it runs on Leap 15.1 too.
Let's see what Debian etc. need.
2020-04-06 22:37:05 +02:00
Michael Vetter
37c2bd9334 Fix comment 2020-04-06 22:34:45 +02:00
Michael Vetter
aa12399b5b travis: disable osx build
As long as brew has some problem: https://github.com/profanity-im/profanity/issues/1302
2020-04-06 22:32:01 +02:00
Michael Vetter
6c158a9af8
Merge pull request #1282 from profanity-im/feature/sqlite-log
SQLite backend
2020-04-06 22:25:40 +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
fb4f82b82c db: actually display the last 10 entries in correct order 2020-04-06 19:44:03 +02:00
Michael Vetter
015c5d83d0 db: get last messages sorted by timestamp 2020-04-06 19:15:06 +02:00
Michael Vetter
3b2976c9cb db: Use type from message struct instead of having individual functions 2020-04-06 19:15:06 +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
5862e5b159 db: Fix memleaks 2020-04-06 16:09:38 +02:00
Michael Vetter
1afb708533 Add sql to error log
so we can more easily grep for it.
2020-04-06 15:55:22 +02:00
Michael Vetter
bd116e6ad9 win_print_history() print 'me' on regular chats if we wrote the message
Same behaviour like when we used to get it from the text files.
2020-04-06 15:48:23 +02:00
Michael Vetter
067bc690f2 Adapt win_print_history() to work with muc too 2020-04-06 15:33:01 +02:00
Michael Vetter
0942d98c61 Remove chat_log_get_previous()
We now dont get the log files from the text files via chat_log_get_previous() anymore.
We use the sql backend via log_database_get_previous_chat().

So far it just has the same behaviour like chat_log_get_previous(),
except that in _chatwin_history() we don't pass the sender to
win_print_history() which should be fixed in a commit soon.

And log_database_get_previous_chat() can later easily be expanded to fix
https://github.com/profanity-im/profanity/issues/205.
2020-04-06 14:42:52 +02:00
Michael Vetter
5d54bb228f Get regular chat history out of sql backend 2020-04-06 14:30:38 +02:00
Michael Vetter
20850eb4db db: log encryption type 2020-04-06 10:50:20 +02:00
Michael Vetter
9b1aac0481 db: log "to" resource 2020-04-06 10:50:20 +02:00
Michael Vetter
db502d7054 db: log "from" resource 2020-04-06 10:50:20 +02:00
Michael Vetter
9224331df3 Fix copy paste error 2020-04-06 10:50:20 +02:00
Michael Vetter
4cc8df5929 Add log_database_add_*() test stubs 2020-04-06 10:50:20 +02:00
Michael Vetter
6803fb5c3a Fix message_send_private unittest stub 2020-04-06 10:50:20 +02:00
Michael Vetter
58bef8e592 db: dont log reflected MUC messages 2020-04-06 10:50:20 +02:00
Michael Vetter
a0a4fd0426 db: log all incoming and outgoing messages 2020-04-06 10:50:20 +02:00
Michael Vetter
def2123216 db: log outgoing message in one case
Not all cases covered yet.
2020-04-06 10:50:20 +02:00
Michael Vetter
628b86f57e db: add dedicated chat, muc, muc pm logging functions 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
af2630a289 db: insert message type 2020-04-06 10:50:20 +02:00
Michael Vetter
9278ba775b db: add more needed fields
DB fields should be complete now.
2020-04-06 10:50:20 +02:00
Michael Vetter
fe67102e71 db: make id autoincrement 2020-04-06 10:50:20 +02:00
Michael Vetter
c56443fea5 db: fix inserting null in database 2020-04-06 10:50:20 +02:00
Michael Vetter
dc0b7b5e91 db: log replace id 2020-04-06 10:50:20 +02:00
Michael Vetter
a5a53c52de db: use goto in error case 2020-04-06 10:50:20 +02:00
Michael Vetter
ac6a1222fc db: add db version
so we can later migrate.
2020-04-06 10:50:20 +02:00
Michael Vetter
062c7b1a89 db: add database unit test stub 2020-04-06 10:50:20 +02:00
Michael Vetter
4a7a0f3e76 db: move includes 2020-04-06 10:50:20 +02:00
Michael Vetter
1155963c6c db: guard against no DB
Maybe if we only use `/connect` we dont have ProfAccount. In that case
we won't log anything. Only if a account is used we log.

If this is the case or the init of the db didn't work we still want
profanity to run but wont log anything to the db.
2020-04-06 10:50:20 +02:00
Michael Vetter
11663625cc db: Have one database per account 2020-04-06 10:50:20 +02:00