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

85 Commits

Author SHA1 Message Date
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
b282965ede Escape message before adding to SQL backend 2020-04-18 10:01:40 +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
b2eea969db Fix error in getting previous chatlog
Our search was too broad, and thus incorrect.

One of the various mistakes it can cause was
https://github.com/profanity-im/profanity/issues/1308

Fix https://github.com/profanity-im/profanity/issues/1308
2020-04-10 14:59:27 +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
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
f5bdd67dec Add missing includes 2020-04-06 22:42:22 +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
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
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
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
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
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
Michael Vetter
5cc3b469a8 database: log stanza_id and whether it is a muc message 2020-04-06 10:50:20 +02:00
Michael Vetter
8045a32c4a database: log incoming messages
First trial. Not covering all cases yet.
2020-04-06 10:50:20 +02:00
Michael Vetter
a7163b24f3 database: Define chatlog database location 2020-04-06 10:50:20 +02:00
Michael Vetter
994411d470 database: create table 2020-04-06 10:50:20 +02:00
Michael Vetter
8bfb175d03 Start SQLite db module
I plan to save all messages in an SQLite db.
For retrieving information it's nicer than having it in a text file.
We will have more info in there and easier to parse it.

This will also be good for later MAM
(https://github.com/profanity-im/profanity/issues/660).

Regular text files will still be an option for users so that they can
easily grep them and do whatever they like.

Internally Profanity will only use the SQLite db.
2020-04-06 10:50:20 +02:00