irc(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

✨ irc(n) β€” Low Level Tcl IRC Interface ✨

okay bestie, sit down, we're learning the low-level Tcl IRC interface πŸ’– this is the manual page for irc(n), and yes it's giving ✨networking✨ but in a cute way I promise.


🌸 NAME 🌸

irc β€” make an IRC connection and an interface to go with it. That's the whole vibe. πŸ’…


πŸŽ€ 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 like, what IS this β€” this package hands you the low-level commands for dealing with the IRC protocol (Internet Relay Chat) so you can do immediate and interactive multi-cast communication. Basically: group chat, but you're building the plumbing yourself. Main character energy fr. πŸ’…


  • ::irc::config ?key? ?value? β€” sets the config ?key? to ?value?. The config keys that exist right now are the boolean flags logger and debug. logger makes irc use the logger package for printing error. debug needs logger and prints extra debug output. If you don't hand it a ?key? or ?value?, it returns the current values. 🫢
  • ::irc::connection β€” creates a brand new object to deal with an IRC connection. Important bestie: creating this IRC object does not automatically create the network connection. It returns a new irc namespace command that you use to interact with your 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. no cap.
  • ::irc::connections β€” returns a list of all the current connections that were created with connection. it's giving roster. πŸ“‹

πŸ’– PER-CONNECTION COMMANDS πŸ’–

In this next list of available connection methods, net represents a connection command as returned by ::irc::connection. ✨

  • net registerevent event script β€” registers a callback handler for that specific event. The events available are the ones described in RFC 1459 http://www.rfc-editor.org/rfc/rfc1459.txt. On top of those, there are several other events defined too: defaultcmd adds a command that gets called if no other callback is present. EOF gets called if the connection signals an End of File condition. The events defaultcmd, defaultnumeric, defaultevent, and EOF are required. The script runs in the connection namespace, which means it can take advantage of several commands (peep the Callback Commands section below) to help with parsing data. πŸ”₯
  • net getevent event script β€” returns the current handler for the event if one exists. If not, you get an empty string back. 🀷
  • net eventexists event script β€” returns a boolean value telling you whether that event handler exists or not. vibe check βœ…
  • net connect hostname ?port? β€” this is what actually causes the socket to be established. ::irc::connection created the namespace and the commands to be used, but it did not actually open the socket. That happens here. > ⚠️ NOTE: the older form of Β΄connect' did not require you to specify a hostname and port, because those were specified with 'connection'. That form is deprecated. 😭
  • net config ?key? ?value? β€” same as ::irc::config but it sets and gets options for the net connection only. πŸŽ€
  • 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 indicating if this connection is connected to a server. true/false era.
  • net sockname β€” returns a 3 element list consisting 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 consisting 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 used by the connection. πŸ”Œ
  • 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. fun fact: the 2nd and 3rd arguments are normally ignored by the IRC server. πŸ™ˆ
  • net nick nick β€” the NICK command. nick is the nickname you wish to use for that particular connection. πŸ‘‘
  • net ping target β€” sends a CTCP PING to target. πŸ“
  • net serverping β€” pings the server. πŸ–₯️
  • 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 message argument. πŸ‘‹
  • net quit ?message? β€” tells the IRC server to close the current connection. If you don't specify a message, the package uses a generic default. πŸšͺ
  • net privmsg target message β€” sends message to target, which can be either a channel, or another user β€” in that case their nick is used. πŸ’Œ
  • net notice target message β€” sends a notice with message message to target, which can be either a channel, or another user β€” in that 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 part can be left out. πŸ₯Ύ
  • net mode target args β€” sets the mode args on the target target. target may be a channel, a channel user, or yourself. self-care mode setting.
  • net topic channel message β€” sets the topic on channel to message. Specifying an empty string will remove the topic. ✏️
  • net invite channel target β€” invites target to join the channel channel. πŸ’Œ
  • net send text β€” sends text to the IRC server. πŸ“€
  • net destroy β€” deletes the connection and its associated namespace and information. πŸ’€ rest in peace bestie

🌈 CALLBACK COMMANDS 🌈

These commands can be used inside callbacks 🫢

  • who ?address? β€” returns the nick of the user who performed a command. The optional keyword address makes the command return the user in the format "username@address". πŸ”
  • action β€” returns the action performed, like KICK, PRIVMSG, MODE, etc... Normally not useful, because callbacks are bound to a particular event anyway. πŸ€·β™€οΈ
  • 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 πŸ›

Real talk bestie: this document, and the package it describes, will undoubtedly contain bugs and other problems. 😭 Please report those in the category irc of the Tcllib Trackers at http://core.tcl.tk/tcllib/reportlist. Also please report any ideas for enhancements you may have for either the package and/or the documentation. 🫢

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Also note further that attachments are strongly preferred over inlined patches. You can make attachments 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. πŸ’…


πŸ‘€ SEE ALSO πŸ‘€

  • rfc 1459

πŸ”‘ KEYWORDS πŸ”‘

  • chat
  • irc

🏷️ CATEGORY 🏷️

Networking


and that's the whole page, bestie πŸ’– this one came from tcllib, version 0.8.0, and it's the irc(n) page β€” go build something iconic with it πŸŽ€βœ¨πŸ¦‹πŸŒΈπŸ’…πŸ‘‘

πŸ“¦ where this page comes from