Philipp Hörist pushed to branch master at gajim / gajim
Commits:
c5f3aa16 by Philipp Hörist at 2018-02-28T17:58:26+01:00
Set correct kind on incoming MAM messages
- - - - -
1 changed file:
- gajim/chat_control.py
Changes:
=====================================
gajim/chat_control.py
=====================================
--- a/gajim/chat_control.py
+++ b/gajim/chat_control.py
@@ -815,7 +815,7 @@ class ChatControl(ChatControlBase):
if obj.with_ != self.contact.jid:
return
- kind = 'incoming'
+ kind = '' # incoming
if obj.kind == KindConstant.CHAT_MSG_SENT:
kind = 'outgoing'
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/c5f3aa169fd133a6f2c61aa8a226b36afc…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/c5f3aa169fd133a6f2c61aa8a226b36afc…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
a4bfd2fc by Philipp Hörist at 2018-02-26T22:24:30+01:00
Add get_contact_strict()
This adds a method that returns only a contact if there is an exact match,
instead of a contact where only the barejid matches.
We need this when we update the Caps of a contact.
- - - - -
1 changed file:
- gajim/common/contacts.py
Changes:
=====================================
gajim/common/contacts.py
=====================================
--- a/gajim/common/contacts.py
+++ b/gajim/common/contacts.py
@@ -509,6 +509,15 @@ class Contacts():
return c
return self._contacts[jid][0]
+ def get_contact_strict(self, jid, resource):
+ """
+ Return the contact instance for the given resource or None
+ """
+ if jid in self._contacts:
+ for c in self._contacts[jid]:
+ if c.resource == resource:
+ return c
+
def get_avatar(self, jid, size=None, scale=None):
if jid not in self._contacts:
return None
@@ -554,7 +563,7 @@ class Contacts():
Get Contact object for specific resource of given jid
"""
barejid, resource = common.app.get_room_and_nick_from_fjid(fjid)
- return self.get_contact(barejid, resource)
+ return self.get_contact_strict(barejid, resource)
def get_first_contact_from_jid(self, jid):
if jid in self._contacts:
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/a4bfd2fcbbb069bfff116990be91238af9…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/a4bfd2fcbbb069bfff116990be91238af9…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
77be67f6 by Philipp Hörist at 2018-02-25T22:02:39+01:00
Only use fallback duplicate search on MAM < 2
- - - - -
c6e39309 by Philipp Hörist at 2018-02-26T20:49:01+01:00
Use MessageSentEvent to print to ChatControl
Its later than StanzaMessageOutgoingEvent, this allows encryption
Plugins to not return the encrypted payload immediatly.
For example encrypting may take some time because a password is needed
or the load has to be encrypted in another Thread.
- - - - -
3 changed files:
- gajim/chat_control.py
- gajim/common/connection.py
- gajim/common/message_archiving.py
Changes:
=====================================
gajim/chat_control.py
=====================================
--- a/gajim/chat_control.py
+++ b/gajim/chat_control.py
@@ -238,7 +238,7 @@ class ChatControl(ChatControlBase):
self._nec_chatstate_received)
app.ged.register_event_handler('caps-received', ged.GUI1,
self._nec_caps_received)
- app.ged.register_event_handler('stanza-message-outgoing', ged.OUT_POSTCORE,
+ app.ged.register_event_handler('message-sent', ged.OUT_POSTCORE,
self._message_sent)
app.ged.register_event_handler(
'mam-decrypted-message-received',
@@ -1160,7 +1160,7 @@ class ChatControl(ChatControlBase):
self._nec_chatstate_received)
app.ged.remove_event_handler('caps-received', ged.GUI1,
self._nec_caps_received)
- app.ged.remove_event_handler('stanza-message-outgoing', ged.OUT_POSTCORE,
+ app.ged.remove_event_handler('message-sent', ged.OUT_POSTCORE,
self._message_sent)
self.unsubscribe_events()
=====================================
gajim/common/connection.py
=====================================
--- a/gajim/common/connection.py
+++ b/gajim/common/connection.py
@@ -2075,10 +2075,7 @@ class Connection(CommonConnection, ConnectionHandlers):
obj.timestamp = time.time()
obj.stanza_id = self.connection.send(obj.msg_iq, now=obj.now)
- app.nec.push_incoming_event(MessageSentEvent(
- None, conn=self, jid=obj.jid, message=obj.message, keyID=obj.keyID,
- chatstate=obj.chatstate, automatic_message=obj.automatic_message,
- stanza_id=obj.stanza_id, additional_data=obj.additional_data))
+ app.nec.push_incoming_event(MessageSentEvent(None, **vars(obj)))
if isinstance(obj.jid, list):
for j in obj.jid:
=====================================
gajim/common/message_archiving.py
=====================================
--- a/gajim/common/message_archiving.py
+++ b/gajim/common/message_archiving.py
@@ -200,13 +200,19 @@ class ConnectionArchive313:
def _nec_mam_decrypted_message_received(self, obj):
if obj.conn.name != self.name:
return
- # if self.archiving_namespace != nbxmpp.NS_MAM_2:
- # Fallback duplicate search without stanza-id
- duplicate = app.logger.search_for_duplicate(
- self.name, obj.with_, obj.timestamp, obj.msgtxt)
- if duplicate:
- # dont propagate the event further
- return True
+
+ namespace = self.archiving_namespace
+ if obj.groupchat:
+ namespace = muc_caps_cache.get_mam_namespace(obj.room_jid)
+
+ if namespace != nbxmpp.NS_MAM_2:
+ # Fallback duplicate search without stanza-id
+ duplicate = app.logger.search_for_duplicate(
+ self.name, obj.with_, obj.timestamp, obj.msgtxt)
+ if duplicate:
+ # dont propagate the event further
+ return True
+
app.logger.insert_into_logs(self.name,
obj.with_,
obj.timestamp,
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/c74c888506777ce137688fc58a2b7a429…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/c74c888506777ce137688fc58a2b7a429…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
6b52ade8 by l-n-s at 2018-02-25T15:39:18-05:00
Fix UnicodeDecodeError exceptions when connecting with Socks5 proxy
- - - - -
cc2e4a26 by Philipp Hörist at 2018-02-25T21:44:55+01:00
Merge branch 'fix_socks5_issue' into 'master'
Fix UnicodeDecodeError exceptions when connecting with Socks5 proxy
Closes #48
See merge request gajim/python-nbxmpp!14
- - - - -
2 changed files:
- nbxmpp/proxy_connectors.py
- nbxmpp/transports_nb.py
Changes:
=====================================
nbxmpp/proxy_connectors.py
=====================================
--- a/nbxmpp/proxy_connectors.py
+++ b/nbxmpp/proxy_connectors.py
@@ -234,7 +234,8 @@ class SOCKS5Connector(ProxyConnector):
elif reply[3] == '\x01':
begin, end = 3, 7
elif reply[3] == '\x03':
- begin, end = 4, 4 + reply[4]
+ # Socks5 is bound to domain name
+ pass
else:
log.error('Invalid proxy reply')
self.on_failure('Invalid proxy reply')
=====================================
nbxmpp/transports_nb.py
=====================================
--- a/nbxmpp/transports_nb.py
+++ b/nbxmpp/transports_nb.py
@@ -655,6 +655,12 @@ class NonBlockingTCP(NonBlockingTransport, IdleObject):
try:
received = decode_py2(received, 'utf-8')
except UnicodeDecodeError:
+ if received.startswith(str('\x05\x00\x00\x03')):
+ # Received Socks5 reply with bind domain name
+ # Changing last 2 bytes (port) to \x00 to decode it correctly,
+ # since Socks5 bind address and port are not used elsewhere
+ received = received[:-2] + str('\x00\x00')
+
for i in range(-1, -4, -1):
char = received[i]
if sys.version_info[0] < 3: # with py2 we get a str
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/compare/0f3e1ba0e442091667c57ca5f…
---
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/compare/0f3e1ba0e442091667c57ca5f…
You're receiving this email because of your account on dev.gajim.org.