comparison libervia.py @ 22:586f69e85559

browser_side: removed some useless mess + changed delay for warning message to 2s
author Goffi <goffi@goffi.org>
date Sun, 17 Apr 2011 00:38:33 +0200
parents 77c2e48efa29
children 0ce2a57b34ca
comparison
equal deleted inserted replaced
21:77c2e48efa29 22:586f69e85559
162 if _target != self._popup.target_data: 162 if _target != self._popup.target_data:
163 self._popup.hide() 163 self._popup.hide()
164 del self._popup 164 del self._popup
165 self.showWarning(_target) 165 self.showWarning(_target)
166 166
167 self._timer.schedule(1500) 167 self._timer.schedule(2000)
168 168
169 if keycode == KEY_ENTER and not self.visible: 169 if keycode == KEY_ENTER and not self.visible:
170 if _txt: 170 if _txt:
171 if _txt.startswith('@'): 171 if _txt.startswith('@'):
172 self.host.bridge.call('sendMblog', None, self.getText()) 172 self.host.bridge.call('sendMblog', None, self.getText())
173 elif self.host.selected == None: 173 elif self.host.selected == None:
174 print "changement de status pour", _txt
175 self.host.bridge.call('setStatus', None, _txt) 174 self.host.bridge.call('setStatus', None, _txt)
176 elif isinstance(self.host.selected, ChatPanel): 175 elif isinstance(self.host.selected, ChatPanel):
177 _chat = self.host.selected 176 _chat = self.host.selected
178 self.host.bridge.call('sendMessage', None, str(_chat.target), _txt, '', 'chat') 177 self.host.bridge.call('sendMessage', None, str(_chat.target), _txt, '', 'chat')
179 self.setText('') 178 self.setText('')
266 def _personalEventCb(self, sender, event_type, data, profile): 265 def _personalEventCb(self, sender, event_type, data, profile):
267 if event_type == "MICROBLOG": 266 if event_type == "MICROBLOG":
268 if not data.has_key('content'): 267 if not data.has_key('content'):
269 print ("WARNING: No content found in microblog data") 268 print ("WARNING: No content found in microblog data")
270 return 269 return
271 print dir('')
272 if data.has_key('groups'): 270 if data.has_key('groups'):
273 _groups = set(data['groups'].split() if data['groups'] else []) 271 _groups = set(data['groups'].split() if data['groups'] else [])
274 else: 272 else:
275 _groups=None 273 _groups=None
276 print "_groups=",_groups
277 for panel in self.mpanels: 274 for panel in self.mpanels:
278 if isinstance(panel,MicroblogPanel) and (panel.isJidAccepted(sender) or _groups == None or _groups.intersection(panel.accepted_groups)): 275 if isinstance(panel,MicroblogPanel) and (panel.isJidAccepted(sender) or _groups == None or _groups.intersection(panel.accepted_groups)):
279 print "sender:",sender
280 content = data['content'] 276 content = data['content']
281 author = data.get('author') 277 author = data.get('author')
282 print "timestamp: %s" % data.get('timestamp')
283 timestamp = float(data.get('timestamp',0)) #XXX: int doesn't work here 278 timestamp = float(data.get('timestamp',0)) #XXX: int doesn't work here
284 panel.addEntry(content, author, timestamp) 279 panel.addEntry(content, author, timestamp)
285 280
286 def _newMessageCb(self, from_jid, msg, msg_type, to_jid): 281 def _newMessageCb(self, from_jid, msg, msg_type, to_jid):
287 _from = JID(from_jid) 282 _from = JID(from_jid)