Mercurial > libervia-backend
comparison frontends/quick_frontend/quick_app.py @ 183:9ee4a1d0d7fb
Added auto(dis)connect params + misc
- parameters,xmlui: "bool" type is now managed
- parameters,xmlui: categories now use label in addition of name
- QuickFrontend: auto(dis)connection management
- plugin XEP-0045: an error dialog is now show in frontend if room cannot be joined
- Wix: fixed unproper close event management
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 18 Aug 2010 15:57:26 +0800 |
parents | 556c2bd7c344 |
children | 7baee9bb37af |
comparison
equal
deleted
inserted
replaced
182:556c2bd7c344 | 183:9ee4a1d0d7fb |
---|---|
117 if self.single_profile: | 117 if self.single_profile: |
118 self.profile = profile | 118 self.profile = profile |
119 | 119 |
120 ###now we get the essential params### | 120 ###now we get the essential params### |
121 self.profiles[profile]['whoami']=JID(self.bridge.getParamA("JabberID","Connection", profile)) | 121 self.profiles[profile]['whoami']=JID(self.bridge.getParamA("JabberID","Connection", profile)) |
122 autoconnect = self.bridge.getParamA("autoconnect","Connection", profile) == "true" | |
122 self.profiles[profile]['watched']=self.bridge.getParamA("Watched", "Misc", profile).split() #TODO: put this in a plugin | 123 self.profiles[profile]['watched']=self.bridge.getParamA("Watched", "Misc", profile).split() #TODO: put this in a plugin |
123 | 124 |
124 ## misc ## | 125 ## misc ## |
125 self.profiles[profile]['onlineContact'] = set() #FIXME: temporary | 126 self.profiles[profile]['onlineContact'] = set() #FIXME: temporary |
126 | 127 |
127 #TODO: gof: managed multi-profiles here | 128 #TODO: gof: manage multi-profiles here |
128 if self.bridge.isConnected(profile): | 129 if not self.bridge.isConnected(profile): |
130 self.setStatusOnline(False) | |
131 else: | |
129 self.setStatusOnline(True) | 132 self.setStatusOnline(True) |
130 else: | 133 |
131 self.setStatusOnline(False) | 134 ### now we fill the contact list ### |
132 return | 135 for contact in self.bridge.getContacts(profile): |
133 | 136 self.newContact(contact[0], contact[1], contact[2], profile) |
134 ### now we fill the contact list ### | 137 |
135 for contact in self.bridge.getContacts(profile): | 138 presences = self.bridge.getPresenceStatus(profile) |
136 self.newContact(contact[0], contact[1], contact[2], profile) | 139 for contact in presences: |
137 | 140 for res in presences[contact]: |
138 presences = self.bridge.getPresenceStatus(profile) | 141 jabber_id = contact+('/'+res if res else '') |
139 for contact in presences: | 142 show = presences[contact][res][0] |
140 for res in presences[contact]: | 143 priority = presences[contact][res][1] |
141 jabber_id = contact+('/'+res if res else '') | 144 statuses = presences[contact][res][2] |
142 show = presences[contact][res][0] | 145 self.presenceUpdate(jabber_id, show, priority, statuses, profile) |
143 priority = presences[contact][res][1] | 146 |
144 statuses = presences[contact][res][2] | 147 #The waiting subscription requests |
145 self.presenceUpdate(jabber_id, show, priority, statuses, profile) | 148 waitingSub = self.bridge.getWaitingSub(profile) |
146 | 149 for sub in waitingSub: |
147 #The waiting subscription requests | 150 self.subscribe(waitingSub[sub], sub, profile) |
148 waitingSub = self.bridge.getWaitingSub(profile) | 151 |
149 for sub in waitingSub: | 152 #Now we open the MUC window where we already are: |
150 self.subscribe(waitingSub[sub], sub, profile) | 153 for room_args in self.bridge.getRoomJoined(profile): |
151 | 154 self.roomJoined(*room_args, profile=profile) |
152 #Now we open the MUC window where we already are: | 155 |
153 for room_args in self.bridge.getRoomJoined(profile): | 156 for subject_args in self.bridge.getRoomSubjects(profile): |
154 self.roomJoined(*room_args, profile=profile) | 157 self.roomNewSubject(*subject_args, profile=profile) |
155 | 158 |
156 for subject_args in self.bridge.getRoomSubjects(profile): | 159 if autoconnect and not self.bridge.isConnected(profile_key): |
157 self.roomNewSubject(*subject_args, profile=profile) | 160 #Does the user want autoconnection ? |
161 self.bridge.connect(profile_key) | |
162 | |
158 | 163 |
159 def unplug_profile(self, profile): | 164 def unplug_profile(self, profile): |
160 """Tell the application to not follow anymore the profile""" | 165 """Tell the application to not follow anymore the profile""" |
161 if not profile in self.profiles: | 166 if not profile in self.profiles: |
162 warning (_("This profile is not plugged")) | 167 warning (_("This profile is not plugged")) |
418 def askConfirmation(self, type, id, data): | 423 def askConfirmation(self, type, id, data): |
419 raise NotImplementedError | 424 raise NotImplementedError |
420 | 425 |
421 def actionResult(self, type, id, data): | 426 def actionResult(self, type, id, data): |
422 raise NotImplementedError | 427 raise NotImplementedError |
428 | |
429 def onExit(self): | |
430 """Must be called when the frontend is terminating""" | |
431 #TODO: mange multi-profile here | |
432 autodisconnect = self.bridge.getParamA("autodisconnect","Connection", self.profile) == "true" | |
433 if autodisconnect and self.bridge.isConnected(self.profile): | |
434 #Does the user want autodisconnection ? | |
435 self.bridge.disconnect(self.profile) |