Philipp Hörist pushed to branch master at gajim / gajim
Commits:
ea2f76f2 by Philipp Hörist at 2018-11-06T20:31:43Z
Show correct icon in roster tooltip
- - - - -
1 changed file:
- gajim/gtk/tooltips.py
Changes:
=====================================
gajim/gtk/tooltips.py
=====================================
@@ -383,6 +383,8 @@ class RosterTooltip(Gtk.Window, StatusTable):
if self.num_resources > 1:
self._ui.status_label.show()
transport = app.get_transport_name_from_jid(self.prim_contact.jid)
+ if transport == 'jabber':
+ transport = None
contact_keys = sorted(contacts_dict.keys())
contact_keys.reverse()
for priority in contact_keys:
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/ea2f76f24e0144e1f7503c5d58b42591d7…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/ea2f76f24e0144e1f7503c5d58b42591d7…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch gajim_1.1 at gajim / gajim
Commits:
7730bc0e by Philipp Hörist at 2018-11-05T20:11:39Z
Cast messages from a bare muc jid to groupchat
- - - - -
1 changed file:
- gajim/common/modules/message.py
Changes:
=====================================
gajim/common/modules/message.py
=====================================
@@ -163,6 +163,7 @@ class Message:
# TODO: why is this here?
if stanza.getTag('html'):
stanza.delChild('html')
+ type_ = 'groupchat'
session = None
if type_ != 'groupchat':
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/7730bc0e37776bd9013a232ba49fda1773…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/7730bc0e37776bd9013a232ba49fda1773…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
b4d34bf7 by Emmanuel Gil Peyrot at 2018-11-05T18:58:49Z
Move XEP-0231 into its own module
- - - - -
f5a19c24 by Philipp Hörist at 2018-11-05T20:08:34Z
Cast messages from a bare muc jid to groupchat
- - - - -
5 changed files:
- gajim/common/connection.py
- gajim/common/connection_handlers.py
- gajim/common/connection_handlers_events.py
- + gajim/common/modules/bits_of_binary.py
- gajim/common/modules/message.py
Changes:
=====================================
gajim/common/connection.py
=====================================
@@ -116,8 +116,6 @@ class CommonConnection:
self.muc_jid = {} # jid of muc server for each transport type
self._stun_servers = [] # STUN servers of our jabber server
- self.awaiting_cids = {} # Used for XEP-0231
-
# Tracks the calls of the connect_machine() method
self._connect_machine_calls = 0
=====================================
gajim/common/connection_handlers.py
=====================================
@@ -446,54 +446,6 @@ class ConnectionHandlers(ConnectionSocks5Bytestream,
app.nec.push_incoming_event(GcMessageReceivedEvent(None,
conn=self, msg_obj=msg_obj))
- def _on_bob_received(self, conn, result, cid):
- """
- Called when we receive BoB data
- """
- if cid not in self.awaiting_cids:
- return
-
- if result.getType() == 'result':
- data = result.getTags('data', namespace=nbxmpp.NS_BOB)
- if data.getAttr('cid') == cid:
- for func in self.awaiting_cids[cid]:
- cb = func[0]
- args = func[1]
- pos = func[2]
- bob_data = data.getData()
- def recurs(node, cid, data):
- if node.getData() == 'cid:' + cid:
- node.setData(data)
- else:
- for child in node.getChildren():
- recurs(child, cid, data)
- recurs(args[pos], cid, bob_data)
- cb(*args)
- del self.awaiting_cids[cid]
- return
-
- # An error occured, call callback without modifying data.
- for func in self.awaiting_cids[cid]:
- cb = func[0]
- args = func[1]
- cb(*args)
- del self.awaiting_cids[cid]
-
- def get_bob_data(self, cid, to, callback, args, position):
- """
- Request for BoB (XEP-0231) and when data will arrive, call callback
- with given args, after having replaced cid by it's data in
- args[position]
- """
- if cid in self.awaiting_cids:
- self.awaiting_cids[cid].appends((callback, args, position))
- else:
- self.awaiting_cids[cid] = [(callback, args, position)]
- iq = nbxmpp.Iq(to=to, typ='get')
- iq.addChild(name='data', attrs={'cid': cid}, namespace=nbxmpp.NS_BOB)
- self.connection.SendAndCallForResponse(iq, self._on_bob_received,
- {'cid': cid})
-
def _nec_agent_removed(self, obj):
if obj.conn.name != self.name:
return
=====================================
gajim/common/connection_handlers_events.py
=====================================
@@ -490,7 +490,8 @@ class GcMessageReceivedEvent(nec.NetworkIncomingEvent):
uri.setData(data.getData())
found = True
if not found:
- self.conn.get_bob_data(uri_data, self.fjid,
+ self.conn.get_module('BitsOfBinary').get_bob_data(
+ uri_data, self.fjid,
self.conn._dispatch_gc_msg_with_captcha,
[self.stanza, self.msg_obj], 0)
return
=====================================
gajim/common/modules/bits_of_binary.py
=====================================
@@ -0,0 +1,95 @@
+# Copyright (C) 2018 Emmanuel Gil Peyrot <linkmauve AT linkmauve.fr>
+#
+# This file is part of Gajim.
+#
+# Gajim is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published
+# by the Free Software Foundation; version 3 only.
+#
+# Gajim is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
+
+import logging
+
+import nbxmpp
+
+log = logging.getLogger('gajim.c.m.bob')
+
+
+class BitsOfBinary:
+ def __init__(self, con):
+ self._con = con
+ self._account = con.name
+
+ self.handlers = [
+ ('iq', self._answer_bob_request, 'get', nbxmpp.NS_BOB)
+ ]
+
+ # Used to track which cids are in-flight.
+ self.awaiting_cids = {}
+
+ def _answer_bob_request(self, _con, stanza):
+ log.info('Request from %s for BoB data', stanza.getFrom())
+ iq = stanza.buildReply('error')
+ err = nbxmpp.ErrorNode(nbxmpp.ERR_ITEM_NOT_FOUND)
+ iq.addChild(node=err)
+ log.info('Sending item-not-found')
+ self._con.connection.send(iq)
+ raise nbxmpp.NodeProcessed
+
+ def _on_bob_received(self, _con, result, cid):
+ """
+ Called when we receive BoB data
+ """
+ if cid not in self.awaiting_cids:
+ return
+
+ if result.getType() == 'result':
+ data = result.getTags('data', namespace=nbxmpp.NS_BOB)
+ if data.getAttr('cid') == cid:
+ for func in self.awaiting_cids[cid]:
+ cb = func[0]
+ args = func[1]
+ pos = func[2]
+ bob_data = data.getData()
+ def recurs(node, cid, data):
+ if node.getData() == 'cid:' + cid:
+ node.setData(data)
+ else:
+ for child in node.getChildren():
+ recurs(child, cid, data)
+ recurs(args[pos], cid, bob_data)
+ cb(*args)
+ del self.awaiting_cids[cid]
+ return
+
+ # An error occured, call callback without modifying data.
+ for func in self.awaiting_cids[cid]:
+ cb = func[0]
+ args = func[1]
+ cb(*args)
+ del self.awaiting_cids[cid]
+
+ def get_bob_data(self, cid, to, callback, args, position):
+ """
+ Request for BoB (XEP-0231) and when data will arrive, call callback
+ with given args, after having replaced cid by it's data in
+ args[position]
+ """
+ if cid in self.awaiting_cids:
+ self.awaiting_cids[cid].appends((callback, args, position))
+ else:
+ self.awaiting_cids[cid] = [(callback, args, position)]
+ iq = nbxmpp.Iq(to=to, typ='get')
+ iq.addChild(name='data', attrs={'cid': cid}, namespace=nbxmpp.NS_BOB)
+ self._con.connection.SendAndCallForResponse(
+ iq, self._on_bob_received, {'cid': cid})
+
+
+def get_instance(*args, **kwargs):
+ return BitsOfBinary(*args, **kwargs), 'BitsOfBinary'
=====================================
gajim/common/modules/message.py
=====================================
@@ -163,6 +163,7 @@ class Message:
# TODO: why is this here?
if stanza.getTag('html'):
stanza.delChild('html')
+ type_ = 'groupchat'
session = None
if type_ != 'groupchat':
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/2ec1baa7bd3bf054cc48d5ddfddf0dc60…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/2ec1baa7bd3bf054cc48d5ddfddf0dc60…
You're receiving this email because of your account on dev.gajim.org.