aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar jesopo2019-05-20 16:33:32 +0100
committerGravatar jesopo2019-05-20 16:33:32 +0100
commitbdd161256d70bcc6f5fc8b41b065c5fbce2f470d (patch)
treea2390ef5139572473157008311b0c30248fa9f01
parentParsedLine already deals with preventing newlines (diff)
signature
`has_capability` -> `has_capability_str`, add new `has_capability`
-rw-r--r--modules/line_handler/channel.py2
-rw-r--r--modules/line_handler/core.py2
-rw-r--r--modules/line_handler/message.py2
-rw-r--r--src/IRCServer.py4
4 files changed, 6 insertions, 4 deletions
diff --git a/modules/line_handler/channel.py b/modules/line_handler/channel.py
index 0f0858c6..5b877764 100644
--- a/modules/line_handler/channel.py
+++ b/modules/line_handler/channel.py
@@ -42,7 +42,7 @@ def handle_353(event):
modes.add(event["server"].prefix_symbols[nickname[0]])
nickname = nickname[1:]
- if event["server"].has_capability("userhost-in-names"):
+ if event["server"].has_capability_str("userhost-in-names"):
hostmask = utils.irc.seperate_hostmask(nickname)
nickname = hostmask.nickname
user = event["server"].get_user(hostmask.nickname)
diff --git a/modules/line_handler/core.py b/modules/line_handler/core.py
index 676b9105..88544a08 100644
--- a/modules/line_handler/core.py
+++ b/modules/line_handler/core.py
@@ -29,7 +29,7 @@ def handle_005(events, event):
isupport[key] = None
event["server"].isupport.update(isupport)
- if "NAMESX" in isupport and not event["server"].has_capability(
+ if "NAMESX" in isupport and not event["server"].has_capability_str(
"multi-prefix"):
event["server"].send("PROTOCTL NAMESX")
diff --git a/modules/line_handler/message.py b/modules/line_handler/message.py
index 38fb45fc..3e54e5b8 100644
--- a/modules/line_handler/message.py
+++ b/modules/line_handler/message.py
@@ -2,7 +2,7 @@ from src import utils
def _from_self(server, direction, prefix):
if direction == utils.Direction.Send:
- if server.has_capability("echo-message"):
+ if server.has_capability_str("echo-message"):
return None
else:
return True
diff --git a/src/IRCServer.py b/src/IRCServer.py
index 51496b7f..bd01cbfb 100644
--- a/src/IRCServer.py
+++ b/src/IRCServer.py
@@ -285,7 +285,9 @@ class Server(IRCObject.Object):
return self.send(utils.irc.protocol.capability_end())
def send_authenticate(self, text: str) -> IRCLine.SentLine:
return self.send(utils.irc.protocol.authenticate(text))
- def has_capability(self, capability: str) -> bool:
+ def has_capability(self, capability: utils.irc.Capability) -> bool:
+ return bool(capability.available(self.agreed_capabilities))
+ def has_capability_str(self, capability: str) -> bool:
return capability in self.agreed_capabilities
def waiting_for_capabilities(self) -> bool: