From e351c9321ccb7fd66afe38241e5e123118a338a4 Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Wed, 28 Apr 2021 20:04:59 +0200 Subject: types: Ignore unused or nonsensical types and flags As this program interacts with quassel's database only, it does not have access to any state the UI carries. Some types (such as DAYCHANGE, IGNORED, BACKLOG, GROUP) seem to not be represented in the database at all, most likely only set on data structures in memory by the quasselclient application. Some others make no real sense to include in an application like this, which is more focused on human-readable messages and circumstances. For example, INVALID, REDIRECTED, SERVERMSG, etc are all of less concern to the average user than, say, matching on nicknames or buffers. Therefore, ignore all of these until we find a good use for them. --- quarg/actions.py | 3 --- quarg/quassel/formatter.py | 2 +- quarg/quassel/types.py | 17 ++++++++--------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/quarg/actions.py b/quarg/actions.py index 9dd6c49..e1fbc57 100644 --- a/quarg/actions.py +++ b/quarg/actions.py @@ -6,9 +6,6 @@ import dateutil.relativedelta from quarg.quassel.types import BufferType, MessageFlag, MessageType from quarg.utils import errx, parse_isodate -# TODO Find out what to do about passing INVALID or GROUP as BufferType -# TODO Find out what to do about passing various message flags - # pylint: disable=too-few-public-methods, unsupported-membership-test class ParseEnum(argparse.Action, metaclass=ABCMeta): diff --git a/quarg/quassel/formatter.py b/quarg/quassel/formatter.py index 9c89970..b6235e8 100644 --- a/quarg/quassel/formatter.py +++ b/quarg/quassel/formatter.py @@ -109,7 +109,7 @@ FORMATTERS = { MessageType.SERVER: format_generic, MessageType.INFO: format_generic, MessageType.ERROR: format_generic, - MessageType.DAYCHANGE: format_generic, + # MessageType.DAYCHANGE: format_generic, MessageType.TOPIC: format_generic, MessageType.NETSPLIT_JOIN: partial(format_netsplit, True), MessageType.NETSPLIT_QUIT: partial(format_netsplit, False), diff --git a/quarg/quassel/types.py b/quarg/quassel/types.py index 36f385a..9648287 100644 --- a/quarg/quassel/types.py +++ b/quarg/quassel/types.py @@ -1,11 +1,11 @@ from enum import Enum class BufferType(Enum): - INVALID = 0x0 + # INVALID = 0x0 STATUS = 0x1 CHANNEL = 0x2 QUERY = 0x4 - GROUP = 0x8 + # GROUP = 0x8 @classmethod def describe(cls): @@ -15,11 +15,11 @@ class MessageFlag(Enum): NONE = 0x0 SELF = 0x1 HIGHLIGHT = 0x2 - REDIRECTED = 0x4 - SERVERMSG = 0x8 - STATUSMSG = 0x10 - IGNORED = 0x20 - BACKLOG = 0x80 + # REDIRECTED = 0x4 + # SERVERMSG = 0x8 + # STATUSMSG = 0x10 + # IGNORED = 0x20 + # BACKLOG = 0x80 @classmethod def describe(cls): @@ -39,8 +39,7 @@ class MessageType(Enum): SERVER = 0x400 INFO = 0x800 ERROR = 0x1000 - # as far as I can see DAYCHANGE does not show up in the database - DAYCHANGE = 0x2000 + # DAYCHANGE = 0x2000 TOPIC = 0x4000 NETSPLIT_JOIN = 0x8000 NETSPLIT_QUIT = 0x10000 -- cgit v1.2.3-2-gb3c3