Commit Graph

582 Commits

Author SHA1 Message Date
Philipp Hörist cb90f9decd Merge branch 'logger' into 'master'
Refactor Logger

See merge request !108
2017-07-27 11:57:09 +02:00
Philipp Hörist fe1f2c0103 Dont drop MAM Message on missing stanza-id
A missing stanza ID means, we will have to take some measures to make
sure we get no duplicates in the Database later on.

Also fix getting the origin-id. Third time is a charm.
2017-07-27 03:33:19 +02:00
Philipp Hörist 9d6e3f4323 Get the ID attr of origin-id instead of the Node 2017-07-26 02:41:08 +02:00
Philipp Hörist 7f0bcbb5bf Correctly set stanza-id for received MAM messages
The gaol why we need to determine what ID should be used as stanza-id,
is so we can use the stanza-id in the future for deduplication.

Case we are the sender:

Either we look for a origin-id element, which we will include in the
Future in all messages we send, or until then the ID we set on the
message as attr.

Case we are the receiver:

If our server supports mam:2 we take the ID of the result element,
because mam:2 injects the archive ID live into every message we
receive. If we dont have mam:2 we fall back to the ID of the message
attr.
2017-07-26 02:35:34 +02:00
Philipp Hörist a5480eb167 Add ServerInfo Dialog 2017-07-26 00:07:43 +02:00
Philipp Hörist 33a51f3180 Preparation for MUC Archive querys
- Refactor and clean up code around MamMessageReceivedEvent
- Goal is to add a GcMamMessageReceivedEvent later on
- For that cause added a raw-mam-message-received base event
2017-07-25 21:01:18 +02:00
Philipp Hörist aefb571168 Add new NetworkEvents method
This lets us attach all attributes of the base event to the
new event. Often Events trigger other Events. When that happens
we often want to keep all attr from the previous Event, and just
continue under a new Event. Until now all attr had to be pulled
out of `self.base_event` again.
2017-07-25 21:00:20 +02:00
Philipp Hörist 89367a83ec Add simple parse_delay() method
The XEP is pretty strict on Delay tags so we can make a simple
method.
2017-07-25 21:00:20 +02:00
Philipp Hörist 06d890eea7 Add more convenient get_own_jid() method 2017-07-25 21:00:20 +02:00
Philipp Hörist 85d220c80e Add Synchronise History Dialog
- On first contact with the MAM Archive only request 7 days
- To sync the rest of the archive the new Dialog can be used.
2017-07-25 21:00:20 +02:00
Philipp Hörist e548a89269 Add pylint hints 2017-07-25 21:00:20 +02:00
Philipp Hörist e5a41ea2b3 Raise min version of TLS to 1.2 2017-07-24 23:38:10 +02:00
Yann Leboulanger f36860e37d limit priority value inc ase user set an invalid priority in ACE. Fixes #8630 2017-07-24 21:52:11 +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 5e1e4e27e7 Fix multiple metacontact requests at startup
_continue_connection_request_privacy() should only trigger
once after we received the discoinfo on the hostname.

We do a discoinfo on all items that the server offers,
_continue_connection_request_privacy() was triggered on every received
discoinfo again, hence requesting metacontacts and delimiters again.

also _continue_connection_request_privacy() was called on every
discoinfo error, instead of only on a hostname discoinfo error.

This bug is only triggered if the server doesnt support privacy rules.
2017-07-20 01:58:08 +02:00
Philipp Hörist a754c05979 Fix discovery of MAM 2017-07-19 20:19:40 +02:00
Philipp Hörist 47c33bbe39 Play sounds on MacOS 2017-07-19 13:16:27 +02:00
Philipp Hörist cdc2ec9205 Fix not requesting roster on empty cache.db
The purpose of

`if version and not gajim.contacts.get_contacts_jid_list()`

seemed to be that when cache.db is empty (maybe it was deleted)
`gajim.contacts.get_contacts_jid_list()` should come back empty.

So on an empty roster cache, version was set to None, so that we
request in any case a new roster.

The Problem is that `gajim.contacts.get_contacts_jid_list()` is not
a good indication for an empty cache.db. On start we trigger a
`RosterReceivedEvent` which does a DB query to get the roster. Even
if that DB query comes up empty, the Event is still pushed.

In the event handler `_nec_roster_received` in roster_window.py we
add then previously open controls and our self (if the option is set)
to the roster, making `gajim.contacts.get_contacts_jid_list()` return
these contacts and hence the condition in `request_roster()` always
False.

So the version is set in the roster request, and if there is no new
version on the server, we request no new roster even though we only
have ourself and previously open controls in our roster.

As a solution for this we delete the roster version from the config
in `RosterReceivedEvent` if the DB query comes back empty, which
triggers a new roster request.
2017-07-19 10:52:02 +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
SaltyBones e6840ab8b6 fixed lookup of description for keyed options 2017-07-11 20:35:47 +02:00
Philipp Hörist cc682d243f Change defaults on history restore options
Set restore timeout inactiv, this should be really an advanced option,
probably only set for specific MUCs not as default for every MUC.

Set restore_lines to 10, so the User has an indication that Gajim can
display history, and that there is probably a setting to adjust.

Set muc_restore_lines to 100, this is a try to get a reasonable amount
of history, especially in small Groupchats. Most server will limit this
to 20-50 anyway. The limit 100 is more of a precaution if we run into a
misconfigured server. This is intended as a workaround until we can
implement MAM for Groupchats.
2017-07-10 21:03:45 +02:00
Philipp Hörist a818b60ba7 Fix unlimited muc_restore_timeout
muc_restore_timeout set to -1 means we want no particular time set, up
to which we request messages. But we should not deliberate request
messages we already have. Hence even if muc_restore_timeout is set
to -1, we should only request up to the last message we received.
2017-07-10 20:13:10 +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 aeb64a516c Use correct history date on muc join
Example:
If we receive a message the last message date is now.
If we restart Gajim and join the MUC again, `time.time() - timeout`
will be most likly smaller then when we received the last message
If the timeout is an hour, this would mean that many messages are requested
from the archive which we already received.

So we always want the most current timestamp (MAX).
2017-07-10 16:39:27 +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
Philipp Hörist 635b05c1ca Make noto-emoticons the default theme 2017-07-02 21:30:21 +02:00
André Apitzsch 125ce523e4 Rename src directory 2017-07-02 17:25:47 +02:00