# HG changeset patch # User Goffi # Date 1255900845 -7200 # Node ID a06a151fc31ff5bec8104f3d981fb0e4ad37a91d # Parent c4bc297b82f029b7b02a08e125c7a31e57fe233d Disconnect first draft diff -r c4bc297b82f0 -r a06a151fc31f frontends/sat_bridge_frontend/DBus.py --- a/frontends/sat_bridge_frontend/DBus.py Sat Aug 29 13:34:59 2009 +0200 +++ b/frontends/sat_bridge_frontend/DBus.py Sun Oct 18 23:20:45 2009 +0200 @@ -43,6 +43,9 @@ def connect(self): return self.db_comm_iface.connect() + def disconnect(self): + return self.db_comm_iface.disconnect() + def getContacts(self): return self.db_comm_iface.getContacts() diff -r c4bc297b82f0 -r a06a151fc31f frontends/wix/main_window.py --- a/frontends/wix/main_window.py Sat Aug 29 13:34:59 2009 +0200 +++ b/frontends/wix/main_window.py Sun Oct 18 23:20:45 2009 +0200 @@ -36,10 +36,11 @@ msgOFFLINE = "offline" msgONLINE = "online" idCONNECT = 1 -idEXIT = 2 -idPARAM = 3 -idADD_CONTACT = 4 -idREMOVE_CONTACT = 5 +idDISCONNECT = 2 +idEXIT = 3 +idPARAM = 4 +idADD_CONTACT = 5 +idREMOVE_CONTACT = 6 const_DEFAULT_GROUP = "Unclassed" const_STATUS = {"Online":"", "Want to discuss":"chat", @@ -190,6 +191,7 @@ info("Creating menus") connectMenu = wx.Menu() connectMenu.Append(idCONNECT, "&Connect CTRL-c"," Connect to the server") + connectMenu.Append(idDISCONNECT, "&Disconnect CTRL-d"," Disconnect from the server") connectMenu.Append(idPARAM,"&Parameters"," Configure the program") connectMenu.AppendSeparator() connectMenu.Append(idEXIT,"E&xit"," Terminate the program") @@ -203,6 +205,7 @@ #events wx.EVT_MENU(self, idCONNECT, self.onConnectRequest) + wx.EVT_MENU(self, idDISCONNECT, self.onDisconnectRequest) wx.EVT_MENU(self, idPARAM, self.onParam) wx.EVT_MENU(self, idEXIT, self.onExit) wx.EVT_MENU(self, idADD_CONTACT, self.onAddContact) @@ -316,6 +319,9 @@ def onConnectRequest(self, e): self.bridge.connect() + def onDisconnectRequest(self, e): + self.bridge.disconnect() + def __updateStatus(self): show = const_STATUS[self.statusBox.GetValue()] status = self.statusTxt.GetValue() diff -r c4bc297b82f0 -r a06a151fc31f plugins/plugin_xep_0096.py --- a/plugins/plugin_xep_0096.py Sat Aug 29 13:34:59 2009 +0200 +++ b/plugins/plugin_xep_0096.py Sun Oct 18 23:20:45 2009 +0200 @@ -25,7 +25,7 @@ from twisted.words.protocols.jabber import client, jid, xmlstream, error import os.path from twisted.internet import reactor #FIXME best way ??? - +import pdb PLUGIN_INFO = { "name": "XEP 0096 Plugin", diff -r c4bc297b82f0 -r a06a151fc31f sat --- a/sat Sat Aug 29 13:34:59 2009 +0200 +++ b/sat Sun Oct 18 23:20:45 2009 +0200 @@ -63,6 +63,7 @@ self.bridge=DBusBridge() self.bridge.register("connect", self.connect) + self.bridge.register("disconnect", self.disconnect) self.bridge.register("getContacts", self.memory.getContacts) self.bridge.register("getPresenceStatus", self.memory.getPresenceStatus) self.bridge.register("sendMessage", self.sendMessage) @@ -96,6 +97,7 @@ self.plugins[plug_info['import_name']] = getattr(mod, plug_info['main'])(self) def connect(self): + print "Connect !" if (self.connected): info("already connected !") return @@ -108,6 +110,11 @@ self.connectionStatus="online" #TODO: check if connection is OK self.connected=True #TODO: use startedConnecting and clientConnectionLost of XMPPClientFactory + def disconnect(self): + if (not self.connected): + info("not connected !") + return + info("Disconnecting...") def run(self): debug("running app") diff -r c4bc297b82f0 -r a06a151fc31f sat_bridge/DBus.py --- a/sat_bridge/DBus.py Sat Aug 29 13:34:59 2009 +0200 +++ b/sat_bridge/DBus.py Sun Oct 18 23:20:45 2009 +0200 @@ -80,6 +80,12 @@ return self.cb["connect"]() @dbus.service.method("org.goffi.SAT.communication", + in_signature='', out_signature='') + def disconnect(self): + info ("Disconnection asked") + return self.cb["disconnect"]() + + @dbus.service.method("org.goffi.SAT.communication", in_signature='', out_signature='a(sa{ss}as)') def getContacts(self): debug("getContacts...")