irc(3tcl)

πŸ“¦
version 2.0 Β· 3 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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 flags logger and debug. logger makes irc use the logger package for printing error. debug requires 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 new irc namespace 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. use connect instead to specify that info. periodt.
  • ::irc::connections β€” returns a list of all the current connections that were created with connection. 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 1459 http://www.rfc-editor.org/rfc/rfc1459.txt. plus there's a few extra events defined on top of that. defaultcmd adds a command that gets called if no other callback is present. EOF is called if the connection signals an End of File condition. the events defaultcmd, defaultnumeric, defaultevent, and EOF are 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::connection made the namespace and the commands and everything, but it did not actually open the socket. this command does that. NOTE: the older form of connect didn't require you to specify a hostname and port, because they were specified with connection. that form is deprecated bestie, let it go. πŸ™ˆ
  • net config ?key? ?value? β€” literally the same as ::irc::config but it sets and gets options for the net connection 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 the USER command 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 β€” the NICK command. 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 as KICK, 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 a PRIVMSG is 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 πŸŽ€

  • chat
  • irc

⭐ 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