irc(3tcl)
π irc β bestie, we're getting you on IRC π
okay so this is irc from the Low Level Tcl IRC Interface collection, and it's basically your backstage pass to the whole IRC protocol. no cap.
β¨ NAME β¨
irc β create an IRC connection and interface. that's it, that's the girl. π
πΈ SYNOPSIS πΈ
package require Tcl 8.6 9
package require irc ?0.8.0?
::irc::config ?key? ?value?
::irc::connection
::irc::connections
net registerevent event script
net getevent event script
net eventexists event script
net connect hostname ?port?
net config ?key? ?value?
net log level message
net logname
net connected
net sockname
net peername
net socket
net user username localhostname localdomainname userinfo
net nick nick
net ping target
net serverping
net join channel ?key?
net part channel ?message?
net quit ?message?
net privmsg target message
net notice target message
net ctcp target message
net kick channel target ?message?
net mode target args
net topic channel message
net invite channel target
net send text
net destroy
who ?address?
action
target
additional
header
msg
π¦ DESCRIPTION π¦
so this package hands you the low-level commands for talking the IRC protocol (that's Internet Relay Chat for the uninitiated bestie) so you can do immediate and interactive multi-cast communication. it's giving direct line to the server, no middleman. π
::irc::config ?key? ?value?β sets the configuration ?key? to ?value?. the configuration keys that are currently defined are the boolean flagsloggeranddebug.loggermakes irc use the logger package for printing error.debugrequires logger and prints extra debug output. if you don't give a ?key? or a ?value?, you just get the current values handed right back to you. slay.::irc::connectionβ makes a whole new object to deal with an IRC connection. lowkey important: creating this IRC object does NOT automatically create the network connection, okay? it just returns a newircnamespace command that you can use to interact with your shiny new IRC connection. NOTE: the old form of the connection command, the one that took a hostname and port as arguments, is deprecated. useconnectinstead to specify that info. periodt.::irc::connectionsβ returns a list of all the current connections that were created withconnection. it's the group chat roster fr fr.
π PER-CONNECTION COMMANDS π
in this next list of available connection methods, net represents a connection command as returned by ::irc::connection. keep that in mind bestie, it's the main character here.
net registerevent event scriptβ registers a callback handler for the specific event. the events available are those described in RFC 1459http://www.rfc-editor.org/rfc/rfc1459.txt. plus there's a few extra events defined on top of that.defaultcmdadds a command that gets called if no other callback is present.EOFis called if the connection signals an End of File condition. the eventsdefaultcmd,defaultnumeric,defaultevent, andEOFare required, so don't skip them. script gets executed in the connection namespace, which means it can take advantage of several commands (peep the Callback Commands section below) to help parse the data. πnet getevent event scriptβ returns the current handler for the event if one exists. otherwise you get an empty string back. πnet eventexists event scriptβ returns a boolean value telling you whether that event handler exists or not.net connect hostname ?port?β this is the one that actually causes the socket to be established.::irc::connectionmade the namespace and the commands and everything, but it did not actually open the socket. this command does that. NOTE: the older form ofconnectdidn't require you to specify a hostname and port, because they were specified withconnection. that form is deprecated bestie, let it go. πnet config ?key? ?value?β literally the same as::irc::configbut it sets and gets options for thenetconnection only. exclusive vibes.net log level messageβ if logger is turned on by config, this writes a log message at level.net lognameβ returns the name of the logger instance if logger is turned on.net connectedβ returns a boolean value saying whether this connection is connected to a server. vibe check on your own connection. π«Άnet socknameβ returns a 3 element list made of the ip address, the hostname, and the port of the local end of the connection, if it's currently connected.net peernameβ returns a 3 element list made of the ip address, the hostname, and the port of the remote end of the connection, if it's currently connected.net socketβ returns the Tcl channel for the socket that the connection is using.net user username localhostname localdomainname userinfoβ sends theUSERcommand to the server. username is the username you want to appear. localhostname is the host portion of your hostname, localdomainname is your domain name, and userinfo is a short description of who you are. heads up: the 2nd and 3rd arguments are normally ignored by the IRC server, so don't stress about them too hard. πnet nick nickβ theNICKcommand. nick is the nickname you want to use for this particular connection. pick something iconic. πnet ping targetβ sends a CTCP PING to target.net serverpingβ PINGs the server itself.net join channel ?key?β channel is the IRC channel to join. IRC channels typically begin with a hashmark ("#") or an ampersand ("&").net part channel ?message?β makes the client leave channel. some networks may support the optional argument message. βοΈnet quit ?message?β tells the IRC server to close the current connection. if you didn't specify a message, the package will use a generic default. it's giving graceful exit.net privmsg target messageβ sends message to target, which can be either a channel or another user, in which case their nick is used.net notice target messageβ sends a notice with message to target, which can be either a channel or another user, in which case their nick is used.net ctcp target messageβ sends a CTCP of type message to target.net kick channel target ?message?β kicks the user target from the channel channel, with a message. the message can be left out if you're feeling merciful.net mode target argsβ sets the mode args on the target target. target may be a channel, a channel user, or yourself. main character energy tbh.net topic channel messageβ sets the topic on channel to message. specifying an empty string will remove the topic entirely.net invite channel targetβ invites target to join the channel channel. πnet send textβ sends text to the IRC server. raw and unfiltered, iykyk.net destroyβ deletes the connection and its associated namespace and information. it's over bestie, we're packing up. π§³
π CALLBACK COMMANDS π
these commands can be used within callbacks. yes, that's the whole point of them.
who ?address?β returns the nick of the user who performed a command. the optional keyword address causes the command to return the user in the format"username@address". cute little upgrade. β¨actionβ returns the action performed, such asKICK,PRIVMSG,MODE, etc... normally not useful, because callbacks are bound to a particular event anyway. so like, it's there. πtargetβ returns the target of a particular command, such as the channel or user to whom aPRIVMSGis sent.additionalβ returns a list of any additional arguments after the target.headerβ returns the entire event header (everything up to the:) as a proper list.msgβ returns the message portion of the command (the part after the:). π
π BUGS, IDEAS, FEEDBACK π
okay so, this document, and the package it describes, will undoubtedly contain bugs and other problems. i'm just being honest with you bestie. please report such in the category irc of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. please also report any ideas for enhancements you may have for either package and/or documentation β we want the glow up too. π«Ά
when proposing code changes, please provide unified diffs, i.e the output of diff -u. that's the vibe.
note further that attachments are strongly preferred over inlined patches. attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. you got this, no cap. π
π SEE ALSO π
rfc 1459
π KEYWORDS π
chatirc
β CATEGORY β
Networking
and that's the whole page bestie, you're officially an IRC girlie now πΈπ¦
this was brought to you by tcllib, version 0.8.0, filed under irc(3tcl) β k bye, go join a channel π
π¦ where this page comes from
- debian trixie: tcllib 2.0+dfsg-4 Β· Tcl
- ubuntu questing: tcllib 2.0+dfsg-4
- ubuntu resolute: tcllib 2.0+dfsg-5 Β· Tcl
- ubuntu stonking: tcllib 2.0+dfsg-6 Β· Tcl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms