Git Product home page Git Product logo

async-irc's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar linuxdaemon avatar n7st avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

bukforks

async-irc's Issues

KeyError in _internal_cap_handler

Attempting to do a little test. Not sure if this is a bug in async-irc or my usage.

# main.py
import asyncio

from asyncirc.protocol import IrcProtocol
from asyncirc.server import Server

servers = [
	Server("irc.freenode.net", 6667),
]

async def log(conn, message):
	print(message)

async def main():
	conn = IrcProtocol(servers, "BotNick", loop=loop)
	conn.register_cap('userhost-in-names')
	conn.register('*', log)
	await conn.connect()
	await asyncio.sleep(24 * 60 * 60)

loop = asyncio.get_event_loop()

try:
	loop.run_until_complete(main())
except KeyboardInterrupt:
	pass
finally:
	loop.stop()
$ python ./main.py 
:Delphini.GA.US.StarChat.Net NOTICE * :*** Looking up your hostname...
:Delphini.GA.US.StarChat.Net NOTICE * :*** Couldn't resolve your hostname; using your IP address instead
:Delphini.GA.US.StarChat.Net CAP * LS :unrealircd.org/plaintext-policy=user=allow,oper=warn,server=deny unrealircd.org/link-security=1 extended-join chghost cap-notify userhost-in-names multi-prefix away-notify account-notify sasl=EXTERNAL,PLAIN tls
PING :85762D26
Task exception was never retrieved
future: <Task finished coro=<_internal_cap_handler() done, defined at /lib/python3.6/site-packages/asyncirc/protocol.py:40> exception=KeyError('',)>
Traceback (most recent call last):
  File "/lib/python3.6/site-packages/asyncirc/protocol.py", line 59, in _internal_cap_handler
    current = conn.server.caps[cap.name][0]
KeyError: ''
:Delphini.GA.US.StarChat.Net CAP BotNick ACK :userhost-in-names 
:Delphini.GA.US.StarChat.Net CAP BotNick ACK :sasl 
Task exception was never retrieved
future: <Task finished coro=<_internal_cap_handler() done, defined at /lib/python3.6/site-packages/asyncirc/protocol.py:40> exception=KeyError('',)>
Traceback (most recent call last):
  File "/lib/python3.6/site-packages/asyncirc/protocol.py", line 59, in _internal_cap_handler
    current = conn.server.caps[cap.name][0]
KeyError: ''
$ pip freeze
async-irc==0.1.7
py-irclib==0.1.4

For some reason the caplist has two elements in it, sasl and an empty/blank cap. I worked around it will a try/except:

            try:
                current = conn.server.caps[cap.name][0]
                conn.server.caps[cap.name] = (current, enabled)
                if enabled:
                    handlers = filter(None, conn.cap_handlers[cap.name])
                    await asyncio.gather(*[func(conn, cap) for func in handlers])
            except KeyError:
                pass

IRCv3 Support

  • Capability negotiation v3.1
    • Basic negotiation with CAP LS, REQ, ACK, NAK, and END
    • Handle CAP LIST
  • Capability negotiation v3.2
    • Support CAP values
    • Handle new CAPs from CAP NEW and send appropriate CAP REQs
    • Update cap list on receipt of a CAP DEL
  • Core Message Tag spec
    • Message Tag support in core parser
  • account-notify
    No core support required
  • account-tag
    No core support required
  • extended-join
    No core support required
  • away-notify
    No core support required
  • batch handling
    Possibly a core handler which collects batches and handles them specially for efficiency
  • chghost
    No core support required
  • echo-message
  • invite-notify
    No core support required
  • MONITOR
    No core support required
  • multi-prefix
    No core support required
  • SASL Authentication
  • server-time
    No core support required
  • STARTTLS (Moved to #2)
  • userhost-in-names
    No core support required

Reconnect timeout

Possibly implement the exponential back-off algorithm to avoid attempting to reconnect as fast as possible

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.