annotate sat/bridge/pb.py @ 3028:ab2696e34d29

Python 3 port: /!\ this is a huge commit /!\ starting from this commit, SàT is needs Python 3.6+ /!\ SàT maybe be instable or some feature may not work anymore, this will improve with time This patch port backend, bridge and frontends to Python 3. Roughly this has been done this way: - 2to3 tools has been applied (with python 3.7) - all references to python2 have been replaced with python3 (notably shebangs) - fixed files not handled by 2to3 (notably the shell script) - several manual fixes - fixed issues reported by Python 3 that where not handled in Python 2 - replaced "async" with "async_" when needed (it's a reserved word from Python 3.7) - replaced zope's "implements" with @implementer decorator - temporary hack to handle data pickled in database, as str or bytes may be returned, to be checked later - fixed hash comparison for password - removed some code which is not needed anymore with Python 3 - deactivated some code which needs to be checked (notably certificate validation) - tested with jp, fixed reported issues until some basic commands worked - ported Primitivus (after porting dependencies like urwid satext) - more manual fixes
author Goffi <goffi@goffi.org>
date Tue, 13 Aug 2019 19:08:41 +0200
parents c7c52c0dc13a
children a1bc34f90fa5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2894
diff changeset
1 #!/usr/bin/env python3
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2579
diff changeset
2 # -*- coding: utf-8 -*-
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
3
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # SAT: a jabber client
2771
003b8b4b56a7 date update
Goffi <goffi@goffi.org>
parents: 2655
diff changeset
5 # Copyright (C) 2009-2019 Jérôme Poisson (goffi@goffi.org)
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
6
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or modify
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
10 # (at your option) any later version.
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
11
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
15 # GNU Affero General Public License for more details.
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
16
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
19
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
20
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
21 from sat.core.log import getLogger
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2579
diff changeset
22
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
23 from twisted.spread import jelly, pb
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
24 from twisted.internet import reactor
2892
82b781c46841 core: added a rosterResync method to bridge:
Goffi <goffi@goffi.org>
parents: 2854
diff changeset
25 log = getLogger(__name__)
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
26
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
27
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
28 ## jelly hack
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
29 # we monkey patch jelly to handle namedtuple
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
30 ori_jelly = jelly._Jellier.jelly
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
31
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2579
diff changeset
32
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
33 def fixed_jelly(self, obj):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
34 """this method fix handling of namedtuple"""
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
35 if isinstance(obj, tuple) and not obj is tuple:
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
36 obj = tuple(obj)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
37 return ori_jelly(self, obj)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
38
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2579
diff changeset
39
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
40 jelly._Jellier.jelly = fixed_jelly
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
41
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
42
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
43 class PBRoot(pb.Root):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
44 def __init__(self):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
45 self.signals_handlers = []
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
46
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
47 def remote_initBridge(self, signals_handler):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
48 self.signals_handlers.append(signals_handler)
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2894
diff changeset
49 log.info("registered signal handler")
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
50
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
51 def sendSignalEb(self, failure, signal_name):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2579
diff changeset
52 log.error(
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2894
diff changeset
53 "Error while sending signal {name}: {msg}".format(
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2579
diff changeset
54 name=signal_name, msg=failure
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2579
diff changeset
55 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2579
diff changeset
56 )
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
57
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
58 def sendSignal(self, name, args, kwargs):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
59 to_remove = []
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
60 for handler in self.signals_handlers:
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
61 try:
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
62 d = handler.callRemote(name, *args, **kwargs)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
63 except pb.DeadReferenceError:
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
64 to_remove.append(handler)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
65 else:
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
66 d.addErrback(self.sendSignalEb, name)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
67 if to_remove:
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
68 for handler in to_remove:
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2894
diff changeset
69 log.debug("Removing signal handler for dead frontend")
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
70 self.signals_handlers.remove(handler)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
71
2840
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
72 def _bridgeDeactivateSignals(self):
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
73 if hasattr(self, "signals_paused"):
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2894
diff changeset
74 log.warning("bridge signals already deactivated")
2840
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
75 if self.signals_handler:
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
76 self.signals_paused.extend(self.signals_handler)
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
77 else:
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
78 self.signals_paused = self.signals_handlers
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
79 self.signals_handlers = []
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2894
diff changeset
80 log.debug("bridge signals have been deactivated")
2840
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
81
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
82 def _bridgeReactivateSignals(self):
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
83 try:
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
84 self.signals_handlers = self.signals_paused
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
85 except AttributeError:
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2894
diff changeset
86 log.debug("signals were already activated")
2840
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
87 else:
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
88 del self.signals_paused
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2894
diff changeset
89 log.debug("bridge signals have been reactivated")
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2579
diff changeset
90
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
91 ##METHODS_PART##
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
92
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
93
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
94 class Bridge(object):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
95 def __init__(self):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
96 log.info("Init Perspective Broker...")
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
97 self.root = PBRoot()
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
98 reactor.listenTCP(8789, pb.PBServerFactory(self.root))
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
99
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
100 def sendSignal(self, name, *args, **kwargs):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
101 self.root.sendSignal(name, args, kwargs)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
102
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
103 def remote_initBridge(self, signals_handler):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
104 self.signals_handlers.append(signals_handler)
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2894
diff changeset
105 log.info("registered signal handler")
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
106
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
107 def register_method(self, name, callback):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
108 log.debug("registering PB bridge method [%s]" % name)
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2579
diff changeset
109 setattr(self.root, "remote_" + name, callback)
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2579
diff changeset
110 #  self.root.register_method(name, callback)
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
111
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2894
diff changeset
112 def addMethod(self, name, int_suffix, in_sign, out_sign, method, async_=False, doc={}):
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
113 """Dynamically add a method to PB Bridge"""
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2579
diff changeset
114 # FIXME: doc parameter is kept only temporary, the time to remove it from calls
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
115 log.debug("Adding method {name} to PB bridge".format(name=name))
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
116 self.register_method(name, method)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
117
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
118 def addSignal(self, name, int_suffix, signature, doc={}):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
119 log.debug("Adding signal {name} to PB bridge".format(name=name))
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2579
diff changeset
120 setattr(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2579
diff changeset
121 self, name, lambda *args, **kwargs: self.sendSignal(name, *args, **kwargs)
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2579
diff changeset
122 )
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
123
2840
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
124 def bridgeDeactivateSignals(self):
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
125 """Stop sending signals to bridge
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
126
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
127 Mainly used for mobile frontends, when the frontend is paused
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
128 """
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
129 self.root._bridgeDeactivateSignals()
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
130
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
131 def bridgeReactivateSignals(self):
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
132 """Send again signals to bridge
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
133
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
134 Should only be used after bridgeDeactivateSignals has been called
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
135 """
0f277708e2ae bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
136 self.root._bridgeReactivateSignals()
2628
779351da2c13 core, frontends: replaced org\.goffi namespaces by org.salutatoi + fixed generation:
Goffi <goffi@goffi.org>
parents: 2624
diff changeset
137
2854
eb9fa72eb62b core: added a "_debug" signal:
Goffi <goffi@goffi.org>
parents: 2840
diff changeset
138 def _debug(self, action, params, profile):
eb9fa72eb62b core: added a "_debug" signal:
Goffi <goffi@goffi.org>
parents: 2840
diff changeset
139 self.sendSignal("_debug", action, params, profile)
eb9fa72eb62b core: added a "_debug" signal:
Goffi <goffi@goffi.org>
parents: 2840
diff changeset
140
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
141 def actionNew(self, action_data, id, security_limit, profile):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
142 self.sendSignal("actionNew", action_data, id, security_limit, profile)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
143
2894
c7c52c0dc13a core, quick_frontend(app): fixed connected signal handling
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
144 def connected(self, jid_s, profile):
c7c52c0dc13a core, quick_frontend(app): fixed connected signal handling
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
145 self.sendSignal("connected", jid_s, profile)
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
146
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
147 def contactDeleted(self, entity_jid, profile):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
148 self.sendSignal("contactDeleted", entity_jid, profile)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
149
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
150 def disconnected(self, profile):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
151 self.sendSignal("disconnected", profile)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
152
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
153 def entityDataUpdated(self, jid, name, value, profile):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
154 self.sendSignal("entityDataUpdated", jid, name, value, profile)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
155
2655
b8600f8130ac core (bridge): new messageEncryptionStarted and messageEncryptionStopped signals (not used yet)
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
156 def messageEncryptionStarted(self, to_jid, encryption_data, profile_key):
b8600f8130ac core (bridge): new messageEncryptionStarted and messageEncryptionStopped signals (not used yet)
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
157 self.sendSignal("messageEncryptionStarted", to_jid, encryption_data, profile_key)
b8600f8130ac core (bridge): new messageEncryptionStarted and messageEncryptionStopped signals (not used yet)
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
158
b8600f8130ac core (bridge): new messageEncryptionStarted and messageEncryptionStopped signals (not used yet)
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
159 def messageEncryptionStopped(self, to_jid, encryption_data, profile_key):
b8600f8130ac core (bridge): new messageEncryptionStarted and messageEncryptionStopped signals (not used yet)
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
160 self.sendSignal("messageEncryptionStopped", to_jid, encryption_data, profile_key)
b8600f8130ac core (bridge): new messageEncryptionStarted and messageEncryptionStopped signals (not used yet)
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
161
2628
779351da2c13 core, frontends: replaced org\.goffi namespaces by org.salutatoi + fixed generation:
Goffi <goffi@goffi.org>
parents: 2624
diff changeset
162 def messageNew(self, uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile):
779351da2c13 core, frontends: replaced org\.goffi namespaces by org.salutatoi + fixed generation:
Goffi <goffi@goffi.org>
parents: 2624
diff changeset
163 self.sendSignal("messageNew", uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile)
2579
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
164
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
165 def newContact(self, contact_jid, attributes, groups, profile):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
166 self.sendSignal("newContact", contact_jid, attributes, groups, profile)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
167
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
168 def paramUpdate(self, name, value, category, profile):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
169 self.sendSignal("paramUpdate", name, value, category, profile)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
170
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
171 def presenceUpdate(self, entity_jid, show, priority, statuses, profile):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
172 self.sendSignal("presenceUpdate", entity_jid, show, priority, statuses, profile)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
173
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
174 def progressError(self, id, error, profile):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
175 self.sendSignal("progressError", id, error, profile)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
176
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
177 def progressFinished(self, id, metadata, profile):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
178 self.sendSignal("progressFinished", id, metadata, profile)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
179
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
180 def progressStarted(self, id, metadata, profile):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
181 self.sendSignal("progressStarted", id, metadata, profile)
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
182
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
183 def subscribe(self, sub_type, entity_jid, profile):
787b15d16347 bridge: added generated pb files to repository (needed for Cagou on Android)
Goffi <goffi@goffi.org>
parents:
diff changeset
184 self.sendSignal("subscribe", sub_type, entity_jid, profile)