Commit Graph

244 Commits

Author SHA1 Message Date
André Apitzsch 125ce523e4 Rename src directory 2017-07-02 17:25:47 +02:00
Philipp Hörist a51ea32dc6 Refactor exception handling for logger
- Handle exceptions inside write() instead of propagating the
    exception
- Add error message to exception
- Add dispatch() method in logger
2017-04-12 22:30:55 +02:00
Markus Böhme 21d15dec29 Use the same named tuple for related methods for conversation loading
Both methods get_conversation_for_date and search_log in the logger
module are related to the loading of conversations and both return a
list of messages from the log. Therefore, it makes sense that both of
them have the same return type.

Remove the named tuple type specific to search_log and convert the
method to return tuples of type Message instead. As a side effect of
this change, search_log now also returns values from the additional_data
column in the log database.
2017-03-30 22:19:40 +02:00
Markus Böhme 65e926c181 Convert get_conversation_for_date to return named tuples
The get_conversation_for_date method in the logger module returns a
list of bare tuples. Knowledge of how to pack and unpack the many
individual components of the tuples is split between the caller and
the callee, making the method hard to maintain and ugly to use.
Therefore, convert the method to return named tuple instead.
2017-03-30 21:24:31 +02:00
Markus Böhme 08f4e17158 Rename method get_search_results_for_query to search_log 2017-03-30 21:23:03 +02:00
Markus Böhme d612e80a47 Convert get_search_results_for_query to return named tuples
The get_search_results_for_query method in the logger module returns a
list of bare tuples. Knowledge of how to pack and unpack the many
indidual components of the tuples is scattered across both the callers
and the callee, making the method hard to maintain and ugly to use.
Therefore, convert the method to return named tuples instead.
2017-03-30 21:23:03 +02:00
Markus Böhme 167cf02afd Fix typo across codebase (change "tupple" to "tuple") 2017-03-29 10:56:31 +02:00
Markus Böhme 8df8486def Add @unique decorator to all enumerations
Currently, there are no enumerations using the enum module which reuse
values/need aliases. Add the @unique decorator to all enum classes as a
safety net for future modifications.
2017-03-29 10:56:31 +02:00
Markus Böhme d9ab39b03f Fix loading of additional_data column from log database
Currently, the additional_data column is not correctly loaded from the
log database in the logger module's methods get_last_conversation_lines
and get_conversation_for_date. While the JSON data in the column is
parsed, the parsed value is not saved, because the code assumes that
changes to a loop variable are reflected in the list that is iterated
over. Instead, the unparsed JSON string is returned. Fix this by building
a separate list with the JSON string replaced by the parsed JSON object.
2017-03-25 18:58:35 +01:00
Philipp Hörist 69022ab100 Dont treat MAM results as unread messages
Fixes #8544
2017-03-13 23:21:33 +01:00
Markus Böhme d75ebd95e5 Rework message highlighting in the history window to not use timestamps
Search results in the history window to are scrolled to and highlighted
once the user clicks on one of them. Messages are searched by text in
the log database, but then looked up in the history text buffer via a
visible or invisible timestamp obtained from the database record.

Timestamps in the history text buffer, depending on user configuration,
may only have a coarse granularity. Philipp Hörist discovered that this
may lead to the highlighting of the wrong line in the history text view
and proposed an alternative solution that is implemented in this patch.

Timestamps are abolished as a means of searching messages. Instead, add
a mark with the unique message id (log line id) at the start of every
message in the history text buffer when the conversation is loaded.
After fetching the search results from the database this id can be used
to unambiguously find the corresponding message in the history text
buffer.
2017-03-02 23:55:18 +01:00
Markus Böhme 665898864f Remove dead code in logger.py method get_search_results_for_query
The method get_search_results_for_query provides a means to search via a
passed in SQL query. This feature has been unused and dead since its initial
commit back in 2005 (commit e542fff69f), so just remove it.
2017-02-22 14:55:44 +01:00
Emmanuel Gil Peyrot 57fb80f1fa Remove every default argument using [] or {}. 2017-02-11 02:40:07 +00:00
Emmanuel Gil Peyrot 2fbadc91e9 Use Enum or IntEnum instead of range() constants. 2017-02-11 02:40:07 +00:00
Philipp Hörist 39ec724e45 Cleanup Paths/DB creation and init 2017-01-03 23:08:52 +01:00
Philipp Hörist 39216af2de print_conversation_line() refactoring
It now orders all messages with the given timestamp
this also includes inserting messages at the correct
point

The timestamp precision for incoming and outgoing messages
was raised to include fractions of a second
2017-01-02 19:09:06 +01:00
tmolitor d306a39e1e Correctly append shown value to list 2016-09-28 01:20:17 +02:00
tmolitor 95eb7402a4 Also write additional_data to history db when mam messages are received. 2016-09-05 21:17:46 +02:00
tmolitor 86345055cc Added ability to read additional_data from history db and use it in gui extension point print_special_text.
I also found an iterator reuse in common/logger.py, maybe this fixes bug #8277
2016-09-05 03:25:37 +02:00
tmolitor 235cadd5cc Corrected last commit and added ability to set and log additional_data for outgoing messages as well (and for gc messages, too) 2016-09-05 01:43:39 +02:00
tmolitor 065d08cebf Honor profile given on commandline for plugin dir and history db and more.
Also added new property 'additional_data' to message event objects. Changes to this attribute (a dict) are passed on from event to event and are also written to the history db as json string (reading of those values isn't implemented yet).
2016-09-05 00:01:29 +02:00
Yann Leboulanger fbdb7656af rename msg_id to msg_log_id where it's the id from logs database 2016-02-27 19:52:46 +01:00
Yann Leboulanger 9fbd7efa2a correctly store and restore single message subject. Fixes #8251 2016-01-31 19:58:51 +01:00
Yann Leboulanger 0f2e66d7a2 don't fail when we receive a MAM message without a body. Fixes #8140 2015-09-03 22:06:04 +02:00
Yann Leboulanger 28c1fac86d fix exception order. Fixes #7969 2015-02-15 21:29:06 +01:00
Yann Leboulanger 0a8af73650 add XEP-313 (MAM) support 2014-11-11 15:28:24 +01:00
Denis Fomin 4b33634a0b Copyright 2013>2014 2014-01-02 12:33:54 +04:00
Yann Leboulanger 77e790ceb9 fix error when there is a ' char in the config path. Fixes #7344 2013-08-14 18:58:48 +02:00
Yann Leboulanger fd0ff877a3 GObject.* -> GLib.* 2013-07-28 20:50:30 +02:00
Yann Leboulanger 1e4772fc65 cache jabber servers too in trnasports_cache table so that they are not considered as transports. Fixes #7360 2013-06-02 21:02:33 +02:00
Yann Leboulanger 9c8c1de03f update my copyright 2013-04-05 21:35:39 +02:00
Denis Fomin 8c6b68d35e fix caps 2013-01-11 13:34:49 +04:00
Denis Fomin 99c62442bb [Asterix] Fix caps 2013-01-08 13:17:09 +04:00
Denis Fomin ea8a1b3241 fix missing import 2013-01-08 01:59:12 +04:00
Yann Leboulanger e03b3c35b6 fix traceback handling
fix struc and sha1 usage (use bytes instead of string)
2013-01-05 00:03:36 +01:00
Yann Leboulanger 912f0e921d fix imports and many py3 changements 2013-01-02 13:54:02 +01:00
Yann Leboulanger d27591076f fix exception handling 2013-01-01 23:18:36 +01:00
Yann Leboulanger 069bddbbcb remove call to unicode() 2013-01-01 21:06:16 +01:00
Yann Leboulanger 414e349345 python uses unicode internally 2013-01-01 19:44:25 +01:00
Yann Leboulanger e71188a6fa print -> print() 2013-01-01 19:36:56 +01:00
Yann Leboulanger 8f71d9f219 start porting Gajim to gobject introspection and GTK3 2012-12-23 16:23:43 +01:00
Yann Leboulanger 134d55b285 don't commit SQL request too fast to improve performences. Fixes #6905 2012-04-03 19:38:15 +02:00
Yann Leboulanger 3a3f99d618 upgrade copyright 2012-01-11 22:20:34 +01:00
Denis Fomin 783cf55ba7 optimize history search. Fixes #6997 2011-12-18 21:28:47 +04:00
Yann Leboulanger 23327c834d use prepared statements in all SQL queries that contains jids to prevent SQL injection. Fixes #7034 2011-11-08 22:00:52 +01:00
Yann Leboulanger c63b53f0cb don't loose in logs MUC messages arriving in the same second. Fixes #6860 2011-09-22 11:25:02 +02:00
Yann Leboulanger e942d8bcd5 fix var name 2011-08-25 00:03:03 +02:00
Yann Leboulanger e4ff7c6ced use NEC to handle messages / gc_messages 2010-10-18 22:05:41 +02:00
Yann Leboulanger ca43e5441c merge message archiving branch. Fixes #3593 2010-08-11 18:43:41 +02:00
Yann Leboulanger 1d0ed41d15 improve connection time. Fixes #5764 2010-07-22 20:56:50 +02:00