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
e23bc38083
Quick and dirty display of MAM messages
2020-04-11 16:05:14 +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
70ad4d4a38
Fix memory leaks in cons_roster_setting()
2020-04-10 23:43:00 +03: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
e1b8fb24c3
Merge pull request #1309 from profanity-im/use-after-free
...
Fix use-after-free in stanza_create_caps_from_query_element()
2020-04-10 14:02:50 +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
Dmitry Podgorny
aa4faf6075
Fix memory leaks in _rosterwin_resources()
2020-04-09 15:17:34 +03: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
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
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
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
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
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
71e872c5b8
database: dont log muc pms
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