Mercurial > libervia-backend
diff frontends/src/quick_frontend/quick_chat.py @ 1222:e6e0ea4dc835
memory: add Parameter "Chat history limit"
author | souliane <souliane@mailoo.org> |
---|---|
date | Wed, 24 Sep 2014 13:49:43 +0200 |
parents | 75025461141f |
children | 802b7e6bf098 |
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_chat.py Fri Oct 03 12:43:59 2014 +0200 +++ b/frontends/src/quick_frontend/quick_chat.py Wed Sep 24 13:49:43 2014 +0200 @@ -22,7 +22,7 @@ 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 @@ """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 @@ 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 @@ 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 @@ 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 """