SpiKe^^ wrote:I have never used [scan] before, but will follow your lead from above.
And assuming that the string in $arg is as you stated above...
* 16:37 -hub.*- *** Notice -- Client exiting at mibbit.*.net: lina!Mibbit@185.179.31.20 (U largua nga *.net)
I might use something like this.
Code: Select all
if {[scan $arg {%[^:]:%[^:]: %[^!]!%[^@]@%[^ ]} 1 2 nick ident host] == "5"} {
Hello Spike.
No its not correct..
i have two code, one its for connect and one its for disconnect.
When i was on Unrealircd5 its was correct and now am on Unreal3.2 and connect its correct and its okay.. disconnect make me problem..
I Will paste connect and disconnect and u see what i mean..
------------
When a user connected
* 12:01 -hub.*- *** Notice -- Client connecting at mibbit.*: Emri8 (Mibbit@37.201.194.29)
show me on the channel #services
Emri8 - IP: 37.201.194.29 - Shteti: Germany - Qyteti: Langen - Mobile: false - Proxy: false
Code: Select all
package require http
package require json
set ExpChan "#services"
bind raw - NOTICE Client
proc Client {from key arg} {
if {[string match *!*@* $from] || ![string match -nocase "*Client connecting*" $arg]} { return }
if {[scan $arg %\[^\:\]\:%\[^(\](%\[^@\]@%\[^\)\] _ nick ident host] == "4"} {
set token [http::geturl http://ip-api.com/json/$host?fields=status,message,country,countryCode,region,continent,continentCode,regionName,city,zip,lat,lon,timezone,district,isp,org,as,asname,reverse,mobile,proxy,hosting,query]
set data [json::json2dict [http::data $token]]
::http::cleanup $token
#if {[dict get $data status] eq "success"} { return }
puthelp "PRIVMSG $::ExpChan 5[regsub -all {([^:]+:)} $nick ""]- 3IP14: [dict get $data query] - 3Shteti14: [dict get $data country] - 3Qyteti14: [dict get $data city] - 3Mobile4: [dict get $data mobile] - 3Proxy4: [dict get $data proxy]"
} else {
putcmdlog "Error! it fails to get data for this $host"
}
}
return 0
}
And when a user make disconnect(exit) Server notices show me
* 12:03 -hub.*- *** Notice -- Client exiting at mibbit.*: Njanich!Mibbit@194.230.144.53 (Client exited)
Code: Select all
#######################
package require http
package require json
set ExpiChan "#services"
bind raw - NOTICE Clienti
proc Clienti {from key arg} {
if {[string match *@* $from] || ![string match -nocase "*Client exiting*" $arg]} { return }
if {[scan $arg {%[^:]:%[^:]: %[^!]!%[^@]@%[^ ]} 1 2 nick ident host] == "5"} {
set token [http::geturl http://ip-api.com/json/$host?fields=status,message,country,countryCode,region,continent,continentCode,regionName,city,zip,lat,lon,timezone,district,isp,org,as,asname,reverse,mobile,proxy,hosting,query]
set data [json::json2dict [http::data $token]]
::http::cleanup $token
#if {[dict get $data status] eq "success"} {
puthelp "PRIVMSG $::ExpChan 5[regsub -all {([^:]+:)} $nick ""]- 3DUL IP14: [dict get $data query] - 3Shteti14: [dict get $data country] - 3Qyteti14: [dict get $data city] - 3Mobile4: [dict get $data mobile] - 3Proxy4: [dict get $data proxy]"
} else {
putcmdlog "Error! it fails to get data for this $host"
}
}
return 0
}
The reason why i will have this tcl code because to me are active 300+ users online and i i have make module DNS and ConnectServ (unload) delete because i want to have all what we are on server PRIVACY on our life..
* 12:04 * Joins: Kushtrimi (
Mibbit@8D5FB041.BFFCBA9F.6072C6B2.IP)
* 12:04 * Joins: Ela_ (
Mibbit@4C9BFBB1.65F8D88D.24FA5EED.IP)
* 12:04 * Joins: Tonita (
Mibbit@9C39A8B3.37AB3C75.89F8A913.IP)
* 12:04 * Joins: Rrezjaa (
Mibbit@32710816.C7DCAFFC.4ADB31B1.IP)