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
This commit is contained in:
Goffi 2010-08-18 15:57:26 +08:00
commit 007f12d2ae

View file

@ -119,42 +119,47 @@ class QuickApp():
###now we get the essential params###
self.profiles[profile]['whoami']=JID(self.bridge.getParamA("JabberID","Connection", profile))
autoconnect = self.bridge.getParamA("autoconnect","Connection", profile) == "true"
self.profiles[profile]['watched']=self.bridge.getParamA("Watched", "Misc", profile).split() #TODO: put this in a plugin
## misc ##
self.profiles[profile]['onlineContact'] = set() #FIXME: temporary
#TODO: gof: managed multi-profiles here
if self.bridge.isConnected(profile):
self.setStatusOnline(True)
else:
#TODO: gof: manage multi-profiles here
if not self.bridge.isConnected(profile):
self.setStatusOnline(False)
return
else:
self.setStatusOnline(True)
### now we fill the contact list ###
for contact in self.bridge.getContacts(profile):
self.newContact(contact[0], contact[1], contact[2], profile)
### now we fill the contact list ###
for contact in self.bridge.getContacts(profile):
self.newContact(contact[0], contact[1], contact[2], profile)
presences = self.bridge.getPresenceStatus(profile)
for contact in presences:
for res in presences[contact]:
jabber_id = contact+('/'+res if res else '')
show = presences[contact][res][0]
priority = presences[contact][res][1]
statuses = presences[contact][res][2]
self.presenceUpdate(jabber_id, show, priority, statuses, profile)
presences = self.bridge.getPresenceStatus(profile)
for contact in presences:
for res in presences[contact]:
jabber_id = contact+('/'+res if res else '')
show = presences[contact][res][0]
priority = presences[contact][res][1]
statuses = presences[contact][res][2]
self.presenceUpdate(jabber_id, show, priority, statuses, profile)
#The waiting subscription requests
waitingSub = self.bridge.getWaitingSub(profile)
for sub in waitingSub:
self.subscribe(waitingSub[sub], sub, profile)
#The waiting subscription requests
waitingSub = self.bridge.getWaitingSub(profile)
for sub in waitingSub:
self.subscribe(waitingSub[sub], sub, profile)
#Now we open the MUC window where we already are:
for room_args in self.bridge.getRoomJoined(profile):
self.roomJoined(*room_args, profile=profile)
#Now we open the MUC window where we already are:
for room_args in self.bridge.getRoomJoined(profile):
self.roomJoined(*room_args, profile=profile)
for subject_args in self.bridge.getRoomSubjects(profile):
self.roomNewSubject(*subject_args, profile=profile)
for subject_args in self.bridge.getRoomSubjects(profile):
self.roomNewSubject(*subject_args, profile=profile)
if autoconnect and not self.bridge.isConnected(profile_key):
#Does the user want autoconnection ?
self.bridge.connect(profile_key)
def unplug_profile(self, profile):
"""Tell the application to not follow anymore the profile"""
@ -420,3 +425,11 @@ class QuickApp():
def actionResult(self, type, id, data):
raise NotImplementedError
def onExit(self):
"""Must be called when the frontend is terminating"""
#TODO: mange multi-profile here
autodisconnect = self.bridge.getParamA("autodisconnect","Connection", self.profile) == "true"
if autodisconnect and self.bridge.isConnected(self.profile):
#Does the user want autodisconnection ?
self.bridge.disconnect(self.profile)