Goal is to make the logger module easier to maintain in the future
- extract deduplication out into a own method, so we can use it
on its own in some other places.
- add new insert_into_logs() method
the DB fields we want to write to are passed as arguments, this makes
it so we dont have to change the method when we add or remove DB fields
in the future.
- instead of using get_jid_id() all around gajim to get the jid_id
before we write to the DB, we only have to pass the jid to
insert_into_logs(), it makes sure to get the correct jid_id or add
one in case it doesnt exist.
- Condition type = groupchat is not needed because we drop messages
type groupchat that come from the user archive. To get these messages
we will query the MUC.
- Because of this the logging method save_if_not_exists() can be much
simpler
- Refactor get_last_date_that_has_logs()
- use NATURAL JOIN in SQL query instead of multiple SELECT via
_build_contact_where
- make code more concise
- update method documentation
- use NATURAL JOIN in SQL query instead of multiple SELECT via
_build_contact_where
- make code more concise
- update method documentation
- Fix a bug where messages were displayed in wrong order when
they had the same timestamp
Because some operations use the _timeout_commit() it happens that a timeout
is active while we shutdown.
This makes sure everything is commited before shutdown.