comparison src/memory/sqlite.py @ 681:66633443bcd7

memory: fixed getHistory behavior when parameter between=True: - the previous behavior returns the messages between X and Y + between X and X
author souliane <souliane@mailoo.org>
date Wed, 23 Oct 2013 00:28:00 +0200
parents ffb716804580
children bfabeedbf32e
comparison
equal deleted inserted replaced
680:8281587eb528 681:66633443bcd7
227 values.append(_jid.resource) 227 values.append(_jid.resource)
228 return '(%s=? AND %s_res=?)' % (type_, type_) 228 return '(%s=? AND %s_res=?)' % (type_, type_)
229 return '%s=?' % (type_, ) 229 return '%s=?' % (type_, )
230 230
231 if between: 231 if between:
232 query_parts.append("(%s OR %s) AND (%s or %s)" % (test_jid('source', from_jid), 232 query_parts.append("((%s AND %s) OR (%s AND %s))" % (test_jid('source', from_jid),
233 test_jid('source', to_jid), 233 test_jid('dest', to_jid),
234 test_jid('dest', to_jid), 234 test_jid('source', to_jid),
235 test_jid('dest', from_jid))) 235 test_jid('dest', from_jid)))
236 else: 236 else:
237 query_parts.append("%s AND %s" % (test_jid('source', from_jid), 237 query_parts.append("%s AND %s" % (test_jid('source', from_jid),
238 test_jid('dest', to_jid))) 238 test_jid('dest', to_jid)))
239 239
240 query_parts.append("ORDER BY timestamp DESC") 240 query_parts.append("ORDER BY timestamp DESC")