update ircstates to v0.9.18, catch ERR_NOSUCHSERVER (remote whois)

This commit is contained in:
jesopo 2020-06-07 20:46:05 +01:00
parent 110431b705
commit 8f552a7d6f
2 changed files with 12 additions and 6 deletions

View file

@ -439,17 +439,23 @@ class Server(IServer):
return None
return MaybeAwait(_assure)
def send_whois(self, target: str) -> Awaitable[Optional[Whois]]:
folded = self.casefold(target)
fut = self.send(build("WHOIS", [target, target]))
def send_whois(self,
target: str,
remote: bool=False
) -> Awaitable[Optional[Whois]]:
args = [target]
if remote:
args.append(target)
fut = self.send(build("WHOIS", args))
async def _assure():
await fut
params = [ANY, Folded(folded)]
params = [ANY, Folded(self.casefold(target))]
obj = Whois()
while True:
line = await self.wait_for(Responses([
ERR_NOSUCHNICK,
ERR_NOSUCHSERVER,
RPL_WHOISUSER,
RPL_WHOISSERVER,
RPL_WHOISOPERATOR,
@ -460,7 +466,7 @@ class Server(IServer):
RPL_WHOISSECURE,
RPL_ENDOFWHOIS
], params))
if line.command == ERR_NOSUCHNICK:
if line.command in [ERR_NOSUCHNICK, ERR_NOSUCHSERVER]:
return None
elif line.command == RPL_WHOISUSER:
nick, user, host, _, real = line.params[1:]

View file

@ -1,6 +1,6 @@
anyio ==1.3.0
asyncio-throttle ==1.0.1
dataclasses ==0.6
ircstates ==0.9.17
ircstates ==0.9.18
async_stagger ==0.3.0
async_timeout ==3.0.1