egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

webchat converter

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
geek
Halfop


Joined: 24 Oct 2008
Posts: 44

PostPosted: Sun Nov 28, 2021 6:02 am    Post subject: webchat converter Reply with quote

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
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1058
Location: France

PostPosted: Sun Nov 28, 2021 11:20 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
geek
Halfop


Joined: 24 Oct 2008
Posts: 44

PostPosted: Sun Nov 28, 2021 12:57 pm    Post subject: Reply with quote

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
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1058
Location: France

PostPosted: Sun Nov 28, 2021 1:02 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
geek
Halfop


Joined: 24 Oct 2008
Posts: 44

PostPosted: Sun Nov 28, 2021 1:23 pm    Post subject: Reply with quote

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
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1058
Location: France

PostPosted: Sun Nov 28, 2021 7:22 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
geek
Halfop


Joined: 24 Oct 2008
Posts: 44

PostPosted: Mon Nov 29, 2021 3:41 am    Post subject: Reply with quote

now it works CrazyCat

thank you Wink
Back to top
View user's profile Send private message
digitized
Voice


Joined: 04 Sep 2022
Posts: 2

PostPosted: Tue Sep 06, 2022 9:30 am    Post subject: webchat ip Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber