Commit b704e27a authored by Philipp Hörist's avatar Philipp Hörist

Write correct show values to database

Since the refactor we wrote accidentally string instead of int
parent 5e97d805
......@@ -56,6 +56,7 @@ from gajim.common import configpaths
from gajim.common.i18n import Q_
from gajim.common.i18n import _
from gajim.common.i18n import ngettext
from gajim.common.const import ShowConstant
log = logging.getLogger('gajim.c.helpers')
......@@ -246,6 +247,9 @@ def get_uf_show(show, use_mnemonic=False):
If use_mnemonic is True, it adds _ so GUI should call with True for
accessibility issues
"""
if isinstance(show, ShowConstant):
show = show.name.lower()
if show == 'dnd':
if use_mnemonic:
uf_show = _('_Busy')
......
......@@ -25,6 +25,7 @@ from gajim.common import app
from gajim.common.i18n import _
from gajim.common.nec import NetworkEvent
from gajim.common.const import KindConstant
from gajim.common.const import ShowConstant
from gajim.common.helpers import prepare_and_validate_gpg_keyID
log = logging.getLogger('gajim.c.m.presence')
......@@ -236,11 +237,9 @@ class Presence:
if not app.config.should_log(self._account, properties.jid.getBare()):
return
# TODO: Refactor
show = ShowConstant[properties.show.name]
if properties.type.is_unavailable:
show = 'offline'
else:
show = properties.show.value
show = ShowConstant.OFFLINE
app.logger.insert_into_logs(self._account,
properties.jid.getBare(),
......
......@@ -50,6 +50,7 @@ from gajim.common.i18n import _
from gajim.common.const import StyleAttr
from gajim.common.const import JIDConstant
from gajim.common.const import KindConstant
from gajim.common.const import ShowConstant
def is_standalone():
# Determine if we are in standalone mode
......@@ -398,7 +399,8 @@ class HistoryManager:
message = ''
else:
message = ' : ' + message
message = helpers.get_uf_show(show) + message
message = helpers.get_uf_show(ShowConstant(show)) + message
message_ = '<span'
if color:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment