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]])
|
modes.add(event["server"].prefix_symbols[nickname[0]])
|
||||||
nickname = nickname[1:]
|
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)
|
hostmask = utils.irc.seperate_hostmask(nickname)
|
||||||
nickname = hostmask.nickname
|
nickname = hostmask.nickname
|
||||||
user = event["server"].get_user(hostmask.nickname)
|
user = event["server"].get_user(hostmask.nickname)
|
||||||
|
|
|
@ -29,7 +29,7 @@ def handle_005(events, event):
|
||||||
isupport[key] = None
|
isupport[key] = None
|
||||||
event["server"].isupport.update(isupport)
|
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"):
|
"multi-prefix"):
|
||||||
event["server"].send("PROTOCTL NAMESX")
|
event["server"].send("PROTOCTL NAMESX")
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ from src import utils
|
||||||
|
|
||||||
def _from_self(server, direction, prefix):
|
def _from_self(server, direction, prefix):
|
||||||
if direction == utils.Direction.Send:
|
if direction == utils.Direction.Send:
|
||||||
if server.has_capability("echo-message"):
|
if server.has_capability_str("echo-message"):
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -285,7 +285,9 @@ class Server(IRCObject.Object):
|
||||||
return self.send(utils.irc.protocol.capability_end())
|
return self.send(utils.irc.protocol.capability_end())
|
||||||
def send_authenticate(self, text: str) -> IRCLine.SentLine:
|
def send_authenticate(self, text: str) -> IRCLine.SentLine:
|
||||||
return self.send(utils.irc.protocol.authenticate(text))
|
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
|
return capability in self.agreed_capabilities
|
||||||
|
|
||||||
def waiting_for_capabilities(self) -> bool:
|
def waiting_for_capabilities(self) -> bool:
|
||||||
|
|
Loading…
Reference in a new issue