has_capability
-> has_capability_str
, add new has_capability
This commit is contained in:
parent
3ad83655d5
commit
bdd161256d
4 changed files with 6 additions and 4 deletions
|
@ -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)
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue