new plugin: gateways plugin, and first implementation of findGateways

- test menu in Wix
- new actionResultExt method, for sending dictionary of dictionaries
- new getNextId method, for accessing sat ids from plugins.
This commit is contained in:
Goffi 2009-12-04 08:47:44 +01:00
commit 77cd653fa6
3 changed files with 128 additions and 3 deletions

View file

@ -41,6 +41,7 @@ class QuickApp():
self.bridge.register("contactDeleted", self.contactDeleted)
self.bridge.register("askConfirmation", self.askConfirmation, "request")
self.bridge.register("actionResult", self.actionResult, "request")
self.bridge.register("actionResultExt", self.actionResult, "request")
###now we get the essential params###
self.whoami=JID(self.bridge.getParamA("JabberID","Connection"))

View file

@ -58,6 +58,9 @@ class DBusBridgeFrontend(BridgeFrontend):
def sendFile(self, to, path):
return self.db_comm_iface.sendFile(to, path)
def findGateways(self, target):
return self.db_comm_iface.findGateways(target)
def setPresence(self, to="", type="", show="", status="", priority=0):
return self.db_comm_iface.setPresence(to, type, show, status, priority)

View file

@ -41,6 +41,7 @@ idEXIT = 3
idPARAM = 4
idADD_CONTACT = 5
idREMOVE_CONTACT = 6
idFIND_GATEWAYS = 7
const_DEFAULT_GROUP = "Unclassed"
const_STATUS = {"Online":"",
"Want to discuss":"chat",
@ -205,9 +206,12 @@ class MainWindow(wx.Frame, QuickApp):
contactMenu = wx.Menu()
contactMenu.Append(idADD_CONTACT, "&Add contact"," Add a contact to your list")
contactMenu.Append(idREMOVE_CONTACT, "&Remove contact"," Remove the selected contact from your list")
communicationMenu = wx.Menu()
communicationMenu.Append(idFIND_GATEWAYS, "&Find Gateways"," Find gateways to legacy IM")
menuBar = wx.MenuBar()
menuBar.Append(connectMenu,"&General")
menuBar.Append(contactMenu,"&Contacts")
menuBar.Append(communicationMenu,"&Communication")
self.SetMenuBar(menuBar)
#events
@ -217,6 +221,7 @@ class MainWindow(wx.Frame, QuickApp):
wx.EVT_MENU(self, idEXIT, self.onExit)
wx.EVT_MENU(self, idADD_CONTACT, self.onAddContact)
wx.EVT_MENU(self, idREMOVE_CONTACT, self.onRemoveContact)
wx.EVT_MENU(self, idFIND_GATEWAYS, self.onFindGateways)
def newMessage(self, from_jid, msg, type, to_jid):
@ -302,7 +307,7 @@ class MainWindow(wx.Frame, QuickApp):
dlg.Destroy()
def actionResult(self, type, id, data):
debug ("actionResult: type = [%s] id = [%s] data =[%s]" % (type, id, data))
debug ("actionResult: type = [%s] id = [%s] data = [%s]" % (type, id, data))
if type == "SUPPRESS":
self.current_action_ids.remove(id)
elif type == "SUCCESS":
@ -321,6 +326,8 @@ class MainWindow(wx.Frame, QuickApp):
)
dlg.ShowModal()
dlg.Destroy()
elif type == "DICT_DICT":
print ("Dict of dict found as result")
else:
error ("FIXME FIXME FIXME: type [%s] not implemented" % type)
raise NotImplementedError
@ -421,6 +428,11 @@ class MainWindow(wx.Frame, QuickApp):
dlg.Destroy()
def onFindGateways(self, e):
debug("Find Gateways request")
id = self.bridge.findGateways(self.whoami.domain)
print "Find Gateways id=", id
def onClose(self, e):
info("Exiting...")
e.Skip()