Commit Graph

39 Commits

Author SHA1 Message Date
Philipp Hörist 7f1776ede9 Improve deduplication
A stanza-id is only unique within a specific archive
This adds the archive jid to the query
2017-11-19 19:36:26 +01:00
Philipp Hörist 95357361bf Save account_id in logs table 2017-11-19 19:36:25 +01:00
Philipp Hörist a07470a7d2 Add new DB methods 2017-11-19 19:36:25 +01:00
Philipp Hörist 35d2beae74 Logger: only search if ids are available 2017-11-08 22:27:37 +01:00
Philipp Hörist d4fdf0d7c1 Shorten search intervall for MAM messages 2017-11-07 20:39:45 +01:00
Philipp Hörist 7f1a839e77 Deduplicate GC and MAM Messages based on stanza-id
- Add methods to determine the unique/stable id
- Write the id to the stanza_id DB field
- Add method to deduplicate based on the unique/stable id
2017-11-07 20:39:36 +01:00
Philipp Hörist 0c8d88d372 Ensure that jid_id is created on new accounts 2017-11-02 16:00:18 +01:00
Thilo Molitor 0638cdc690 Fix additional_data in events 2017-11-01 23:14:47 +01:00
Philipp Hörist 0490414079 Fix saving MUC-PMs
If the JID is not in the DB we need a type to insert
2017-10-29 00:37:05 +02:00
Philipp Hörist b95759dfb8 Logger: Refactor insert_jid()
- make it use get_jid_id() and return the jid_id
2017-10-22 20:12:26 +02:00
Philipp Hörist accef11c93 Logger: Get rid of old jids list
Use _jid_ids dict instead
2017-10-22 20:12:26 +02:00
Philipp Hörist 1c7369229e MUC: Save last message time after each message 2017-10-22 20:12:25 +02:00
Philipp Hörist 0aa07522fb Logger: Refactor get_jid_id()
- Cache jid_id so we save on DB querys
2017-10-22 20:12:21 +02:00
Philipp Hörist a01cdbf271 Refactor Avatars
- Add support for Pubsub Avatars
- Dont poll for vCard Updates, only use XEP-0153
- Dont cache vCards
- Store the avatar SHA of roster contacts in the DB
- Store the current SHA of each contact in the Contacts Object
- Move some code into the ConnectionVcard Class
2017-10-08 11:26:28 +02:00
Philipp Hörist 68f13788ed Add avatar_sha field to Cache DB 2017-10-08 11:25:49 +02:00
André Apitzsch 89c7eb6e6a Rename gajim.common.gajim to avoid name conflicts 2017-08-18 20:03:20 +02:00
André Apitzsch efec098aef Use absolute imports 2017-08-18 19:48:48 +02:00
Philipp Hörist f3bdb596bd Refactor remove_roster()
- Execute as script to save roundtrips
2017-08-08 18:53:25 +02:00
Philipp Hörist 10b0865291 Refactor set_room_last_message_time()
- Dont depend on get_jid_id(), this saves roundtrips
2017-08-08 18:22:29 +02:00
Philipp Hörist c53e2b1bb9 Dont try to insert if JID is already in DB
- This is added because even an ignored INSERT raises the
autoincrement value of the table.
This means the jid id gets high really fast.
2017-08-08 18:22:29 +02:00
Philipp Hörist f88e8d835b Remove old DB methods 2017-08-08 18:22:29 +02:00
Philipp Hörist 8c920b35ff Move logging GC messages into connection_handlers
- It should be where all other message received handlers are
- Port to new DB API
2017-08-08 15:24:41 +02:00
Philipp Hörist 608655deed Use new DB API for logging status and errors 2017-08-08 14:41:55 +02:00
Philipp Hörist a01611178d Logger: dont try to parse None with json 2017-08-02 21:32:59 +02:00
Philipp Hörist 6f3c21118f Stay compatible to python 3.4
Fixes #8690
2017-08-02 18:57:02 +02:00
Philipp Hörist 1f5e927ca6 Use new DB methods for MAM Messages
- also push a new MamDecryptedMessageReceived
event after disco instead of writing directly to the DB
2017-08-01 21:39:11 +02:00
Philipp Hörist 16fd64873e Add new logger methods
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.
2017-08-01 21:39:06 +02:00
Philipp Hörist 81566df8a1 Fix some regressions with MAM
- On single messages use the bare JID for DB querys
- Add more debug logging
- Some light refactoring
2017-07-30 23:04:50 +02:00
Philipp Hörist f449acd815 Refactor MamDecryptedMessageReceivedEvent
- 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
2017-07-27 21:46:19 +02:00
Philipp Hörist 9046797e1b Remove _build_contact_where()
We dont need it anymore
2017-07-21 16:58:04 +02:00
Philipp Hörist 9feee7d9dc Refactor get_room_last_message_time()
- 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
2017-07-21 16:58:04 +02:00
Philipp Hörist 1e380473cd Refactor get_days_with_logs()
- use NATURAL JOIN in SQL query instead of multiple SELECT via
_build_contact_where

- make code more concise

- update method documentation
2017-07-21 16:58:04 +02:00
Philipp Hörist fb7eb0718a Refactor search_log()
- use NATURAL JOIN in SQL query instead of multiple SELECT via
_build_contact_where

- make code more concise

- update method documentation
2017-07-21 16:58:04 +02:00
Philipp Hörist 950f763220 Refactor get_conversation_for_date()
- 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
2017-07-21 16:58:04 +02:00
Philipp Hörist 40ba449f47 Refactor get_last_conversation_lines()
- use NATURAL JOIN in SQL query instead of multiple SELECT via
_build_contact_where

- make code more concise

- update method documentation
2017-07-21 16:58:04 +02:00
Philipp Hörist ef38afcf90 Use namedtuples for results from the DB
This makes the code much easier to read, and much less error prone.
2017-07-12 22:34:55 +02:00
Philipp Hörist b625199c47 Allow for a no limit option on restore_timeout 2017-07-10 18:26:17 +02:00
Philipp Hörist 5a8965791c Commit to DB before shutdown
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.
2017-07-10 16:25:26 +02:00
André Apitzsch 125ce523e4 Rename src directory 2017-07-02 17:25:47 +02:00
Renamed from src/common/logger.py (Browse further)