Pysilc

What is pysilc?

Pysilc is a python binding for the SILC toolkit. Right now just a percentage of the SilcClient part of the toolkit is covered. The main goal is not to wrap the whole toolkit, but only the necessary parts to write simple bots.
Using SILC in python is quite simple:


import os, silc, silc.client

def cb_connected(msg):
    print "CONNECTED : ", msg
    s.command("JOIN bottest")

def cb_disconnected(a, b):
    print "DISCONNECTED"
    sys.exit(0)

def cb_channel_message(sender, msg):
    print "MSG : <%s> %s" % (sender, msg)

callbacks = {
    "connected":       cb_connected,
    "disconnected":    cb_disconnected,
    "channel_message": cb_channel_message
}

s = silc.client.Client()
s.username = "pybot"
s.realname = "i am the pybot"
s.hostname = "localhost"
s.setcallbacks(callbacks)
s.createkeys("test.pub", "test.prv", "foobar")
s.connect("localhost", 706)

while 1:
    try:
        s.runone()
    except silclient.error:
        traceback.print_exc()
        break
    time.sleep(0.5)
	
BUGS

Pysilc is in its infancy, hence it is rather buggy. Let me know of the various issues you stumble upon. (API related ones as well).

Usage and configuration

Make sure you have the Silc toolkit and the Python development packages installed. (Check your distro packages for more info).

./configure --prefix=<prefix>
make
make install

Download

pysilc-0.0.2.tar.bz2 - 0dcaebb47f2348243cabbcf818788dfb

08 Nov 2005:

  • Add channel name in channel_message()

pysilc-0.0.1.tar.bz2 - 347297b88a21d17c9676027c6514a1f0

19 Oct 2005:

  • First release