[Git][gajim/gajim][master] 2 commits: PluginManager: remove plugin path from sys.path

2017-08-07 Thread Philipp Hörist
Philipp Hörist pushed to branch master at gajim / gajim


Commits:
7e0e4cce by Philipp Hörist at 2017-08-07T19:28:54+02:00
PluginManager: remove plugin path from sys.path

Remove plugin path from sys.path after importing.

If we scan multiple plugin dirs and never remove the path from
sys.path, it is hard to predict from which path python will import
a package.

The chance that the same plugin package is in multiple plugin paths
is high.

- - - - -
635ce528 by Philipp Hörist at 2017-08-07T20:02:03+02:00
PluginManager: prefer plugins in user path

As we always load plugins from the user path first, we should not
reload them later from Gajims plugin base dir

- - - - -


1 changed file:

- gajim/plugins/pluginmanager.py


Changes:

=
gajim/plugins/pluginmanager.py
=
--- a/gajim/plugins/pluginmanager.py
+++ b/gajim/plugins/pluginmanager.py
@@ -531,6 +531,11 @@ class PluginManager(metaclass=Singleton):
 
 try:
 if module_name in sys.modules:
+if path == gajim.PLUGINS_DIRS[0]:
+# Only reload plugins from Gajim base dir when they
+# dont exist. This means plugins in the user path are
+# always preferred.
+continue
 from imp import reload
 log.info('Reloading %s', module_name)
 module = reload(sys.modules[module_name])
@@ -589,6 +594,7 @@ class PluginManager(metaclass=Singleton):
 log.debug('%s : %s' % (module_attr_name,
 'wrong manifest file. section are required!'))
 
+sys.path.remove(path)
 return plugins_found
 
 def install_from_zip(self, zip_filename, owerwrite=None):



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/compare/413c7f52d7123248cbb9b2cce1f4ec99a123ade2...635ce52856d4a71f4b2f9928e30bbe89d25847c7

---
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/compare/413c7f52d7123248cbb9b2cce1f4ec99a123ade2...635ce52856d4a71f4b2f9928e30bbe89d25847c7
You're receiving this email because of your account on dev.gajim.org.
___
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits


[Git][gajim/gajim][gajim_0.16] fix running make test

2017-08-07 Thread Yann Leboulanger
Yann Leboulanger pushed to branch gajim_0.16 at gajim / gajim


Commits:
74dea796 by Yann Leboulanger at 2017-08-07T14:55:19+02:00
fix running make test

- - - - -


1 changed file:

- test/lib/gajim_mocks.py


Changes:

=
test/lib/gajim_mocks.py
=
--- a/test/lib/gajim_mocks.py
+++ b/test/lib/gajim_mocks.py
@@ -25,6 +25,7 @@ class MockConnection(Mock, ConnectionHandlers):
 self.sessions = {}
 self.nested_group_delimiter = '::'
 self.received_message_hashes = []
+self.server_resource = 'Gajim'
 
 gajim.interface.instances[account] = {'infos': {}, 'disco': {},
 'gc_config': {}, 'search': {}, 'sub_request': {}}



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/74dea79668973d3c4e00fe776c0ba71226bfee7c

---
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/74dea79668973d3c4e00fe776c0ba71226bfee7c
You're receiving this email because of your account on dev.gajim.org.
___
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits


[Git][gajim/gajim][master] 3 commits: Log sent messages with new logger method

2017-08-07 Thread Philipp Hörist
Philipp Hörist pushed to branch master at gajim / gajim


Commits:
9d2898bb by Philipp Hörist at 2017-08-02T23:34:24+02:00
Log sent messages with new logger method

- also save stanza id to the DB

- - - - -
a2e2fb2e by Philipp Hörist at 2017-08-02T23:40:55+02:00
Remove useless code

Simplify whats left

- - - - -
1eeb53be by Philipp Hörist at 2017-08-07T13:34:23+02:00
Use correct file date on Jingle FT

- XEP-0234 demands UTC
- we missed the Z at the end
- simplified the code

- - - - -


5 changed files:

- gajim/chat_control.py
- gajim/common/connection.py
- gajim/common/connection_handlers_events.py
- gajim/filetransfers_window.py
- gajim/message_control.py


Changes:

=
gajim/chat_control.py
=
--- a/gajim/chat_control.py
+++ b/gajim/chat_control.py
@@ -927,7 +927,7 @@ class ChatControl(ChatControlBase):
 gtkgui_helpers.remove_css_class(
 self.msg_textview, 'msgcorrectingcolor')
 
-self.print_conversation(message, self.contact.jid,
+self.print_conversation(message, self.contact.jid, 
tim=obj.timestamp,
 encrypted=encrypted, xep0184_id=xep0184_id, xhtml=xhtml,
 displaymarking=displaymarking, msg_stanza_id=id_,
 correct_id=obj.correct_id,


=
gajim/common/connection.py
=
--- a/gajim/common/connection.py
+++ b/gajim/common/connection.py
@@ -426,21 +426,16 @@ class CommonConnection:
 return
 
 if obj.xhtml and gajim.config.get('log_xhtml_messages'):
-message = '%s' % (nbxmpp.NS_XHTML,
-  obj.xhtml)
-else:
-message = obj.original_message or obj.message
-if not message:
+obj.message = '%s' % (nbxmpp.NS_XHTML,
+  obj.xhtml)
+if obj.message is None:
 return
 
-if obj.type_ == 'chat':
-kind = 'chat_msg_sent'
-else:
-kind = 'single_msg_sent'
-
-gajim.logger.write(
-kind, jid, message, subject=obj.subject,
-additional_data=obj.additional_data)
+gajim.logger.insert_into_logs(jid, obj.timestamp, obj.kind,
+  message=obj.message,
+  subject=obj.subject,
+  additional_data=obj.additional_data,
+  stanza_id=obj.stanza_id)
 
 def ack_subscribed(self, jid):
 """
@@ -2051,6 +2046,7 @@ class Connection(CommonConnection, ConnectionHandlers):
 self.send_message(obj)
 
 def send_message(self, obj):
+obj.timestamp = time.time()
 obj.stanza_id = self.connection.send(obj.msg_iq, now=obj.now)
 
 gajim.nec.push_incoming_event(MessageSentEvent(


=
gajim/common/connection_handlers_events.py
=
--- a/gajim/common/connection_handlers_events.py
+++ b/gajim/common/connection_handlers_events.py
@@ -2707,10 +2707,12 @@ class MessageOutgoingEvent(nec.NetworkOutgoingEvent):
 base_network_events = []
 
 def init(self):
-self.additional_data = {}
-self.message = ''
+self.additional_data = None
+self.message = None
 self.keyID = None
 self.type_ = 'chat'
+self.kind = None
+self.timestamp = None
 self.subject = ''
 self.chatstate = None
 self.stanza_id = None
@@ -2721,7 +2723,6 @@ class MessageOutgoingEvent(nec.NetworkOutgoingEvent):
 self.session = None
 self.forward_from = None
 self.form_node = None
-self.original_message = None
 self.delayed = None
 self.callback = None
 self.callback_args = []
@@ -2741,6 +2742,10 @@ class MessageOutgoingEvent(nec.NetworkOutgoingEvent):
 return self.jid
 
 def generate(self):
+if self.type_ == 'chat':
+self.kind = KindConstant.CHAT_MSG_SENT
+else:
+self.kind = KindConstant.SINGLE_MSG_SENT
 return True
 
 class StanzaMessageOutgoingEvent(nec.NetworkOutgoingEvent):


=
gajim/filetransfers_window.py
=
--- a/gajim/filetransfers_window.py
+++ b/gajim/filetransfers_window.py
@@ -30,6 +30,7 @@ import os
 import time
 
 from enum import IntEnum, unique
+from datetime import datetime
 
 import gtkgui_helpers
 import tooltips
@@ -682,11 +683,8 @@ class FileTransfersWindow:
 
 def __convert_date(self, epoch):
 # Converts date-time from seconds from epoch to iso 8601
-import time, datetime
-ts = time.gmtime(epoch)
-dt = datetime.datetime(ts.tm_year, ts.tm_mon, ts.tm_mday, ts.tm_hour,
-