This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

webchat converter

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
g
geek
Halfop
Posts: 47
Joined: Fri Oct 24, 2008 6:07 am

webchat converter

Post by geek »

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: Select all

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: Select all

   => 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.
User avatar
CrazyCat
Revered One
Posts: 1304
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Quite simple :

Code: Select all

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.
g
geek
Halfop
Posts: 47
Joined: Fri Oct 24, 2008 6:07 am

Post by geek »

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?
User avatar
CrazyCat
Revered One
Posts: 1304
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

The command is done to be used on the channel where the target is (I did it quickly).
Just replace:

Code: Select all

if {![onchan $text $chan]} { 
with:

Code: Select all

if {![onchan $text]} { 
and the eggdrop will search for the user in all chans where the eggdrop is.
g
geek
Halfop
Posts: 47
Joined: Fri Oct 24, 2008 6:07 am

Post by geek »

yes I know,

but the problem is in this IF condition:

Code: Select all

if {[catch {[scan [lindex [split $thost @] 0] "%02x%02x%02x%02x" ip1 ip2 ip3 ip4]}]}
I always get the first statement:

Code: Select all

putserv "PRIVMSG $nick :$text doesn't seem to be webchat"
User avatar
CrazyCat
Revered One
Posts: 1304
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

I'll check the trouble and give an answer soon.

You can try that:

Code: Select all

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" 
}
g
geek
Halfop
Posts: 47
Joined: Fri Oct 24, 2008 6:07 am

Post by geek »

now it works CrazyCat

thank you :wink:
d
digitized
Voice
Posts: 2
Joined: Sun Sep 04, 2022 11:10 am

webchat ip

Post by digitized »

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
Post Reply