Aleph, version 1.2.0

Aleph 1.2.0 brings mostly internal changes to the way the Message class works and collection of server and channel meta-data such as channel topics and the server MOTD.

Previously, message subclasses would look like this, and the messages would be created by checking the messages module to find a class with the name of the irc command.

:::python
class JOIN (Message):
    ...

However, when it came to add classes for numeric server replies, I found two problems with this approach: that python class and function names cannot start with a number, and that even if I could do that, naming classes with 3-digit numbers would be ugly and confusing.

The solution to this was to use decorators, allowing message subclasses to be defined like this:

:::python
@Message.Reply(332)
class RPL_TOPIC (Message):
    ...

The decorator adds the class to a dictionary of classes stored inside the Message class, and allows the code to access the class for a numeric reply directly, as well as allowing the class to keep a human-readable (read: slightly more human-readable, because RFC 1459 doesn’t define very clear names for the server replies) name.

I also adapted this to work for ‘normal’ message classes as well, so that the message creation code was not looking in two places (Message.NUMERIC_REPLIES and globals()), and added a second decorator for server commands.

:::python
@Message.Command
class JOIN (Message):
    ...

This also resulted in a cleaner module, as the IRC command and reply classes are added to Message.MESSAGES, which is then the only location searched for classes to use for an IRC message (instead of searching globals() for a class).