comparison src/server/server.py @ 566:8a607044ecfa

server_side: adapt to the new signatures of bridge method getHistory
author souliane <souliane@mailoo.org>
date Sat, 04 Oct 2014 10:28:20 +0200
parents db1b330c1eb1
children 3eb3a2c0c011 a5019e62c3e9
comparison
equal deleted inserted replaced
565:0090285a5689 566:8a607044ecfa
351 def jsonrpc_getPresenceStatuses(self): 351 def jsonrpc_getPresenceStatuses(self):
352 """Get Presence information for connected contacts""" 352 """Get Presence information for connected contacts"""
353 profile = ISATSession(self.session).profile 353 profile = ISATSession(self.session).profile
354 return self.sat_host.bridge.getPresenceStatuses(profile) 354 return self.sat_host.bridge.getPresenceStatuses(profile)
355 355
356 def jsonrpc_getHistory(self, from_jid, to_jid, size, between): 356 def jsonrpc_getHistory(self, from_jid, to_jid, size, between, search=''):
357 """Return history for the from_jid/to_jid couple""" 357 """Return history for the from_jid/to_jid couple"""
358 sat_session = ISATSession(self.session) 358 sat_session = ISATSession(self.session)
359 profile = sat_session.profile 359 profile = sat_session.profile
360 sat_jid = sat_session.jid 360 sat_jid = sat_session.jid
361 if not sat_jid: 361 if not sat_jid:
362 log.error("No jid saved for this profile") 362 log.error("No jid saved for this profile")
363 return {} 363 return {}
364 if JID(from_jid).userhost() != sat_jid.userhost() and JID(to_jid).userhost() != sat_jid.userhost(): 364 if JID(from_jid).userhost() != sat_jid.userhost() and JID(to_jid).userhost() != sat_jid.userhost():
365 log.error("Trying to get history from a different jid, maybe a hack attempt ?") 365 log.error("Trying to get history from a different jid, maybe a hack attempt ?")
366 return {} 366 return {}
367 d = self.asyncBridgeCall("getHistory", from_jid, to_jid, size, between, profile) 367 d = self.asyncBridgeCall("getHistory", from_jid, to_jid, size, between, search, profile)
368 368
369 def show(result_dbus): 369 def show(result_dbus):
370 result = [] 370 result = []
371 for line in result_dbus: 371 for line in result_dbus:
372 #XXX: we have to do this stupid thing because Python D-Bus use its own types instead of standard types 372 #XXX: we have to do this stupid thing because Python D-Bus use its own types instead of standard types