Write correct show values to database
Since the refactor we wrote accidentally string instead of int
This commit is contained in:
parent
5e97d805d9
commit
b704e27abc
|
@ -56,6 +56,7 @@ from gajim.common import configpaths
|
||||||
from gajim.common.i18n import Q_
|
from gajim.common.i18n import Q_
|
||||||
from gajim.common.i18n import _
|
from gajim.common.i18n import _
|
||||||
from gajim.common.i18n import ngettext
|
from gajim.common.i18n import ngettext
|
||||||
|
from gajim.common.const import ShowConstant
|
||||||
|
|
||||||
log = logging.getLogger('gajim.c.helpers')
|
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
|
If use_mnemonic is True, it adds _ so GUI should call with True for
|
||||||
accessibility issues
|
accessibility issues
|
||||||
"""
|
"""
|
||||||
|
if isinstance(show, ShowConstant):
|
||||||
|
show = show.name.lower()
|
||||||
|
|
||||||
if show == 'dnd':
|
if show == 'dnd':
|
||||||
if use_mnemonic:
|
if use_mnemonic:
|
||||||
uf_show = _('_Busy')
|
uf_show = _('_Busy')
|
||||||
|
|
|
@ -25,6 +25,7 @@ from gajim.common import app
|
||||||
from gajim.common.i18n import _
|
from gajim.common.i18n import _
|
||||||
from gajim.common.nec import NetworkEvent
|
from gajim.common.nec import NetworkEvent
|
||||||
from gajim.common.const import KindConstant
|
from gajim.common.const import KindConstant
|
||||||
|
from gajim.common.const import ShowConstant
|
||||||
from gajim.common.helpers import prepare_and_validate_gpg_keyID
|
from gajim.common.helpers import prepare_and_validate_gpg_keyID
|
||||||
|
|
||||||
log = logging.getLogger('gajim.c.m.presence')
|
log = logging.getLogger('gajim.c.m.presence')
|
||||||
|
@ -236,11 +237,9 @@ class Presence:
|
||||||
if not app.config.should_log(self._account, properties.jid.getBare()):
|
if not app.config.should_log(self._account, properties.jid.getBare()):
|
||||||
return
|
return
|
||||||
|
|
||||||
# TODO: Refactor
|
show = ShowConstant[properties.show.name]
|
||||||
if properties.type.is_unavailable:
|
if properties.type.is_unavailable:
|
||||||
show = 'offline'
|
show = ShowConstant.OFFLINE
|
||||||
else:
|
|
||||||
show = properties.show.value
|
|
||||||
|
|
||||||
app.logger.insert_into_logs(self._account,
|
app.logger.insert_into_logs(self._account,
|
||||||
properties.jid.getBare(),
|
properties.jid.getBare(),
|
||||||
|
|
|
@ -50,6 +50,7 @@ from gajim.common.i18n import _
|
||||||
from gajim.common.const import StyleAttr
|
from gajim.common.const import StyleAttr
|
||||||
from gajim.common.const import JIDConstant
|
from gajim.common.const import JIDConstant
|
||||||
from gajim.common.const import KindConstant
|
from gajim.common.const import KindConstant
|
||||||
|
from gajim.common.const import ShowConstant
|
||||||
|
|
||||||
def is_standalone():
|
def is_standalone():
|
||||||
# Determine if we are in standalone mode
|
# Determine if we are in standalone mode
|
||||||
|
@ -398,7 +399,8 @@ class HistoryManager:
|
||||||
message = ''
|
message = ''
|
||||||
else:
|
else:
|
||||||
message = ' : ' + message
|
message = ' : ' + message
|
||||||
message = helpers.get_uf_show(show) + message
|
|
||||||
|
message = helpers.get_uf_show(ShowConstant(show)) + message
|
||||||
|
|
||||||
message_ = '<span'
|
message_ = '<span'
|
||||||
if color:
|
if color:
|
||||||
|
|
Loading…
Reference in New Issue