memory: add Parameter "Chat history limit"
This commit is contained in:
parent
4c61bf8fad
commit
4f339272b7
1 changed files with 50 additions and 18 deletions
|
|
@ -22,7 +22,7 @@ from sat.core.log import getLogger
|
|||
log = getLogger(__name__)
|
||||
from sat_frontends.tools.jid import JID
|
||||
from sat_frontends.quick_frontend.quick_utils import unescapePrivate
|
||||
from sat_frontends.quick_frontend.constants import Const
|
||||
from sat_frontends.quick_frontend.constants import Const as C
|
||||
|
||||
|
||||
class QuickChat(object):
|
||||
|
|
@ -100,7 +100,7 @@ class QuickChat(object):
|
|||
"""Refresh or scroll down the focus after the history is printed"""
|
||||
pass
|
||||
|
||||
def historyPrint(self, size=20, profile='@NONE@'):
|
||||
def historyPrint(self, size=C.HISTORY_LIMIT_DEFAULT, profile='@NONE@'):
|
||||
"""Print the current history
|
||||
@param size (int): number of messages
|
||||
@param profile (str): %(doc_profile)s
|
||||
|
|
@ -119,7 +119,7 @@ class QuickChat(object):
|
|||
def onHistoryError(err):
|
||||
log.error(_("Can't get history"))
|
||||
|
||||
if self.target.startswith(Const.PRIVATE_PREFIX):
|
||||
if self.target.startswith(C.PRIVATE_PREFIX):
|
||||
target = unescapePrivate(self.target)
|
||||
else:
|
||||
target = self.target.bare
|
||||
|
|
@ -128,9 +128,9 @@ class QuickChat(object):
|
|||
|
||||
def _get_nick(self, jid):
|
||||
"""Return nick of this jid when possible"""
|
||||
if self.target.startswith(Const.PRIVATE_PREFIX):
|
||||
if self.target.startswith(C.PRIVATE_PREFIX):
|
||||
unescaped = unescapePrivate(self.target)
|
||||
if jid.startswith(Const.PRIVATE_PREFIX) or unescaped.bare == jid.bare:
|
||||
if jid.startswith(C.PRIVATE_PREFIX) or unescaped.bare == jid.bare:
|
||||
return unescaped.resource
|
||||
return jid.resource if self.type == "group" else (self.host.contact_list.getCache(jid,'nick') or self.host.contact_list.getCache(jid,'name') or jid.node)
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ class QuickChat(object):
|
|||
def updateChatState(self, state, nick=None):
|
||||
"""Set the chat state (XEP-0085) of the contact. Leave nick to None
|
||||
to set the state for a one2one conversation, or give a nickname or
|
||||
Const.ALL_OCCUPANTS to set the state of a participant within a MUC.
|
||||
C.ALL_OCCUPANTS to set the state of a participant within a MUC.
|
||||
@param state: the new chat state
|
||||
@param nick: None for one2one, the MUC user nick or ALL_OCCUPANTS
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue