picoirc - Small and simple embeddable IRC client.
This package provides a general purpose minimal IRC client suitable for embedding in other applications. All communication with the parent application is done via an application provided callback procedure. Each connection has its own state so you can hook up multiple servers in a single application instance.
To initiate an IRC connection you must call picoirc::connect with a callback procedure, a nick-name to use on IRC and the IRC URL that describes the connection. This will return a variable name that is the irc connection context. See CALLBACK for details.
This package is a fairly simple IRC client. If you need something with more capability investigate the irc package.
Creates a new irc connection to the server specified by url and login using the nick as the username and optionally password. If the url starts with ircs:// then a TLS connection is created. The callback must be as specified in CALLBACK. Returns a package-specific variable that is used when calling other commands in this package.
Note: For connecting via TLS the Tcl module tls must be already loaded, otherwise an error is raised.
# must be loaded for TLS package require tls # default arguments tls::init -autoservername true -command workaround \ -require 1 -cadir /etc/ssl/certs -tls1 0 -tls1.1 0 # avoid annoying bgerror, errors are already catched internally proc workaround {state args} { if {$state == "verify"} { return [lindex $args 3] } }
This should be called to process user input and send it to the server. If message is multiline then each line will be processed and sent individually. A number of commands are recognised when prefixed with a forward-slash (/). Such commands are converted to IRC command sequences and then sent. If channel is empty then all raw output to the server is handled. The default action is to write the message to the irc socket. However, before this happens the callback is called with "debug write". This permits the application author to inspect the raw IRC data and if desired to return a break error code to halt further processing. In this way the application can override the default send via the callback procedure.
The callback must look like:
proc Callback {context state args} { }
where context is the irc context variable name (in case you need to pass it back to a picoirc procedure). state is one of a number of states as described below.
rfc 1459
Networking