Skip to content

Instantly share code, notes, and snippets.

@skydrome
Created March 31, 2026 12:19
Show Gist options
  • Select an option

  • Save skydrome/9234f08a1dbf5a826052ac7d45e8b979 to your computer and use it in GitHub Desktop.

Select an option

Save skydrome/9234f08a1dbf5a826052ac7d45e8b979 to your computer and use it in GitHub Desktop.
--- picoirc.tcl 2026-01-17 23:27:19.284587461 -0500
+++ picoirc.tcl 2026-01-17 23:27:16.864572986 -0500
@@ -28,6 +28,7 @@
secure 0
channels ""
callback ""
+ realname ""
motd {}
users {}
}
@@ -56,12 +57,15 @@
}
proc ::picoirc::connect {callback nick args} {
- if {[llength $args] > 2} {
- return -code error "wrong # args: must be \"callback nick ?passwd? url\""
+ if {[llength $args] > 3} {
+ return -code error "wrong # args: must be \"callback nick ?passwd? ?realname? url\""
} elseif {[llength $args] == 1} {
set url [lindex $args 0]
+ } elseif {[llength $args] == 2} {
+ lassign $args passwd url
} else {
- lassign $args passwd url
+ # Handle the new case: passwd, realname, url
+ lassign $args passwd realname url
}
variable defaults
variable uid
@@ -74,6 +78,7 @@
if {[info exists port] && $port ne ""} {set irc(port) $port}
if {[info exists secure] && $secure} {set irc(secure) $secure}
if {[info exists passwd] && $passwd ne ""} {set irc(passwd) $passwd}
+ if {[info exists realname] && $realname ne ""} {set irc(realname) $realname}
set irc(callback) $callback
set irc(nick) $nick
set irc(is_registered) false
@@ -128,7 +133,12 @@
fconfigure $irc(socket) -blocking 0 -buffering line -translation crlf -encoding utf-8
Callback $context connect
set ver [join [lrange [split [Version $context] :] 0 1] " "]
- Send $context "USER $::tcl_platform(user) 0 * :$ver user"
+ #Send $context "USER $::tcl_platform(user) 0 * :$ver user"
+ if {[info exists irc(realname)]} {
+ Send $context "USER $::tcl_platform(user) 0 * :$irc(realname)"
+ } else {
+ Send $context "USER $::tcl_platform(user) 0 * :$ver user"
+ }
if {[info exists irc(passwd)] && [package provide SASL] ne {}} {
Send $context "CAP REQ :sasl"
} else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment