comparison libervia/backend/bridge/pb.py @ 4270:0d7bb4df2343

Reformatted code base using black.
author Goffi <goffi@goffi.org>
date Wed, 19 Jun 2024 18:44:57 +0200
parents a8a0fa678ce2
children 4cf98f506269
comparison
equal deleted inserted replaced
4269:64a85ce8be70 4270:0d7bb4df2343
96 except AttributeError: 96 except AttributeError:
97 log.debug("signals were already activated") 97 log.debug("signals were already activated")
98 else: 98 else:
99 del self.signals_paused 99 del self.signals_paused
100 log.debug("bridge signals have been reactivated") 100 log.debug("bridge signals have been reactivated")
101
101 102
102 ##METHODS_PART## 103 ##METHODS_PART##
103 104
104 105
105 class bridge(object): 106 class bridge(object):
134 log.debug("registering PB bridge method [%s]" % name) 135 log.debug("registering PB bridge method [%s]" % name)
135 setattr(self.root, "remote_" + name, callback) 136 setattr(self.root, "remote_" + name, callback)
136 #  self.root.register_method(name, callback) 137 #  self.root.register_method(name, callback)
137 138
138 def add_method( 139 def add_method(
139 self, name, int_suffix, in_sign, out_sign, method, async_=False, doc={} 140 self, name, int_suffix, in_sign, out_sign, method, async_=False, doc={}
140 ): 141 ):
141 """Dynamically add a method to PB bridge""" 142 """Dynamically add a method to PB bridge"""
142 # FIXME: doc parameter is kept only temporary, the time to remove it from calls 143 # FIXME: doc parameter is kept only temporary, the time to remove it from calls
143 log.debug("Adding method {name} to PB bridge".format(name=name)) 144 log.debug("Adding method {name} to PB bridge".format(name=name))
144 self.register_method(name, method) 145 self.register_method(name, method)
183 184
184 def entity_data_updated(self, jid, name, value, profile): 185 def entity_data_updated(self, jid, name, value, profile):
185 self.send_signal("entity_data_updated", jid, name, value, profile) 186 self.send_signal("entity_data_updated", jid, name, value, profile)
186 187
187 def message_encryption_started(self, to_jid, encryption_data, profile_key): 188 def message_encryption_started(self, to_jid, encryption_data, profile_key):
188 self.send_signal("message_encryption_started", to_jid, encryption_data, profile_key) 189 self.send_signal(
190 "message_encryption_started", to_jid, encryption_data, profile_key
191 )
189 192
190 def message_encryption_stopped(self, to_jid, encryption_data, profile_key): 193 def message_encryption_stopped(self, to_jid, encryption_data, profile_key):
191 self.send_signal("message_encryption_stopped", to_jid, encryption_data, profile_key) 194 self.send_signal(
192 195 "message_encryption_stopped", to_jid, encryption_data, profile_key
193 def message_new(self, uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile): 196 )
194 self.send_signal("message_new", uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile) 197
198 def message_new(
199 self,
200 uid,
201 timestamp,
202 from_jid,
203 to_jid,
204 message,
205 subject,
206 mess_type,
207 extra,
208 profile,
209 ):
210 self.send_signal(
211 "message_new",
212 uid,
213 timestamp,
214 from_jid,
215 to_jid,
216 message,
217 subject,
218 mess_type,
219 extra,
220 profile,
221 )
195 222
196 def message_update(self, uid, message_type, message_data, profile): 223 def message_update(self, uid, message_type, message_data, profile):
197 self.send_signal("message_update", uid, message_type, message_data, profile) 224 self.send_signal("message_update", uid, message_type, message_data, profile)
198 225
199 def notification_deleted(self, id, profile): 226 def notification_deleted(self, id, profile):
200 self.send_signal("notification_deleted", id, profile) 227 self.send_signal("notification_deleted", id, profile)
201 228
202 def notification_new(self, id, timestamp, type, body_plain, body_rich, title, requires_action, priority, expire_at, extra, profile): 229 def notification_new(
203 self.send_signal("notification_new", id, timestamp, type, body_plain, body_rich, title, requires_action, priority, expire_at, extra, profile) 230 self,
231 id,
232 timestamp,
233 type,
234 body_plain,
235 body_rich,
236 title,
237 requires_action,
238 priority,
239 expire_at,
240 extra,
241 profile,
242 ):
243 self.send_signal(
244 "notification_new",
245 id,
246 timestamp,
247 type,
248 body_plain,
249 body_rich,
250 title,
251 requires_action,
252 priority,
253 expire_at,
254 extra,
255 profile,
256 )
204 257
205 def param_update(self, name, value, category, profile): 258 def param_update(self, name, value, category, profile):
206 self.send_signal("param_update", name, value, category, profile) 259 self.send_signal("param_update", name, value, category, profile)
207 260
208 def presence_update(self, entity_jid, show, priority, statuses, profile): 261 def presence_update(self, entity_jid, show, priority, statuses, profile):