Commit Graph

58 Commits

Author SHA1 Message Date
Philipp Hörist 137bf1f831 MAM: Request from last received stanza-id
Record stanza-ids from live messages. If Gajim is started query the
archive from the last received stanza-id
2018-07-29 23:16:13 +02:00
Philipp Hörist ebbe06d587 Refactor MAM into own module
- Rework the MAM Preference dialog
- Move MAM Preference dialog into a new gtk module
- Refactor all MAM code into own module
- Refactor the MAM code itself so we can easier test it in the future
- Add a misc module for smaller XEPs and move EME, Last Message Correction
Delay, OOB into it
- Add dedicated module for XEP-0082 Time Profiles
2018-07-15 14:26:00 +02:00
Alexander Krotov 22d799a75e Set secure_delete pragma for SQLite3 connections
secure_delete makes SQLite3 overwrite deleted data with zeros, thus actually deleting it from the filesystem.

Ubuntu and FreeBSD enable it by defualt, but some distributions, such as Debian, have it disabled by default, so it is better to set it explicitly.

The performance impact should be negligible as Gajim uses the database rarely.
2018-06-19 19:07:16 +02:00
Philipp Hörist e20f044001 Increase timeframe for duplicate search
A too short timeframe leads to not recognizing duplicates if the server
time differs from the user time. This is only a problem with mam:1

Fixes #8750
2018-06-19 19:05:44 +02:00
André Apitzsch ab3c53bf49 Remove yahoo transport
fixes #9188
2018-06-15 12:19:02 +02:00
Philipp Hörist 2abbb1e224 Define JID type when searching for duplciates
Fixes #9163
2018-06-01 17:46:54 +02:00
Philipp Hörist 2bb5d55c03 Add conversion from account_id to account jid
To use this alias `account_id` with `account`

Example: SELECT account_id as account FROM logs
2018-05-08 19:20:11 +02:00
Philipp Hörist 707599dd86 Dont determine paths at module import time 2018-04-25 21:26:02 +02:00
Philipp Hörist 5ee45b86e9 Refactor database migration
- Move database migration to the logger module
- Dont depend on Gajim version for migration use PRAGMA user_version
- Refactoring of some methods in the logger module
- Dont use cursor object, if there is no reason
- Make some attributes and methods private
2018-04-23 21:27:01 +02:00
Philipp Hörist 4f2033faff Move constants into const module 2018-04-23 18:23:57 +02:00
Philipp Hörist 3efa731fbf Add stanza_id index also when we create the DB 2018-04-23 00:10:35 +02:00
Philipp Hörist 188fb85bd0 Move DB creating into logger module 2018-04-22 22:16:17 +02:00
Philipp Hörist 4a26ecb12c Refactor configpaths
- init configpaths earlier so logging can access it to store debug logs
- First step for more consistency across Gajim when looking up paths

  Recommended usage for the future:
  app.configpaths.get()
  configpaths.get()
2018-04-21 12:48:57 +02:00
Philipp Hörist 058d3db1b0 Logger: Test for None after fetchone()
fetchone() returns None when nothing is found
len(None) yields a TypeError
2018-03-24 17:13:15 +01:00
Philipp Hörist d8777a78aa Fix deleting an account that was never connected
Fixes #8951
2018-03-17 00:20:11 +01:00
Philipp Hörist 015d99ea63 Print correct archive jid in log message 2018-02-21 22:21:35 +01:00
Philipp Hörist 17fc8ff927 Limit deduplication to correct archive
We limit the search to non-groupchat messages because a stanza id
is only unique within an archive
2018-02-21 19:23:26 +01:00
Daniel b0bf74337c Add navigation for chat history 2018-02-07 10:04:56 +01:00
Philipp Hörist 4c545be737 Inlcude account for message deduplication
It was not possible to write with 2 different accounts into the
same MUC
2018-01-25 00:47:00 +01:00
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