Mercurial > libervia-backend
comparison sat/plugins/plugin_sec_otr.py @ 3040:fee60f17ebac
jp: jp asyncio port:
/!\ this commit is huge. Jp is temporarily not working with `dbus` bridge /!\
This patch implements the port of jp to asyncio, so it is now correctly using the bridge
asynchronously, and it can be used with bridges like `pb`. This also simplify the code,
notably for things which were previously implemented with many callbacks (like pagination
with RSM).
During the process, some behaviours have been modified/fixed, in jp and backends, check
diff for details.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 25 Sep 2019 08:56:41 +0200 |
parents | ab2696e34d29 |
children | 0408df45ebe7 |
comparison
equal
deleted
inserted
replaced
3039:a1bc34f90fa5 | 3040:fee60f17ebac |
---|---|
106 @param msg_str(str): encrypted message body | 106 @param msg_str(str): encrypted message body |
107 @param appdata(None, dict): None for signal message, | 107 @param appdata(None, dict): None for signal message, |
108 message data when an encrypted message is going to be sent | 108 message data when an encrypted message is going to be sent |
109 """ | 109 """ |
110 assert isinstance(self.peer, jid.JID) | 110 assert isinstance(self.peer, jid.JID) |
111 msg = msg_str | 111 msg = msg_str.decode('utf-8') |
112 client = self.user.client | 112 client = self.user.client |
113 log.debug("injecting encrypted message to {to}".format(to=self.peer)) | 113 log.debug("injecting encrypted message to {to}".format(to=self.peer)) |
114 if appdata is None: | 114 if appdata is None: |
115 mess_data = { | 115 mess_data = { |
116 "from": client.jid, | 116 "from": client.jid, |
528 to_jid.resource = self.host.memory.getMainResource( | 528 to_jid.resource = self.host.memory.getMainResource( |
529 client, to_jid | 529 client, to_jid |
530 ) # FIXME: temporary and unsecure, must be changed when frontends | 530 ) # FIXME: temporary and unsecure, must be changed when frontends |
531 # are refactored | 531 # are refactored |
532 otrctx = client._otr_context_manager.getContextForUser(to_jid) | 532 otrctx = client._otr_context_manager.getContextForUser(to_jid) |
533 query = otrctx.sendMessage(0, "?OTRv?") | 533 query = otrctx.sendMessage(0, b"?OTRv?") |
534 otrctx.inject(query) | 534 otrctx.inject(query) |
535 | 535 |
536 def _otrSessionEnd(self, menu_data, profile): | 536 def _otrSessionEnd(self, menu_data, profile): |
537 """End an OTR session | 537 """End an OTR session |
538 | 538 |