ElementalAlchemist / txircd

Modular IRCd built using Twisted. Made to be extremely customizable.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bugs with LocalUser

ekimekim opened this issue · comments

I'm trying to use LocalUser, I'm initializing it with the following:

self.user = LocalUser(ircd, '127.0.0.1') # is this the right value for ip?
self.user.setSendMsgFunc(self.handleMessage)
self.user.changeNick(self.nick) # is this the right way to change nick?

However, trying to message them gives me 401 No such nick/channel.

Also, I get this on shutdown:

    Traceback (most recent call last):
      File "/var/env/txircd/lib/python2.7/site-packages/twisted/internet/base.py", line 846, in runUntilCurrent
        self.fireSystemEvent("shutdown")
      File "/var/env/txircd/lib/python2.7/site-packages/twisted/internet/base.py", line 639, in fireSystemEvent
        event.fireEvent()
      File "/var/env/txircd/lib/python2.7/site-packages/twisted/internet/base.py", line 410, in fireEvent
        result = callable(*args, **kwargs)
      File "/var/env/txircd/lib/python2.7/site-packages/twisted/application/service.py", line 290, in stopService
        l.append(defer.maybeDeferred(service.stopService))
    --- <exception caught here> ---
      File "/var/env/txircd/lib/python2.7/site-packages/twisted/internet/defer.py", line 139, in maybeDeferred
        result = f(*args, **kw)
      File "/var/env/txircd/txircd/txircd/ircd.py", line 96, in stopService
        user.transport.loseConnection()
    exceptions.AttributeError: 'NoneType' object has no attribute 'loseConnection'

which seems to be related to LocalUsers not having a user.transport

The second one is fixed in d5072dd.

As for the first one: There are two things at work there:

  • LocalUser is modeled pretty closely after IRCUser so that it can just slot right in without problems
  • LocalUser can't add itself to the userNicks dict before it has a nick. When you're done setting it up, you should register it with self.user.register("NICK"). (The register function also does a couple other things.)

That said, I'm known for iterating on my APIs and changing them until they're good, and this is the first time I've had something like LocalUser, so it may change in the future if its current implementation proves too cumbersome.

Bugs are gone now.