comparison src/browser/libervia_main.py @ 711:052d1d19016d

browser_side: remove methods that were used before the merge, when Libervia was not based on quick_frontend
author souliane <souliane@mailoo.org>
date Mon, 13 Jul 2015 13:33:01 +0200
parents 531eacb82e9f
children 03e9fe91081c
comparison
equal deleted inserted replaced
710:df8cb7bedfbf 711:052d1d19016d
457 457
458 """ 458 """
459 if data is None: 459 if data is None:
460 data = {} 460 data = {}
461 self.bridge.launchAction(callback_id, data, profile=profile, callback=self._actionCb, errback=self._actionEb) 461 self.bridge.launchAction(callback_id, data, profile=profile, callback=self._actionCb, errback=self._actionEb)
462
463 def _getContactsCB(self, contacts_data):
464 for contact_ in contacts_data:
465 jid, attributes, groups = contact_
466 self._newContactCb(jid, attributes, groups)
467
468 def _getParamsUICB(self, xml_ui):
469 """Hide the parameters item if there's nothing to display"""
470 if not xml_ui:
471 self.panel.menu.removeItemParams()
472 462
473 def _ownBlogsFills(self, mblogs, mblog_panel=None): 463 def _ownBlogsFills(self, mblogs, mblog_panel=None):
474 """Put our own microblogs in cache, then fill the panels with them. 464 """Put our own microblogs in cache, then fill the panels with them.
475 465
476 @param mblogs (dict): dictionary mapping a publisher JID to blogs data. 466 @param mblogs (dict): dictionary mapping a publisher JID to blogs data.
582 for cache_entry in mblogs: 572 for cache_entry in mblogs:
583 _groups, mblog_entry = cache_entry 573 _groups, mblog_entry = cache_entry
584 mblog_panel.addEntryIfAccepted(self.whoami.bare, *cache_entry) 574 mblog_panel.addEntryIfAccepted(self.whoami.bare, *cache_entry)
585 575
586 def getEntityMBlog(self, entity): 576 def getEntityMBlog(self, entity):
577 # FIXME: call this after a contact has been added to roster
587 log.info(u"geting mblog for entity [%s]" % (entity,)) 578 log.info(u"geting mblog for entity [%s]" % (entity,))
588 for lib_wid in self.libervia_widgets: 579 for lib_wid in self.libervia_widgets:
589 if isinstance(lib_wid, blog.MicroblogPanel): 580 if isinstance(lib_wid, blog.MicroblogPanel):
590 if lib_wid.isJidAccepted(entity): 581 if lib_wid.isJidAccepted(entity):
591 self.bridge.call('getMassiveMblogs', lib_wid.massiveInsert, 'JID', [unicode(entity)]) 582 self.bridge.call('getMassiveMblogs', lib_wid.massiveInsert, 'JID', [unicode(entity)])
637 wid = self.widgets.getOrCreateWidget(class_, target, *args, **kwargs) 628 wid = self.widgets.getOrCreateWidget(class_, target, *args, **kwargs)
638 self.addWidget(wid) 629 self.addWidget(wid)
639 self.setSelected(wid) 630 self.setSelected(wid)
640 return wid 631 return wid
641 632
642 def _getPresenceStatusesCb(self, presence_data):
643 for entity in presence_data:
644 for resource in presence_data[entity]:
645 args = presence_data[entity][resource]
646 full = ('%s/%s' % (jid.JID(entity).bare, resource)) if resource else entity
647 self._presenceUpdateCb(full, *args)
648
649 def _getRoomsJoinedCb(self, room_data):
650 for room in room_data:
651 self._roomJoinedCb(*room)
652
653 def _getWaitingSubCb(self, waiting_sub):
654 for sub in waiting_sub:
655 self._subscribeCb(waiting_sub[sub], sub)
656
657 def _subscribeCb(self, sub_type, entity):
658 if sub_type == 'subscribed':
659 dialog.InfoDialog('Subscription confirmation', 'The contact <b>%s</b> has added you to his/her contact list' % html_tools.html_sanitize(entity)).show()
660 self.getEntityMBlog(entity)
661
662 elif sub_type == 'unsubscribed':
663 dialog.InfoDialog('Subscription refusal', 'The contact <b>%s</b> has refused to add you in his/her contact list' % html_tools.html_sanitize(entity)).show()
664 #TODO: remove microblogs from panels
665
666 elif sub_type == 'subscribe':
667 #The user want to subscribe to our presence
668 _dialog = None
669 msg = HTML('The contact <b>%s</b> want to add you in his/her contact list, do you accept ?' % html_tools.html_sanitize(entity))
670
671 def ok_cb(ignore):
672 self.bridge.call('subscription', None, "subscribed", entity)
673 self.bridge.updateContact(entity, '', _dialog.getSelectedGroups())
674
675 def cancel_cb(ignore):
676 self.bridge.call('subscription', None, "unsubscribed", entity, '', '')
677
678 _dialog = dialog.GroupSelector([msg], self.contact_panel.getGroups(), [], "Add", ok_cb, cancel_cb)
679 _dialog.setHTML('<b>Add contact request</b>')
680 _dialog.show()
681
682 def _contactDeletedCb(self, entity):
683 self.contact_panel.removeContactBox(entity)
684
685 def _newContactCb(self, contact_jid, attributes, groups):
686 self.contact_panel.updateContact(contact_jid, attributes, groups)
687
688 def askConfirmationHandler(self, confirmation_id, confirmation_type, data): 633 def askConfirmationHandler(self, confirmation_id, confirmation_type, data):
689 answer_data = {} 634 answer_data = {}
690 635
691 def confirm_cb(result): 636 def confirm_cb(result):
692 self.bridge.call('confirmationAnswer', None, confirmation_id, result, answer_data) 637 self.bridge.call('confirmationAnswer', None, confirmation_id, result, answer_data)