plugin XEP-0055, Primitivus: Directory search dialogs are now entirely done in plugin XEP-0055, specific code in frontend is not needed anymore

This commit is contained in:
Goffi 2014-02-04 18:03:53 +01:00
commit 8ee9e2529e

View file

@ -295,7 +295,6 @@ class PrimitivusApp(QuickApp, InputHistory):
communication = _("Communication")
menu.addMenu(communication, _("Join room"), self.onJoinRoomRequest, 'meta j')
menu.addMenu(communication, _("Find Gateways"), self.onFindGatewaysRequest, 'meta g')
menu.addMenu(communication, _("Search directory"), self.onSearchDirectory)
#additionals menus
#FIXME: do this in a more generic way (in quickapp)
add_menus = self.bridge.getMenus('', Const.NO_SECURITY_LIMIT)
@ -595,24 +594,6 @@ class PrimitivusApp(QuickApp, InputHistory):
self.current_action_ids.add(id)
self.current_action_ids_cb[id] = self.onGatewaysFound
def onSearchDirectory(self, e):
debug(_("Search directory request"))
def requestSearchUi(button, edit):
self.removePopUp()
search_jid = edit.get_edit_text()
if search_jid:
def success(xml):
self.addWindow(XMLUI(self,xml_data=xml, misc={'callback': self._onSearchRequest, 'callback_args': [search_jid,]}))
def failure(error):
self.showPopUp(sat_widgets.Alert(_("Error"), _("Can't get search UI"), ok_cb=self.removePopUp))
self.bridge.getSearchUI(search_jid, self.profile, callback=success, errback=failure)
# TODO: replace users.jabberfr.org by any XEP-0055 compatible service discovered on current server
pop_up_widget = sat_widgets.InputDialog(_("Search directory"), _("Please enter the search jid: "), default_txt="users.jabberfr.org", cancel_cb=lambda ignore: self.removePopUp(), ok_cb=requestSearchUi)
self.showPopUp(pop_up_widget)
def onAddContactRequest(self, menu):
pop_up_widget = sat_widgets.InputDialog(_("Adding a contact"), _("Please enter new contact JID"), default_txt = 'name@server.tld', cancel_cb=self.removePopUp, ok_cb=self.onAddContact)
self.showPopUp(pop_up_widget)
@ -637,14 +618,6 @@ class PrimitivusApp(QuickApp, InputHistory):
gatewayManager = GatewaysManager(self, data, server=target)
self.addWindow(gatewayManager)
def _onSearchRequest(self, data, search_jid):
def success(xml):
ui = XMLUI(self, title=_(u"Search result"), xml_data = xml)
ui.show('window')
def failure(error):
self.showPopUp(sat_widgets.Alert(_("Error"), _("Can't get search UI"), ok_cb=self.removePopUp))
self.bridge.searchRequest(search_jid, dict(data), self.profile, callback=success, errback=failure)
def chatStateReceived(self, from_jid_s, state, profile):
"""Signal observer to display a contact chat state
@param from_jid_s: contact who sent his new state