comparison sat_bridge/DBus.py @ 52:6455fb62ff83

Connection/disconnection signals - wix, sortilege: management of this new signals /!\ sortilege is bugged, the contact list window is not updated correctly
author Goffi <goffi@goffi.org>
date Thu, 07 Jan 2010 01:55:30 +1100
parents 9c79eb49d51f
children a5b5fb5fc9fd
comparison
equal deleted inserted replaced
51:8c67ea98ab91 52:6455fb62ff83
42 self.cb[name]=cb 42 self.cb[name]=cb
43 43
44 ### signals ### 44 ### signals ###
45 45
46 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, 46 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
47 signature='')
48 def connected(self):
49 debug("Connected signal")
50
51 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
52 signature='')
53 def disconnected(self):
54 debug("Disconnected signal")
55
56 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
47 signature='sa{ss}as') 57 signature='sa{ss}as')
48 def newContact(self, contact, attributes, groups): 58 def newContact(self, contact, attributes, groups):
49 debug("new contact signal (%s) sended", contact) 59 debug("new contact signal (%s) sended", contact)
50 60
51 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, 61 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
112 def disconnect(self): 122 def disconnect(self):
113 info ("Disconnection asked") 123 info ("Disconnection asked")
114 return self.cb["disconnect"]() 124 return self.cb["disconnect"]()
115 125
116 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 126 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
127 in_signature='', out_signature='b')
128 def isConnected(self):
129 info ("Connection status asked")
130 return self.cb["isConnected"]()
131
132 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
117 in_signature='', out_signature='a(sa{ss}as)') 133 in_signature='', out_signature='a(sa{ss}as)')
118 def getContacts(self): 134 def getContacts(self):
119 debug("getContacts...") 135 debug("getContacts...")
120 return self.cb["getContacts"]() 136 return self.cb["getContacts"]()
121 137
187 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 203 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
188 in_signature='s', out_signature='') 204 in_signature='s', out_signature='')
189 def delContact(self, entity): 205 def delContact(self, entity):
190 debug("Unsubscription asked for %s", entity) 206 debug("Unsubscription asked for %s", entity)
191 return self.cb["delContact"](entity) 207 return self.cb["delContact"](entity)
192
193 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
194 in_signature='', out_signature='b')
195 def isConnected(self):
196 debug("Connection status requested")
197 return self.cb["isConnected"]()
198 208
199 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, 209 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
200 in_signature='sa{ss}', out_signature='s') 210 in_signature='sa{ss}', out_signature='s')
201 def launchAction(self, type, data): 211 def launchAction(self, type, data):
202 return self.cb["launchAction"](type, data) 212 return self.cb["launchAction"](type, data)
255 info ("Init DBus...") 265 info ("Init DBus...")
256 self.session_bus = dbus.SessionBus() 266 self.session_bus = dbus.SessionBus()
257 self.dbus_name = dbus.service.BusName(const_INT_PREFIX, self.session_bus) 267 self.dbus_name = dbus.service.BusName(const_INT_PREFIX, self.session_bus)
258 self.dbus_bridge = DbusObject(self.session_bus, '/org/goffi/SAT/bridge') 268 self.dbus_bridge = DbusObject(self.session_bus, '/org/goffi/SAT/bridge')
259 269
270 def connected(self):
271 self.dbus_bridge.connected()
272
273 def disconnected(self):
274 self.dbus_bridge.disconnected()
275
260 def newContact(self, contact, attributes, groups): 276 def newContact(self, contact, attributes, groups):
261 self.dbus_bridge.newContact(contact, attributes, groups) 277 self.dbus_bridge.newContact(contact, attributes, groups)
262 278
263 def newMessage(self,from_jid,msg,type='chat', to=''): 279 def newMessage(self,from_jid,msg,type='chat', to=''):
264 debug("sending message...") 280 debug("sending message...")