comparison libervia.py @ 279:2d6bd975a72d

browser_side: set your own presence status and display those of others
author souliane <souliane@mailoo.org>
date Sat, 23 Nov 2013 14:46:03 +0100
parents aebb96bfa8d1
children 1ccdc34cfb60
comparison
equal deleted inserted replaced
278:4517978a2e7e 279:2d6bd975a72d
159 self.whoami = None 159 self.whoami = None
160 self._selected_listeners = set() 160 self._selected_listeners = set()
161 self.bridge = BridgeCall() 161 self.bridge = BridgeCall()
162 self.bridge_signals = BridgeSignals(self) 162 self.bridge_signals = BridgeSignals(self)
163 self.uni_box = None 163 self.uni_box = None
164 self.status_panel = panels.StatusPanel(self) 164 self.status_panel = panels.PresenceStatusPanel(self)
165 self.contact_panel = ContactPanel(self) 165 self.contact_panel = ContactPanel(self)
166 self.panel = panels.MainPanel(self) 166 self.panel = panels.MainPanel(self)
167 self.discuss_panel = self.panel.discuss_panel 167 self.discuss_panel = self.panel.discuss_panel
168 self.tab_panel = self.panel.tab_panel 168 self.tab_panel = self.panel.tab_panel
169 self.tab_panel.addTabListener(self) 169 self.tab_panel.addTabListener(self)
575 575
576 def _presenceUpdateCb(self, entity, show, priority, statuses): 576 def _presenceUpdateCb(self, entity, show, priority, statuses):
577 _entity = JID(entity) 577 _entity = JID(entity)
578 #XXX: QnD way to get our status 578 #XXX: QnD way to get our status
579 if self.whoami and self.whoami.bare == _entity.bare and statuses: 579 if self.whoami and self.whoami.bare == _entity.bare and statuses:
580 self.status_panel.setPresence(show)
580 self.status_panel.changeStatus(statuses.values()[0]) 581 self.status_panel.changeStatus(statuses.values()[0])
581 if (not self.whoami or self.whoami.bare != _entity.bare): 582 if (not self.whoami or self.whoami.bare != _entity.bare):
582 self.contact_panel.setConnected(_entity.bare, _entity.resource, show, priority, statuses) 583 self.contact_panel.setConnected(_entity.bare, _entity.resource, show, priority, statuses)
583 584
584 def _roomJoinedCb(self, room_jid, room_nicks, user_nick): 585 def _roomJoinedCb(self, room_jid, room_nicks, user_nick):
736 if type_ in ("PUBLIC", "GROUP"): 737 if type_ in ("PUBLIC", "GROUP"):
737 self.bridge.call("sendMblog", None, type_, entities if type_ == "GROUP" else None, text, extra) 738 self.bridge.call("sendMblog", None, type_, entities if type_ == "GROUP" else None, text, extra)
738 elif type_ == "COMMENT": 739 elif type_ == "COMMENT":
739 self.bridge.call("sendMblogComment", None, entities, text, extra) 740 self.bridge.call("sendMblogComment", None, entities, text, extra)
740 elif type_ == "STATUS": 741 elif type_ == "STATUS":
741 self.bridge.call('setStatus', None, text) 742 self.bridge.call('setStatus', None, self.status_panel.presence, text)
742 elif type_ in ("groupchat", "chat"): 743 elif type_ in ("groupchat", "chat"):
743 self.bridge.call('sendMessage', None, entities, text, '', type_, extra) 744 self.bridge.call('sendMessage', None, entities, text, '', type_, extra)
744 else: 745 else:
745 print "ERROR: Unknown target type" 746 print "ERROR: Unknown target type"
746 747