PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Help with scripts => Topic started by: Hamachi on 01 November, 2011, 22:13:51

Title: Get flag from $MyINFO string TLS or not
Post by: Hamachi on 01 November, 2011, 22:13:51
Hey i need some help whit the $MyINFO string

I like to know if user use TLS in client or not

$sMyInfo = $MyINFO $ALL Hamachi <((((!))))><++ V:0.782,M:A,H:0/0/3,S:1>$ $0.005$$0$

--if client support TLS
if $sMyInfo == xxx then
--do somfing
else
--do somfing
end

Thanks for the help :)
Title: Re: Get flag from $MyINFO string TLS or not
Post by: Hamachi on 02 November, 2011, 21:03:03
Thanks Mutor :)
Title: Re: Get flag from $MyINFO string TLS or not
Post by: Hamachi on 03 November, 2011, 19:56:11
hmm i have problems whit 3 users:

$MyINFO $ALL NICK1 <AirDC++ V:2.21,M:A,H:0/1/0,S:4>$ $0Q$EMAIL$123$
$MyINFO $ALL NICK2 <RSX++ V:1.21,M:A,H:0/1/0,S:1>$ $1$EMAIL$123$
$MyINFO $ALL NICK3 <AirDC++ V:2.21,M:A,H:0/1/0,S:8>$ $30Q$EMAIL$123$
$MyINFO $ALL NICK4 <EiskaltDC++ V:2.2.4,M:A,H:0/1/0,S:2>$ $1000$EMAIL$123$


TLS works in the clients...
Title: Re: Get flag from $MyINFO string TLS or not
Post by: Hamachi on 04 November, 2011, 16:45:29
Thanks agen Mutor
Title: Re: Get flag from $MyINFO string TLS or not
Post by: PPK on 04 November, 2011, 17:05:37
Actually getting this info from MyINFO need bitwise operations, because that one (magic) byte use bits to show things:

1 bit [0x1] = is always on or should be on always (to avoid possible NULL character [it is not allowed in protocol] when others bit are not enabled)
2 bit [0x2] = is on when user is away
3 bit [0x4] = is on when user is server (sharing more than 2 GB, online more than 2 hour and uploaded more than 200 MB)
4 bit [0x8] = is on when user have fireball (upload more than 200 kB/s]
5 bit [0x10] = is on when user supporting TLS (download only with TLSv1 protocol extension support or all transfers with TLS protocol extension support)
6 bit [0x20] = is on when user supporting TLS for upload (with TLSv1 protocol extension support]
7 bit [0x40] = is on when user supporting IPv4 (with IP64 protocol extension support)
8 bit [0x80] = is on when user is supporting IPv6 (with IP64 protocol extension support)

First 4 bits are protocol standard.
Last 4 bits are protocol extensions and in PtokaX case is their use based on protocol extension support (so client not supporting IP64 protocol extension can't use bit 7 and 8 )  ;D
Title: Re: Get flag from $MyINFO string TLS or not
Post by: Hamachi on 05 November, 2011, 11:35:45
Ok i get this error:

attempt to perform arithmetic on local 'x' (a boolean value)
Title: Re: Get flag from $MyINFO string TLS or not
Post by: Hamachi on 07 November, 2011, 13:17:07
Ahh i have found my bug now, Thanks for you help Mutor.