core (memory/memory): fix the use of empty from_jid and to_jid in history_get
This commit is contained in:
parent
39dc28fedf
commit
70f3502429
1 changed files with 21 additions and 11 deletions
|
|
@ -627,26 +627,36 @@ class Memory:
|
|||
|
||||
def _history_get(self, from_jid_s, to_jid_s, limit=C.HISTORY_LIMIT_NONE, between=True,
|
||||
filters=None, profile=C.PROF_KEY_NONE):
|
||||
d = self.history_get(jid.JID(from_jid_s), jid.JID(to_jid_s), limit, between,
|
||||
filters, profile)
|
||||
from_jid = jid.JID(from_jid_s) if from_jid_s else None
|
||||
to_jid = jid.JID(to_jid_s) if to_jid_s else None
|
||||
d = self.history_get(
|
||||
from_jid, to_jid, limit, between, filters, profile
|
||||
)
|
||||
d.addCallback(self._history_get_serialise)
|
||||
return d
|
||||
|
||||
def history_get(self, from_jid, to_jid, limit=C.HISTORY_LIMIT_NONE, between=True,
|
||||
filters=None, profile=C.PROF_KEY_NONE):
|
||||
def history_get(
|
||||
self,
|
||||
from_jid: jid.JID|None,
|
||||
to_jid: jid.JID|None,
|
||||
limit: int = C.HISTORY_LIMIT_NONE,
|
||||
between: bool = True,
|
||||
filters: dict[str, str]|None = None,
|
||||
profile: str = C.PROF_KEY_NONE
|
||||
) -> defer.Deferred[list]:
|
||||
"""Retrieve messages in history
|
||||
|
||||
@param from_jid (JID): source JID (full, or bare for catchall)
|
||||
@param to_jid (JID): dest JID (full, or bare for catchall)
|
||||
@param limit (int): maximum number of messages to get:
|
||||
@param from_jid: source JID (full, or bare for catchall)
|
||||
@param to_jid: dest JID (full, or bare for catchall)
|
||||
@param limit: maximum number of messages to get:
|
||||
- 0 for no message (returns the empty list)
|
||||
- C.HISTORY_LIMIT_NONE or None for unlimited
|
||||
- C.HISTORY_LIMIT_DEFAULT to use the HISTORY_LIMIT parameter value
|
||||
@param between (bool): confound source and dest (ignore the direction)
|
||||
@param filters (dict[unicode, unicode]): pattern to filter the history results
|
||||
@param between: confound source and dest (ignore the direction)
|
||||
@param filters: pattern to filter the history results
|
||||
(see bridge API for details)
|
||||
@param profile (str): %(doc_profile)s
|
||||
@return (D(list)): list of message data as in [message_new]
|
||||
@param profile: %(doc_profile)s
|
||||
@return: list of message data as in [message_new]
|
||||
"""
|
||||
assert profile != C.PROF_KEY_NONE
|
||||
if limit == C.HISTORY_LIMIT_DEFAULT:
|
||||
|
|
|
|||
Loading…
Reference in a new issue