diff 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
line wrap: on
line diff
--- a/src/memory/sqlite.py	Tue Oct 22 16:24:11 2013 +0200
+++ b/src/memory/sqlite.py	Wed Oct 23 00:28:00 2013 +0200
@@ -229,10 +229,10 @@
             return '%s=?' % (type_, )
 
         if between:
-            query_parts.append("(%s OR %s) AND (%s or %s)" % (test_jid('source', from_jid),
-                                                              test_jid('source', to_jid),
-                                                              test_jid('dest', to_jid),
-                                                              test_jid('dest', from_jid)))
+            query_parts.append("((%s AND %s) OR (%s AND %s))" % (test_jid('source', from_jid),
+                                                             test_jid('dest', to_jid),
+                                                             test_jid('source', to_jid),
+                                                             test_jid('dest', from_jid)))
         else:
             query_parts.append("%s AND %s" % (test_jid('source', from_jid),
                                               test_jid('dest', to_jid)))