bridge, bridge constructor: fixed mix stuff
This commit is contained in:
parent
e3392afc57
commit
894e276dec
7 changed files with 19 additions and 16 deletions
|
|
@ -55,7 +55,7 @@ class DBusBridgeFrontend(BridgeFrontend):
|
||||||
|
|
||||||
def callMenu(self, category, name, menu_type, profile_key):
|
def callMenu(self, category, name, menu_type, profile_key):
|
||||||
debug ("callMenu")
|
debug ("callMenu")
|
||||||
return self.db_req_iface.callMenu(category, name, menu_type, profile_key)
|
return unicode(self.db_req_iface.callMenu(category, name, menu_type, profile_key))
|
||||||
|
|
||||||
def confirmationAnswer(self, id, accepted, data):
|
def confirmationAnswer(self, id, accepted, data):
|
||||||
debug ("confirmationAnswer")
|
debug ("confirmationAnswer")
|
||||||
|
|
@ -91,7 +91,7 @@ class DBusBridgeFrontend(BridgeFrontend):
|
||||||
|
|
||||||
def getMenuHelp(self, category, name, menu_type):
|
def getMenuHelp(self, category, name, menu_type):
|
||||||
debug ("getMenuHelp")
|
debug ("getMenuHelp")
|
||||||
return self.db_req_iface.getMenuHelp(category, name, menu_type)
|
return unicode(self.db_req_iface.getMenuHelp(category, name, menu_type))
|
||||||
|
|
||||||
def getMenus(self, ):
|
def getMenus(self, ):
|
||||||
debug ("getMenus")
|
debug ("getMenus")
|
||||||
|
|
@ -99,11 +99,11 @@ class DBusBridgeFrontend(BridgeFrontend):
|
||||||
|
|
||||||
def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"):
|
def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"):
|
||||||
debug ("getParamA")
|
debug ("getParamA")
|
||||||
return self.db_comm_iface.getParamA(name, category, attribute, profile_key)
|
return unicode(self.db_comm_iface.getParamA(name, category, attribute, profile_key))
|
||||||
|
|
||||||
def getParams(self, profile_key="@DEFAULT@"):
|
def getParams(self, profile_key="@DEFAULT@"):
|
||||||
debug ("getParams")
|
debug ("getParams")
|
||||||
return self.db_comm_iface.getParams(profile_key)
|
return unicode(self.db_comm_iface.getParams(profile_key))
|
||||||
|
|
||||||
def getParamsCategories(self, ):
|
def getParamsCategories(self, ):
|
||||||
debug ("getParamsCategories")
|
debug ("getParamsCategories")
|
||||||
|
|
@ -111,11 +111,11 @@ class DBusBridgeFrontend(BridgeFrontend):
|
||||||
|
|
||||||
def getParamsForCategory(self, category, profile_key="@DEFAULT@"):
|
def getParamsForCategory(self, category, profile_key="@DEFAULT@"):
|
||||||
debug ("getParamsForCategory")
|
debug ("getParamsForCategory")
|
||||||
return self.db_comm_iface.getParamsForCategory(category, profile_key)
|
return unicode(self.db_comm_iface.getParamsForCategory(category, profile_key))
|
||||||
|
|
||||||
def getParamsUI(self, profile_key="@DEFAULT@"):
|
def getParamsUI(self, profile_key="@DEFAULT@"):
|
||||||
debug ("getParamsUI")
|
debug ("getParamsUI")
|
||||||
return self.db_comm_iface.getParamsUI(profile_key)
|
return unicode(self.db_comm_iface.getParamsUI(profile_key))
|
||||||
|
|
||||||
def getPresenceStatus(self, profile_key="@DEFAULT@"):
|
def getPresenceStatus(self, profile_key="@DEFAULT@"):
|
||||||
debug ("getPresenceStatus")
|
debug ("getPresenceStatus")
|
||||||
|
|
@ -123,7 +123,7 @@ class DBusBridgeFrontend(BridgeFrontend):
|
||||||
|
|
||||||
def getProfileName(self, profile_key="@DEFAULT@"):
|
def getProfileName(self, profile_key="@DEFAULT@"):
|
||||||
debug ("getProfileName")
|
debug ("getProfileName")
|
||||||
return self.db_req_iface.getProfileName(profile_key)
|
return unicode(self.db_req_iface.getProfileName(profile_key))
|
||||||
|
|
||||||
def getProfilesList(self, ):
|
def getProfilesList(self, ):
|
||||||
debug ("getProfilesList")
|
debug ("getProfilesList")
|
||||||
|
|
@ -135,7 +135,7 @@ class DBusBridgeFrontend(BridgeFrontend):
|
||||||
|
|
||||||
def getVersion(self, ):
|
def getVersion(self, ):
|
||||||
debug ("getVersion")
|
debug ("getVersion")
|
||||||
return self.db_req_iface.getVersion()
|
return unicode(self.db_req_iface.getVersion())
|
||||||
|
|
||||||
def getWaitingSub(self, profile_key="@DEFAULT@"):
|
def getWaitingSub(self, profile_key="@DEFAULT@"):
|
||||||
debug ("getWaitingSub")
|
debug ("getWaitingSub")
|
||||||
|
|
@ -147,11 +147,11 @@ class DBusBridgeFrontend(BridgeFrontend):
|
||||||
|
|
||||||
def launchAction(self, action_type, data, profile_key="@DEFAULT@"):
|
def launchAction(self, action_type, data, profile_key="@DEFAULT@"):
|
||||||
debug ("launchAction")
|
debug ("launchAction")
|
||||||
return self.db_req_iface.launchAction(action_type, data, profile_key)
|
return unicode(self.db_req_iface.launchAction(action_type, data, profile_key))
|
||||||
|
|
||||||
def registerNewAccount(self, login, password, host, port=5222):
|
def registerNewAccount(self, login, password, host, port=5222):
|
||||||
debug ("registerNewAccount")
|
debug ("registerNewAccount")
|
||||||
return self.db_comm_iface.registerNewAccount(login, password, host, port)
|
return unicode(self.db_comm_iface.registerNewAccount(login, password, host, port))
|
||||||
|
|
||||||
def sendMessage(self, to_jid, message, subject='', mess_type="chat", profile_key="@DEFAULT@"):
|
def sendMessage(self, to_jid, message, subject='', mess_type="chat", profile_key="@DEFAULT@"):
|
||||||
debug ("sendMessage")
|
debug ("sendMessage")
|
||||||
|
|
|
||||||
|
|
@ -330,7 +330,7 @@ class PrimitivusApp(QuickApp):
|
||||||
chat = self.chat_wins[contact]
|
chat = self.chat_wins[contact]
|
||||||
self.bridge.sendMessage(contact,
|
self.bridge.sendMessage(contact,
|
||||||
editBar.get_edit_text(),
|
editBar.get_edit_text(),
|
||||||
type = "groupchat" if chat.type == 'group' else "chat",
|
mess_type = "groupchat" if chat.type == 'group' else "chat",
|
||||||
profile_key=self.profile)
|
profile_key=self.profile)
|
||||||
editBar.set_edit_text('')
|
editBar.set_edit_text('')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ class Chat(wx.Frame, QuickChat):
|
||||||
"""Behaviour when enter pressed in send line."""
|
"""Behaviour when enter pressed in send line."""
|
||||||
self.host.bridge.sendMessage(self.target.short if self.type=='group' else self.target,
|
self.host.bridge.sendMessage(self.target.short if self.type=='group' else self.target,
|
||||||
event.GetString(),
|
event.GetString(),
|
||||||
type = "groupchat" if self.type=='group' else "chat",
|
mess_type = "groupchat" if self.type=='group' else "chat",
|
||||||
profile_key=self.host.profile)
|
profile_key=self.host.profile)
|
||||||
self.textBox.Clear()
|
self.textBox.Clear()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -407,9 +407,11 @@ class DbusConstructor(Constructor):
|
||||||
if function["type"] == "method":
|
if function["type"] == "method":
|
||||||
completion['debug'] = "" if not self.options.debug else 'debug ("%s")\n%s' % (section,8*' ')
|
completion['debug'] = "" if not self.options.debug else 'debug ("%s")\n%s' % (section,8*' ')
|
||||||
completion['args_result'] = self.getArguments(function['sig_in'], name=arg_doc)
|
completion['args_result'] = self.getArguments(function['sig_in'], name=arg_doc)
|
||||||
|
result = "self.db_%(category)s_iface.%(name)s(%(args_result)s)" % completion
|
||||||
|
completion['result'] = ("unicode(%s)" if self.options.unicode and function['sig_out'] == 's' else "%s") % result
|
||||||
methods_part.append("""\
|
methods_part.append("""\
|
||||||
def %(name)s(self, %(args)s):
|
def %(name)s(self, %(args)s):
|
||||||
%(debug)sreturn self.db_%(category)s_iface.%(name)s(%(args_result)s)
|
%(debug)sreturn %(result)s
|
||||||
""" % completion)
|
""" % completion)
|
||||||
|
|
||||||
#at this point, methods_part should be filled,
|
#at this point, methods_part should be filled,
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,7 @@ sig_out=s
|
||||||
param_0_default="@DEFAULT@"
|
param_0_default="@DEFAULT@"
|
||||||
doc=Get real profile name from profile key
|
doc=Get real profile name from profile key
|
||||||
doc_param_0=%(doc_profile_key)s
|
doc_param_0=%(doc_profile_key)s
|
||||||
|
doc_return=Real profile name, or empty string if the profile doesn't exist
|
||||||
|
|
||||||
[getProfilesList]
|
[getProfilesList]
|
||||||
type=method
|
type=method
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ class SatMessageProtocol(xmppim.MessageProtocol):
|
||||||
for e in message.elements():
|
for e in message.elements():
|
||||||
if e.name == "body":
|
if e.name == "body":
|
||||||
mess_type = message['type'] if message.hasAttribute('type') else 'normal'
|
mess_type = message['type'] if message.hasAttribute('type') else 'normal'
|
||||||
self.host.bridge.newMessage(message["from"], e.children[0], mess_type, profile=self.parent.profile)
|
self.host.bridge.newMessage(message["from"], e.children[0], mess_type, message['to'], profile=self.parent.profile)
|
||||||
self.host.memory.addToHistory(self.parent.jid, jid.JID(message["from"]), self.parent.jid, "chat", e.children[0])
|
self.host.memory.addToHistory(self.parent.jid, jid.JID(message["from"]), self.parent.jid, "chat", e.children[0])
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
@ -616,7 +616,7 @@ class SAT(service.Service):
|
||||||
self.profiles[profile].xmlstream.send(message)
|
self.profiles[profile].xmlstream.send(message)
|
||||||
self.memory.addToHistory(current_jid, current_jid, jid.JID(to), message["type"], unicode(msg))
|
self.memory.addToHistory(current_jid, current_jid, jid.JID(to), message["type"], unicode(msg))
|
||||||
if type!="groupchat":
|
if type!="groupchat":
|
||||||
self.bridge.newMessage(message['from'], unicode(msg), to=message['to'], type=type, profile=profile) #We send back the message, so all clients are aware of it
|
self.bridge.newMessage(message['from'], unicode(msg), mess_type=type, to_jid=message['to'], profile=profile) #We send back the message, so all clients are aware of it
|
||||||
|
|
||||||
|
|
||||||
def setPresence(self, to="", show="", priority = 0, statuses={}, profile_key='@DEFAULT@'):
|
def setPresence(self, to="", show="", priority = 0, statuses={}, profile_key='@DEFAULT@'):
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,7 @@ class Param():
|
||||||
profile = self.getProfileName(profile_key)
|
profile = self.getProfileName(profile_key)
|
||||||
if not profile:
|
if not profile:
|
||||||
error(_('Requesting a param for an non-existant profile'))
|
error(_('Requesting a param for an non-existant profile'))
|
||||||
return None
|
return ""
|
||||||
|
|
||||||
if attr == "value":
|
if attr == "value":
|
||||||
return self.__getParam(profile, category, name) or node[1].getAttribute(attr)
|
return self.__getParam(profile, category, name) or node[1].getAttribute(attr)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue