First of all, credits: This is not my work, I only adapted it for my purposes. The original work comes from
http://pastebin.com/VbG6wSrN. Having said that ... At some point I started getting the SASL authentication required message from Freenode. Freenode's solution is somewhat odd, you are supposed to get a script and a DLL, but those are not working for me.
I came across the pastebin script which seemed like an easier approach. If you look at the script, you will see %user and %password. As far as I can tell, those variables actually never get defined. Because of that, the script failed. What I added are two sections defining those variables in order to get the script to complete the connection.
on ^*:LOGON:*:{
if ($network == Freenode) {
var %user = ENTER YOUR USERNAME HERE
var %password = ENTER YOUR PASSWORD HERE
}
.raw CAP LS
echo -s Checking capabilities...
.raw USER %user 0 * : $+ $fullname
.raw NICK $mnick
enable #sasl
halt
}
#sasl off
raw 001:*:disable #sasl
raw CAP:* LS *:{
echo -s Capabilities: $3-
var %tok
if ($findtok($3-,sasl,32) != $null) {
set %tok $addtok(%tok,sasl,32)
}
if ($findtok($3-,multi-prefix,32) != $null) {
set %tok $addtok(%tok,multi-prefix,32)
}
if ($findtok($3-,packet-size,32) != $null) {
set %tok %addtok(%tok,packet-size=1024,32)
}
if (%tok != $null) {
echo -s Enabling: %tok
.raw CAP REQ : $+ %tok
}
if ($findtok($3-,sasl,32) == $null) {
.raw CAP END
}
halt
}
raw CAP:* ACK sasl*:{
.raw AUTHENTICATE PLAIN
}
raw AUTHENTICATE:+:{
if ($network == Freenode) {
var %user = ENTER YOUR USERNAME HERE
var %password = ENTER YOUR PASSWORD HERE
}
sasl-plain %user %password
halt
}
raw 903:*:.raw CAP END
raw 904:*:.raw CAP END
raw 905:*:.raw CAP END
raw 906:*:.raw CAP END
raw 907:*:.raw CAP END
#sasl end
alias sasl-plain {
bset -t &auth 1 $1
bset -t &auth $calc( $bvar(&auth,0) + 2 ) $1
bset -t &auth $calc( $bvar(&auth,0) + 2 ) $2
var %len = $encode(&auth,mb)
.raw AUTHENTICATE $bvar(&auth,1,%len).text
}
The code that I added in two spots in the script should support multiple servers:
if ($network == Freenode) {
var %user = ENTER YOUR USERNAME HERE
var %password = ENTER YOUR PASSWORD HERE
}
If another network started using SASL authentication, I would simply add two more blocks below the existing "if ($network ==" blocks, e.g.
if ($network == Freenode) {
var %user = ENTER YOUR USERNAME HERE
var %password = ENTER YOUR PASSWORD HERE
}
if ($network == NEW NETWORK) {
var %user = ENTER YOUR OTHER USERNAME HERE
var %password = ENTER YOUR OTHER PASSWORD HERE
}
I am sure the script could be simplified, streamlined etc. So anyway, here it is, a working SASL authentication script for Freenode with mIRC 7.15. All you need to do is enter your username and your password in two locations. And yes, very inefficient of me.