Mercurial > libervia-backend
comparison frontends/quick_frontend/quick_app.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 | 8c67ea98ab91 |
children | 6dfe5bb10008 |
comparison
equal
deleted
inserted
replaced
51:8c67ea98ab91 | 52:6455fb62ff83 |
---|---|
30 def __init__(self): | 30 def __init__(self): |
31 self.rosterList = {} | 31 self.rosterList = {} |
32 | 32 |
33 ## bridge ## | 33 ## bridge ## |
34 self.bridge=DBusBridgeFrontend() | 34 self.bridge=DBusBridgeFrontend() |
35 self.bridge.register("connected", self.connected) | |
36 self.bridge.register("disconnected", self.disconnected) | |
35 self.bridge.register("newContact", self.newContact) | 37 self.bridge.register("newContact", self.newContact) |
36 self.bridge.register("newMessage", self.newMessage) | 38 self.bridge.register("newMessage", self.newMessage) |
37 self.bridge.register("presenceUpdate", self.presenceUpdate) | 39 self.bridge.register("presenceUpdate", self.presenceUpdate) |
38 self.bridge.register("subscribe", self.subscribe) | 40 self.bridge.register("subscribe", self.subscribe) |
39 self.bridge.register("paramUpdate", self.paramUpdate) | 41 self.bridge.register("paramUpdate", self.paramUpdate) |
52 self.current_action_ids_cb = {} | 54 self.current_action_ids_cb = {} |
53 self.onlineContact = set() #FIXME: temporary | 55 self.onlineContact = set() #FIXME: temporary |
54 | 56 |
55 if self.bridge.isConnected(): | 57 if self.bridge.isConnected(): |
56 self.setStatusOnline(True) | 58 self.setStatusOnline(True) |
59 else: | |
60 self.setStatusOnline(False) | |
61 return | |
57 | 62 |
58 ### now we fill the contact list ### | 63 ### now we fill the contact list ### |
59 for contact in self.bridge.getContacts(): | 64 for contact in self.bridge.getContacts(): |
60 self.newContact(contact[0], contact[1], contact[2]) | 65 self.newContact(contact[0], contact[1], contact[2]) |
61 | 66 |
71 waitingSub = self.bridge.getWaitingSub() | 76 waitingSub = self.bridge.getWaitingSub() |
72 for sub in waitingSub: | 77 for sub in waitingSub: |
73 self.subscribe(waitingSub[sub], sub) | 78 self.subscribe(waitingSub[sub], sub) |
74 | 79 |
75 | 80 |
81 def connected(self): | |
82 """called when the connection is made""" | |
83 debug("Connected") | |
84 self.setStatusOnline(True) | |
85 | |
86 def disconnected(self): | |
87 """called when the connection is closed""" | |
88 debug("Disconnected") | |
89 self.CM.clear() | |
90 self.contactList.clear_contacts() | |
91 self.setStatusOnline(False) | |
92 | |
76 def newContact(self, JabberId, attributes, groups): | 93 def newContact(self, JabberId, attributes, groups): |
77 entity=JID(JabberId) | 94 entity=JID(JabberId) |
78 self.rosterList[entity.short]=(dict(attributes), list(groups)) | 95 self.rosterList[entity.short]=(dict(attributes), list(groups)) |
79 | 96 |
80 def newMessage(self, from_jid, msg, type, to_jid): | 97 def newMessage(self, from_jid, msg, type, to_jid): |