View previous topic :: View next topic |
Author |
Message |
geek Halfop
Joined: 24 Oct 2008 Posts: 44
|
Posted: Sun Nov 28, 2021 6:02 am Post subject: webchat converter |
|
|
hi,
in my network you can connect via webchat too
example:
testone!6275b11f@webchat.net has joined
user ident 6275b11f is a hexadecimal notation:
Code: | 0x62=98, 0x75=117, 0xB1=177, 0x1F=31 |
so real ip (decimal notation) is 98.117.177.31
is it possible to write a tcl that does this conversion?
like:
Code: |
=> testtwo!xxx@abcdef.com has joined
<me> !hex_to_dec testtwo
<bot> testtwo is not using a webchat
=> testone!6275b11f@webchat.net has joined
<me> !hex_to_dec testone
<bot> testone real ip is: 0x62=98, 0x75=117, 0xB1=177, 0x1F=31 --> 98.117.177.31
|
I need a variable where I set webchat hostnames and bot does the conversion only if the user is connected from those:
webchat.net and chatweb.com ---> yes, convert
all other domains ---> no conversion
Last edited by geek on Sun Nov 28, 2021 11:51 am; edited 1 time in total |
|
Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1058 Location: France
|
Posted: Sun Nov 28, 2021 11:20 am Post subject: |
|
|
Quite simple :
Code: | bind pub - hex_to_dec h2d
proc h2d {nick uhost handle chan text} {
if {$text == ""} {
putserv "PRIVMSG $nick :You forget the target"
return 0
}
if {![onchan $text $chan]} {
putserv "PRIVMSG $nick :I can't see $text on $chan"
return 0
}
set thost [getchanhost $text $chan]
if {[catch {[scan [lindex [split $thost @] 0] "%02x%02x%02x%02x" ip1 ip2 ip3 ip4]}]} {
putserv "PRIVMSG $nick :$text doesn't seem to be webchat"
} else {
putserv "PRIVMSG $nick :$text is $ip1.$ip2.$ip3.$ip4"
}
} |
Not tested, but the scan works and automaticaly converts into dec. _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
Back to top |
|
 |
geek Halfop
Joined: 24 Oct 2008 Posts: 44
|
Posted: Sun Nov 28, 2021 12:57 pm Post subject: |
|
|
very thanks CrazyCat
I just try your code but I always get: "nicktest doesn't seem to be webchat"
maybe a problem in lindex string? |
|
Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1058 Location: France
|
Posted: Sun Nov 28, 2021 1:02 pm Post subject: |
|
|
The command is done to be used on the channel where the target is (I did it quickly).
Just replace:
Code: | if {![onchan $text $chan]} { |
with:
Code: | if {![onchan $text]} { |
and the eggdrop will search for the user in all chans where the eggdrop is. _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
Back to top |
|
 |
geek Halfop
Joined: 24 Oct 2008 Posts: 44
|
Posted: Sun Nov 28, 2021 1:23 pm Post subject: |
|
|
yes I know,
but the problem is in this IF condition:
Code: | if {[catch {[scan [lindex [split $thost @] 0] "%02x%02x%02x%02x" ip1 ip2 ip3 ip4]}]} |
I always get the first statement:
Code: | putserv "PRIVMSG $nick :$text doesn't seem to be webchat" |
|
|
Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1058 Location: France
|
Posted: Sun Nov 28, 2021 7:22 pm Post subject: |
|
|
I'll check the trouble and give an answer soon.
You can try that:
Code: | scan [lindex [split $thost @] 0] "%02x%02x%02x%02x" ip1 ip2 ip3 ip4
if {[catch {putserv "PRIVMSG $nick :$text is $ip1.$ip2.$ip3.$ip4"}]} {
putserv "PRIVMSG $nick :$text doesn't seem to be webchat"
} |
_________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
Back to top |
|
 |
geek Halfop
Joined: 24 Oct 2008 Posts: 44
|
Posted: Mon Nov 29, 2021 3:41 am Post subject: |
|
|
now it works CrazyCat
thank you  |
|
Back to top |
|
 |
digitized Voice
Joined: 04 Sep 2022 Posts: 2
|
Posted: Tue Sep 06, 2022 9:30 am Post subject: webchat ip |
|
|
Hi,
Is it possible that the bot privat message +m and +n users automatically the result of the resolved ip when a users joins the channel, where the bot is in, with a webchat client?
Thank you!l |
|
Back to top |
|
 |
|