April 2024 - This site, and Kamaelia are being updated. There is significant work needed, and PRs are welcome.

Kamaelia.Support.Protocol.IRC

Kamaelia IRC Support Code

This provides support for Kamaelia.Protocol.IRC.*

Specifically it provides 2 core functions and 2 utility methods.

Core functions

informat(text,defaultChannel='#kamtest')

Summary - Puts a string input into tuple format for IRC_Client. Understands irc commands preceded by a slash ("/"). All other text is formatted such that sending it would send the message to the default channel.

Detail - If the text starts with a "/" it is treated as a command. Informat understands some specific commands which it helps you format for sending to the IRCClient. The commands it understands are:

QUIT
PRIVMSG
MSG
NOTICE
KILL
TOPIC
SQUERY
KICK
USER
ME

For commands it doesn't recognise, it makes a guess at how to forward it.

If you send it text which does NOT start with "/", it is assumed to be badly formatted text, intended to be sent to the current default channel. It is then formatted appropriately for sending on to an IRC_Client component.

For an example of usage, see Examples/TCP_Systems/IRC/BasicDemo.py

outformat(data, defaultChannel='#kamtest')

Takes tuple output from IRC_Client and formats for easier reading If a plaintext is received, outformat treats it as a privmsg intended for defaultChannel (default "#kamtest").

Specific commands it understands and will make a an attempt to format appropriately are:

PRIVMSG
JOIN
PART
NICK
ACTION
TOPIC
QUIT
MODE

It will also identify certain types of errors.

For an example of usage, see Examples/TCP_Systems/IRC/BasicDemo.py

Utility functions

channelOutformat(channel)

Creates a customised outformat function with defaultChannel predefined to channel. (ie Returns a lambda)

channelInformat(channel)

Creates a customised informat function with defaultChannel predefined to channel. (ie Returns a lambda)

Open Issues

Should these really be components rather than helper functions?


Feedback

Got a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording!

Please leave you feedback here in reply to the documentation thread in the Kamaelia blog.

-- Automatic documentation generator, 05 Jun 2009 at 03:01:38 UTC/GMT