update ircstates to v0.9.18, catch ERR_NOSUCHSERVER (remote whois)
This commit is contained in:
parent
110431b705
commit
8f552a7d6f
2 changed files with 12 additions and 6 deletions
|
@ -439,17 +439,23 @@ class Server(IServer):
|
||||||
return None
|
return None
|
||||||
return MaybeAwait(_assure)
|
return MaybeAwait(_assure)
|
||||||
|
|
||||||
def send_whois(self, target: str) -> Awaitable[Optional[Whois]]:
|
def send_whois(self,
|
||||||
folded = self.casefold(target)
|
target: str,
|
||||||
fut = self.send(build("WHOIS", [target, target]))
|
remote: bool=False
|
||||||
|
) -> Awaitable[Optional[Whois]]:
|
||||||
|
args = [target]
|
||||||
|
if remote:
|
||||||
|
args.append(target)
|
||||||
|
|
||||||
|
fut = self.send(build("WHOIS", args))
|
||||||
async def _assure():
|
async def _assure():
|
||||||
await fut
|
await fut
|
||||||
params = [ANY, Folded(folded)]
|
params = [ANY, Folded(self.casefold(target))]
|
||||||
obj = Whois()
|
obj = Whois()
|
||||||
while True:
|
while True:
|
||||||
line = await self.wait_for(Responses([
|
line = await self.wait_for(Responses([
|
||||||
ERR_NOSUCHNICK,
|
ERR_NOSUCHNICK,
|
||||||
|
ERR_NOSUCHSERVER,
|
||||||
RPL_WHOISUSER,
|
RPL_WHOISUSER,
|
||||||
RPL_WHOISSERVER,
|
RPL_WHOISSERVER,
|
||||||
RPL_WHOISOPERATOR,
|
RPL_WHOISOPERATOR,
|
||||||
|
@ -460,7 +466,7 @@ class Server(IServer):
|
||||||
RPL_WHOISSECURE,
|
RPL_WHOISSECURE,
|
||||||
RPL_ENDOFWHOIS
|
RPL_ENDOFWHOIS
|
||||||
], params))
|
], params))
|
||||||
if line.command == ERR_NOSUCHNICK:
|
if line.command in [ERR_NOSUCHNICK, ERR_NOSUCHSERVER]:
|
||||||
return None
|
return None
|
||||||
elif line.command == RPL_WHOISUSER:
|
elif line.command == RPL_WHOISUSER:
|
||||||
nick, user, host, _, real = line.params[1:]
|
nick, user, host, _, real = line.params[1:]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
anyio ==1.3.0
|
anyio ==1.3.0
|
||||||
asyncio-throttle ==1.0.1
|
asyncio-throttle ==1.0.1
|
||||||
dataclasses ==0.6
|
dataclasses ==0.6
|
||||||
ircstates ==0.9.17
|
ircstates ==0.9.18
|
||||||
async_stagger ==0.3.0
|
async_stagger ==0.3.0
|
||||||
async_timeout ==3.0.1
|
async_timeout ==3.0.1
|
||||||
|
|
Loading…
Reference in a new issue