aboutsummaryrefslogtreecommitdiff
path: root/src/utils/irc/__init__.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-06-04 17:51:55 +0100
committerGravatar jesopo2019-06-04 17:51:55 +0100
commit2470c1ec03cad2f7eeb2575dd1c5d3052c948c5e (patch)
treef9a0c11676513460d28c9a3ce420de4790cf798b /src/utils/irc/__init__.py
parentGive SentLine (and preproc.send events) a new event object, to track events (diff)
signature
Add new BatchType object, to match like how Capability and MessageTag do
Diffstat (limited to 'src/utils/irc/__init__.py')
-rw-r--r--src/utils/irc/__init__.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/utils/irc/__init__.py b/src/utils/irc/__init__.py
index 9577bcc1..12abc144 100644
--- a/src/utils/irc/__init__.py
+++ b/src/utils/irc/__init__.py
@@ -260,7 +260,7 @@ def parse_ctcp(s: str) -> typing.Optional[CTCPMessage]:
class IRCBatch(object):
def __init__(self, identifier: str, batch_type: str, args: typing.List[str],
tags: typing.Dict[str, str]={}):
- self.id = identifier
+ self.identifier = identifier
self.type = batch_type
self.args = args
self.tags = tags
@@ -301,5 +301,12 @@ class MessageTag(object):
key = list(set([s])&self._names)
return key[0] if key else None
+class BatchType(object):
+ def __init__(self, name: typing.Optional[str], draft_name: str=None):
+ self._names = set([name, draft_name])
+ def match(self, type: str) -> typing.Optional[str]:
+ t = list(set([type])&self._names)
+ return t[0] if t else None
+
def hostmask_match(hostmask: str, pattern: str) -> bool:
return fnmatch.fnmatchcase(hostmask, pattern)