Ok. I tried smth else and it seems to work for what im looking for...
since we have a services channel where the version of all the users connecting is posted there, then why not grab it from there and not issue a new ctcp on users connecting...
Kod: Kodu kopyalamak için üzerine çift tıklayın!
on *:start: {
.hmake nick_to_check
.hmake nicks_replied
var -g %HC_MIBBIT_VERSION =
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
var -g %HC_JAVA_VERSION = lightIRC.com
}
alias parse_snotice {
if ($prop == getnick) {
if ($regex(nick,$1-,/\: (.*) \(/))) {
var %nick = $regml(nick,1)
return %nick
}
}
if ($prop == getusername) {
if ($regex(username,$1-,/\: .* \((.*)\@/))) {
var %username = $regml(username,1)
return %username
}
}
if ($prop == getip) {
if ($regex(ip,$1-,/: .* \(.*\@(.*)\)/)) {
var %ip = $regml(ip,1)
return %ip
}
}
if ($prop == oldnick) {
if ($regex(onick,$1-,/user\:\ (.*) \(.*\)/)) {
var %onick = $regml(onick,1)
return %onick
}
}
if ($prop == newnick) {
if ($regex(nnick,$1-,/nick to (.*)/)) {
var %nnick = $regml(nnick,1)
return %nnick
}
}
if ($prop == ipofchangednick) {
if ($regex(cnip,$1-,/\(.*\@(.*)\)/)) {
var %cnip = $regml(cnip,1)
return %cnip
}
}
if ($prop == csusername) {
if ($regex(cusername,$1-,/\((.*)\@.*\)/)) {
var %cusername = $regml(cusername,1)
return %cusername
}
}
if ($prop == replyfromnick) {
if ($regex(rfromnick,$1-,/(.*)\:/)) {
var %rfromnick = $regml(rfromnick,1)
return %rfromnick
}
}
if ($prop == reply) {
if ($regex(csreply,$1-,/\: (.*)/)) {
var %csreply = $regml(csreply,1)
return %csreply
}
}
if ($prop == nickfromspam) {
if ($regex(nicksp,$1-,/\] (.*)\!.*\@/)) {
var %nicksp = $regml(nicksp,1)
return %nicksp
}
}
if ($prop == versionfromspam) {
if ($regex(versionsp,$1-,/\[NOTICE Network\: '(.*)'\])) {
var %versionsp = $regml(versionsp,1)
return %versionsp
}
}
return 0
}
;Process the commands, issue bans or not
alias issue_command_on_mismatch {
; $1 = nickname , $2 = ip with username separated by space . $3 = real version
if ($prop == mibbit) {
var %nick = $1
var %ip = $2
msg #test4 Mibbit Version mismatch -> Nickname: %nick , IP: %ip , Actual Version : $3-
}
if ($prop == javauser) {
var %nick = $1
var %ip = $2
msg #test4 JavaUser Version mismatch -> Nickname: %nick , IP: %ip , Actual Version : $3-
}
}
alias check_if_replied {
if (!$hget(nicks_replied,$1)) {
msg #test4 No reply from nick: $1 using ip: $2
}
}
;Handling of version mismatch
alias check_for_mismatch {
if ($prop == mibbit) {
;%reply_from_nick, %username, %reply
if ($hget(nick_to_check,$1)) {
if (!$count($3,%HC_MIBBIT_VERSION)) {
$issue_command_on_mismatch($1,$hget(nick_to_check,$1),$3).mibbit
}
}
}
if ($prop == javauser) {
if ($hget(nick_to_check,$1)) {
;Have to be more lenient with checking java version since it has different build numbers
;They all start with lightIRC.com though
if (!$count($3,%HC_JAVA_VERSION)) {
$issue_command_on_mismatch($1,$hget(nick_to_check,$1),$3).javauser
}
}
}
}
;Entry point ,
on *:snotice:*Client connecting*: {
var %nick = $parse_snotice($1-).getnick
var %username = $parse_snotice($1-).getusername
var %ip = $parse_snotice($1-).getip
;Store the nick and ip for 10 seconds
.hadd -su15 nick_to_check %nick %ip %username
$+(.timer,%nick) 1 10 check_if_replied %nick %ip
}
;Connect serv on nick change
on *:text:*changed their nick*:#services {
var %chan_message = $strip($1-)
var %old_nick = $parse_snotice(%chan_message).oldnick
var %new_nick = $parse_snotice(%chan_message).newnick
var %cnip = $parse_snotice(%chan_message).ipofchangednick
var %username = $parse_snotice(%chan_message).csusername
$+(.timer,%old_nick) off
if ($hget(nick_to_check,%old_nick) && !$hget(nicks_replied,%old_nick)) {
.hdel nick_to_check %old_nick
.hadd -su15 nick_to_check %new_nick %cnip %username
.timer 1 10 check_if_replied %new_nick %cnip
}
}
;Check spamfilter if reply got lost there
on *:snotice:*NOTICE Network*: {
var %nickname = $parse_snotice($1-).nickfromspam
;var %username = $parse_snotice($1-).userfromspam
var %version = $parse_snotice($1-).versionfromspam
if ($hget(nick_to_check,%nickname)) {
var %username = $gettok($hget(nick_to_check,%nickname),2,32)
var %ip = $gettok($hget(nick_to_check,%nickname),1,32)
.hadd -su20 nicks_replied %nickname %ip
if (%username == Mibbit) {
$check_for_mismatch(%nickname,%username,%version).mibbit
}
if (%username == JavaUser) {
$check_for_mismatch(%nickname,%username,%version).javauser
}
}
}
on *:text:*Got Version Reply*:#services {
var %chan_message = $strip($1-)
var %nick_from_cmsg = $gettok(%chan_message,5,32)
var %reply_from_nick = $parse_snotice(%nick_from_cmsg).replyfromnick
var %reply = $parse_snotice(%chan_message).reply
if ($hget(nick_to_check,%reply_from_nick)) {
var %username = $gettok($hget(nick_to_check,%reply_from_nick),2,32)
var %ip = $gettok($hget(nick_to_check,%reply_from_nick),1,32)
if (%username == Mibbit) {
$check_for_mismatch(%reply_from_nick,%username,%reply).mibbit
}
if (%username == JavaUser) {
$check_for_mismatch(%reply_from_nick,%username,%reply).javauser
}
.hadd -su20 nicks_replied %reply_from_nick %ip
}
}
Now when a users connects with a certain ident (in this case JavaUser) I get a report for it on #test4 like this.
[02:38:18] <starkeffect> JavaUser Version mismatch -> Nickname: User49445 , IP: ip86-134-125-176.cl.ri.cox.net JavaUser , Actual Version : HexChat 2.12.0 / Linux 4.4.0-73-generic [x86_64/800.50MHz/SMP
, if you have suggestions on the code above pls advise, although it is working for me as it is...