If you follow the link http://www.google.com/support/accounts/bin/answer.py?answer=185833 it will show you how to generate an application specific password. As for attachments, that is beyond the scope of this snippet. I would have to add MIME support, which I am not going to do.
This is such a great concept I decided I would tackle it in my own way. I just used the ETag HTTP header to check if the file has changed.
on *:START:{ svini_update }
ON: *:UNLOAD:{
unset %svini.etag
}
on *:SOCKOPEN:svini:{
if ($sockerr) {
echo -s 14[4*14] 1Unable to Connect to mIRC.COM
.sockclose svini
halt
}
sockwrite -n $sockname GET /servers.ini HTTP/1.1
sockwrite -n $sockname Host: www.mirc.com
if (%svini.etag) { sockwrite -n $sockname If-None-Match: $qt($v1) }
sockwrite -n $sockname Connection: Close
sockwrite -n $sockname $crlf
}
on *:SOCKREAD:svini:{
if ($sockerr) {
echo -s 14[4*14] 1Unable to Download Latest servers.ini File (read error)
if ($2) { unset %svini.etag }
.sockclose svini
halt
}
tokenize 32 $sock($sockname).mark
if (!$2) {
var %read
sockread %read
while (%read) {
if ($regex(%read,/^HTTP/1.1 304 Not Modified$/)) {
echo -s 14[9*14] 1You Have the Latest servers.ini ( $+ $calc(($ticks - $1) / 1000) $+ s)
.sockclose svini
halt
}
elseif ($regex(%read,/^Content-Length: (\d+)$/)) { sockmark $sockname $1 $regml(1) }
elseif ($regex(%read,/^ETag: "(.*)"$/)) { set %svini.etag.new $regml(1) }
sockread %read
}
}
else {
sockread &read
while ($sockbr) {
bwrite $+($mircdir,servers.ini.tmp) -1 -1 &read
if ($file($+($mircdir,servers.ini.tmp)).size == $2) {
svini_finish $1
halt
}
sockread &read
}
}
}
ON *:SOCKCLOSE:svini:{
tokenize 32 $sock($sockname).mark
echo -s 14[4*14] 1Unable to Download Latest servers.ini File (socket closed)
if ($2) { unset %svini.etag.new }
.sockclose svini
halt
}
alias svini_update {
echo -s 14[8*14] 1Checking for new servers.ini File...
.remove $+($mircdir,servers.ini.tmp)
if ($1 == -force) { unset %svini.etag }
sockopen svini www.mirc.com 80
sockmark svini $ticks
}
alias -l svini_finish {
.copy -o $+($mircdir,servers.ini) $+($mircdir,servers.ini.old)
.copy -o $+($mircdir,servers.ini.tmp) $+($mircdir,servers.ini)
set %svini.etag %svini.etag.new
unset %svini.etag.new
echo -s 14[9*14] 1Successfully Downloaded Latest servers.ini ( $+ $calc(($ticks - $1) / 1000) $+ s)
.sockclose svini
}
Quick ninja Edit: Changed it so the etag doesn't get update until it finishes copying over the new server list.
mSLDev I am guessing. http://msldev.zigwap.com/
I got it working (for the most part), without needing to use the dirty variable hack. Basically I make sure $1- and the edit box are the same. If they are, that means TAB isn't trying to auto complete.
The Downfalls:
It still takes out any extra spaces in the edit box string
If you are use the normal auto complete on a nickname and its the only auto complete match, and its the last nickname seen, it will toggle between that nickname and the channel if you hit tab again. (not a huge deal)
But now you can tab through multiple normal auto completes and it won't change to the channel name if one of the nicks is the last nickname seen.