comparison sat_pubsub/pgsql_storage.py @ 282:7d54ff2eeaf2

actually retrieve the MAM messages
author souliane <souliane@mailoo.org>
date Thu, 15 Jan 2015 22:00:49 +0100
parents 8a71486c3e95
children 002c59dbc23f
comparison
equal deleted inserted replaced
281:30895c49ebd2 282:7d54ff2eeaf2
642 642
643 args = [self.nodeIdentifier] 643 args = [self.nodeIdentifier]
644 if authorized_groups: 644 if authorized_groups:
645 args.append(authorized_groups) 645 args.append(authorized_groups)
646 646
647 if 'filters' in ext_data: # MAM filters
648 for filter_ in ext_data['filters']:
649 if filter_.var == 'start':
650 source += " AND date>='{date}'".format(date=filter_.value)
651 if filter_.var == 'end':
652 source += " AND date<='{date}'".format(date=filter_.value)
653 if filter_.var == 'with':
654 jid_s = filter_.value
655 if '/' in jid_s:
656 source += " AND publisher='{pub}'".format(pub=filter_.value)
657 else: # assume the publisher field in DB is always a full JID
658 # XXX: need to escape the % with itself to avoid formatting error
659 source += " AND publisher LIKE '{pub}/%%'".format(pub=filter_.value)
660
647 query.append(source) 661 query.append(source)
648 order = "DESC" 662 order = "DESC"
649 663
650 if 'rsm' in ext_data: 664 if 'rsm' in ext_data:
651 rsm = ext_data['rsm'] 665 rsm = ext_data['rsm']