Commit Graph

24 Commits

Author SHA1 Message Date
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)