From 6005b005839bb180b675e2542b827193197cd594 Mon Sep 17 00:00:00 2001 From: Goffi Date: Thu, 29 Sep 2011 12:13:22 +0200 Subject: [PATCH] frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix --- frontends/src/bridge/DBus.py | 16 ++++----- frontends/src/jp/jp | 4 +-- frontends/src/primitivus/chat.py | 2 +- frontends/src/wix/chat.py | 2 +- src/bridge/DBus.py | 36 +++++++++---------- .../dbus_frontend_template.py | 4 +-- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/frontends/src/bridge/DBus.py b/frontends/src/bridge/DBus.py index 290cd39f..15aaee0a 100644 --- a/frontends/src/bridge/DBus.py +++ b/frontends/src/bridge/DBus.py @@ -56,8 +56,8 @@ class DBusBridgeFrontend(BridgeFrontend): else: error(_('Unknown interface')) - def addContact(self, entity, profile_key="@DEFAULT@"): - return self.db_core_iface.addContact(entity, profile_key) + def addContact(self, entity_jid, profile_key="@DEFAULT@"): + return self.db_core_iface.addContact(entity_jid, profile_key) def asyncConnect(self, profile_key="@DEFAULT@", callback=None, errback=None): return self.db_core_iface.asyncConnect(profile_key, reply_handler=callback, error_handler=errback) @@ -74,8 +74,8 @@ class DBusBridgeFrontend(BridgeFrontend): def createProfile(self, profile): return self.db_core_iface.createProfile(profile) - def delContact(self, entity, profile_key="@DEFAULT@"): - return self.db_core_iface.delContact(entity, profile_key) + def delContact(self, entity_jid, profile_key="@DEFAULT@"): + return self.db_core_iface.delContact(entity_jid, profile_key) def deleteProfile(self, profile): return self.db_core_iface.deleteProfile(profile) @@ -152,8 +152,8 @@ class DBusBridgeFrontend(BridgeFrontend): def subscription(self, sub_type, entity, profile_key="@DEFAULT@"): return self.db_core_iface.subscription(sub_type, entity, profile_key) - def updateContact(self, entity, name, groups, profile_key="@DEFAULT@"): - return self.db_core_iface.updateContact(entity, name, groups, profile_key) + def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@"): + return self.db_core_iface.updateContact(entity_jid, name, groups, profile_key) #methods from plugins @@ -193,8 +193,8 @@ class DBusBridgeFrontend(BridgeFrontend): def quizGameAnswer(self, player, referee, answer, profile_key='@DEFAULT@'): return self.db_plugin_iface.quizGameAnswer(player, referee, answer, profile_key) - def sendFile(self, to, path, profile_key='@DEFAULT@'): - return self.db_plugin_iface.sendFile(to, path, profile_key) + def sendFile(self, to, path, data, profile_key='@DEFAULT@'): + return self.db_plugin_iface.sendFile(to, path, data, profile_key) def findGateways(self, target, profile_key='@DEFAULT@'): return self.db_plugin_iface.findGateways(target, profile_key) diff --git a/frontends/src/jp/jp b/frontends/src/jp/jp index 45996eb6..7338a46c 100755 --- a/frontends/src/jp/jp +++ b/frontends/src/jp/jp @@ -187,11 +187,11 @@ class JP(): bz2.close() info(_("OK !")) path = abspath(tmpfile) - self.transfert_id = self.bridge.sendFile(self.dest_jid, path, profile_key=self.profile) + self.transfert_id = self.bridge.sendFile(self.dest_jid, path, {}, profile_key=self.profile) else: for file in self.files: path = abspath(file) - self.transfert_id = self.bridge.sendFile(self.dest_jid, path, profile_key=self.profile) #FIXME: show progress only for last transfert_id + self.transfert_id = self.bridge.sendFile(self.dest_jid, path, {}, profile_key=self.profile) #FIXME: show progress only for last transfert_id #TODO: manage ProgressBar diff --git a/frontends/src/primitivus/chat.py b/frontends/src/primitivus/chat.py index 2e06a94b..fb794a9e 100644 --- a/frontends/src/primitivus/chat.py +++ b/frontends/src/primitivus/chat.py @@ -283,5 +283,5 @@ class Chat(urwid.WidgetWrap, QuickChat): def onFileSelected(self, filepath): self.host.removePopUp() full_jid = self.host.CM.get_full(self.target) - id = self.host.bridge.sendFile(full_jid, filepath) + id = self.host.bridge.sendFile(full_jid, filepath, {}, self.host.profile) self.host.addProgress(id,filepath) diff --git a/frontends/src/wix/chat.py b/frontends/src/wix/chat.py index eebc4a72..4d6a205d 100644 --- a/frontends/src/wix/chat.py +++ b/frontends/src/wix/chat.py @@ -260,7 +260,7 @@ class Chat(wx.Frame, QuickChat): if filename: debug(_("filename: %s"),filename) full_jid = self.host.CM.get_full(self.target) - id = self.host.bridge.sendFile(full_jid, filename) + id = self.host.bridge.sendFile(full_jid, filename, {}, self.host.profile) self.host.waitProgress(id, _("File Transfer"), _("Copying %s") % os.path.basename(filename)) def onStartTarot(self, e): diff --git a/src/bridge/DBus.py b/src/bridge/DBus.py index 1021aeea..5bffd61f 100755 --- a/src/bridge/DBus.py +++ b/src/bridge/DBus.py @@ -78,7 +78,7 @@ class DbusObject(dbus.service.Object): @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='ss') - def contactDeleted(self, entity, profile): + def contactDeleted(self, entity_jid, profile): pass @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, @@ -93,7 +93,7 @@ class DbusObject(dbus.service.Object): @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='sa{ss}ass') - def newContact(self, contact, attributes, groups, profile): + def newContact(self, contact_jid, attributes, groups, profile): pass @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, @@ -108,12 +108,12 @@ class DbusObject(dbus.service.Object): @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='ssia{ss}s') - def presenceUpdate(self, entity, show, priority, statuses, profile): + def presenceUpdate(self, entity_jid, show, priority, statuses, profile): pass @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='sss') - def subscribe(self, sub_type, entity, profile): + def subscribe(self, sub_type, entity_jid, profile): pass @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, @@ -127,8 +127,8 @@ class DbusObject(dbus.service.Object): @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='ss', out_signature='', async_callbacks=None) - def addContact(self, entity, profile_key="@DEFAULT@"): - return self.cb["addContact"](unicode(entity), unicode(profile_key)) + def addContact(self, entity_jid, profile_key="@DEFAULT@"): + return self.cb["addContact"](unicode(entity_jid), unicode(profile_key)) @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='s', out_signature='', @@ -163,8 +163,8 @@ class DbusObject(dbus.service.Object): @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='ss', out_signature='', async_callbacks=None) - def delContact(self, entity, profile_key="@DEFAULT@"): - return self.cb["delContact"](unicode(entity), unicode(profile_key)) + def delContact(self, entity_jid, profile_key="@DEFAULT@"): + return self.cb["delContact"](unicode(entity_jid), unicode(profile_key)) @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='s', out_signature='i', @@ -319,8 +319,8 @@ class DbusObject(dbus.service.Object): @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='ssass', out_signature='', async_callbacks=None) - def updateContact(self, entity, name, groups, profile_key="@DEFAULT@"): - return self.cb["updateContact"](unicode(entity), unicode(name), groups, unicode(profile_key)) + def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@"): + return self.cb["updateContact"](unicode(entity_jid), unicode(name), groups, unicode(profile_key)) def __attributes(self, in_sign): @@ -417,8 +417,8 @@ class DBusBridge(Bridge): def connectionError(self, error_type, profile): self.dbus_bridge.connectionError(error_type, profile) - def contactDeleted(self, entity, profile): - self.dbus_bridge.contactDeleted(entity, profile) + def contactDeleted(self, entity_jid, profile): + self.dbus_bridge.contactDeleted(entity_jid, profile) def disconnected(self, profile): self.dbus_bridge.disconnected(profile) @@ -426,8 +426,8 @@ class DBusBridge(Bridge): def newAlert(self, message, title, alert_type, profile): self.dbus_bridge.newAlert(message, title, alert_type, profile) - def newContact(self, contact, attributes, groups, profile): - self.dbus_bridge.newContact(contact, attributes, groups, profile) + def newContact(self, contact_jid, attributes, groups, profile): + self.dbus_bridge.newContact(contact_jid, attributes, groups, profile) def newMessage(self, from_jid, message, mess_type, to_jid, profile): self.dbus_bridge.newMessage(from_jid, message, mess_type, to_jid, profile) @@ -435,11 +435,11 @@ class DBusBridge(Bridge): def paramUpdate(self, name, value, category, profile): self.dbus_bridge.paramUpdate(name, value, category, profile) - def presenceUpdate(self, entity, show, priority, statuses, profile): - self.dbus_bridge.presenceUpdate(entity, show, priority, statuses, profile) + def presenceUpdate(self, entity_jid, show, priority, statuses, profile): + self.dbus_bridge.presenceUpdate(entity_jid, show, priority, statuses, profile) - def subscribe(self, sub_type, entity, profile): - self.dbus_bridge.subscribe(sub_type, entity, profile) + def subscribe(self, sub_type, entity_jid, profile): + self.dbus_bridge.subscribe(sub_type, entity_jid, profile) def updatedValue(self, name, value, profile): self.dbus_bridge.updatedValue(name, value, profile) diff --git a/src/bridge/bridge_constructor/dbus_frontend_template.py b/src/bridge/bridge_constructor/dbus_frontend_template.py index 3c2fea5e..fd12c06c 100644 --- a/src/bridge/bridge_constructor/dbus_frontend_template.py +++ b/src/bridge/bridge_constructor/dbus_frontend_template.py @@ -95,8 +95,8 @@ class DBusBridgeFrontend(BridgeFrontend): def quizGameAnswer(self, player, referee, answer, profile_key='@DEFAULT@'): return self.db_plugin_iface.quizGameAnswer(player, referee, answer, profile_key) - def sendFile(self, to, path, profile_key='@DEFAULT@'): - return self.db_plugin_iface.sendFile(to, path, profile_key) + def sendFile(self, to, path, data, profile_key='@DEFAULT@'): + return self.db_plugin_iface.sendFile(to, path, data, profile_key) def findGateways(self, target, profile_key='@DEFAULT@'): return self.db_plugin_iface.findGateways(target, profile_key)