| View previous topic :: View next topic |
| Author |
Message |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Tue Nov 17, 2020 12:37 pm Post subject: whois script |
|
|
Hi, if someone can help to change Note with Nickname of the user i do .w user nick
actual code is:
| Code: |
[Whois] Note: is using modes +iowrsxzHtIDRpWG +kcvGnNqSsobDC
|
to be replace in proc whois::multi output msg word Note with user nickname we do in whois command .w nick
| Code: |
[Whois] Guest : is using modes +iowrsxzHtIDRpWG +kcvGnNqSsobDC
|
| Code: |
namespace eval whois {
variable runchans {#test #test1}
variable cmdchar "."
variable command "w"
variable textf "\017\00304"
variable tagf "\017\002"
variable logo "\017\00304\002\[\00306W\00314hois\00304\]\017"
variable lineout "channel users modes topic"
variable channel ""
# setudef flag $whois::command
bind pub -|- [string trimleft $whois::cmdchar]${whois::command} whois::list
bind raw -|- "311" whois::311
bind raw -|- "379" whois::multi
bind raw -|- "378" whois::multi
bind raw -|- "312" whois::312
bind raw -|- "319" whois::319
bind raw -|- "317" whois::317
bind raw -|- "313" whois::multi
bind raw -|- "310" whois::multi
bind raw -|- "335" whois::multi
bind raw -|- "301" whois::301
bind raw -|- "671" whois::multi
bind raw -|- "276" whois::multi
bind raw -|- "320" whois::multi
bind raw -|- "330" whois::multi
bind raw -|- "401" whois::multi
bind raw -|- "318" whois::318
bind raw -|- "307" whois::307
}
proc whois::311 {from key text} {
if {[regexp -- {^[^\s]+\s(.+?)\s(.+?)\s(.+?)\s\*\s\:(.+)$} $text wholematch nick ident host realname]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Host\0036:${whois::textf} \
$nick \(${ident}@${host}\) ${whois::tagf}\00314Realname\0036:${whois::textf} $realname"
}
}
proc whois::multi {from key text} {
if {[regexp {\:(.*)$} $text match $key]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Note\0036:${whois::textf} [subst $$key]"
return 1
}
}
proc whois::312 {from key text} {
regexp {([^\s]+)\s\:} $text match server
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Server\0036:${whois::textf} $server"
}
proc whois::319 {from key text} {
if {[regexp {.+\:(.+)$} $text match channels]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Channels\0036:${whois::textf} $channels"
}
}
proc whois::317 {from key text} {
if {[regexp -- {.*\s(\d+)\s(\d+)\s\:} $text wholematch idle signon]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Connected\0036:${whois::textf} \
[ctime $signon] ${whois::tagf}\00314Idle\0036:${whois::textf} [duration $idle]"
}
}
proc whois::301 {from key text} {
if {[regexp {^.+\s[^\s]+\s\:(.*)$} $text match awaymsg]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Away\0036:${whois::textf} $awaymsg"
}
}
proc whois::318 {from key text} {
namespace eval whois {
variable channel ""
}
variable whois::channel ""
}
proc whois::307 {from key text} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Services\0036:${whois::textf} Registered Nick"
}
proc whois::list {nick host hand chan text} {
if {[lsearch -exact -nocase ${whois::runchans} $chan] > -1} {
namespace eval whois {
variable channel ""
}
variable whois::channel $chan
putserv "WHOIS $text"
}
}
|
|
|
| Back to top |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Tue Nov 17, 2020 9:27 pm Post subject: |
|
|
i fixed but is show the raw 330 twice the nickname is logged as
need to show [Whois] army : is logged in as army
and Line 49: NOTICE: Suspicious variable name "$key"
any help how to fix it
| Code: |
[03:21:12] <~Nasa> [Whois] Host: army (aL@nasa.army) Realname: aL
[03:21:12] <~Nasa> [Whois] army : is using modes +iowrsxzHtIDRpWG +kcvGnNqSsobDC
[03:21:12] <~Nasa> [Whois] army : is connecting from *@ppp147237187052.access.hol.gr 144.237.187.52
[03:21:12] <~Nasa> [Whois] Services: Registered Nick
[03:21:12] <~Nasa> [Whois] Channels: #Test
[03:21:12] <~Nasa> [Whois] Server: irc.test.com
[03:21:12] <~Nasa> [Whois] army : is an IRC Operator (army) [netadmin-with-override]
[03:21:12] <~Nasa> [Whois] army : is using a Secure Connection
[03:21:12] <~Nasa> [Whois] army : has client certificate fingerprint a758f4226e501e1eb3b39126d721cd4737461ccffa9ef199d1369310487886f6
[03:21:12] <~Nasa> [Whois] army : is using an IP with a reputation score of 10000
[03:21:12] <~Nasa> [Whois] army : is a Root Administrator
[03:21:12] <~Nasa> [Whois] army : connected from Greece (GR)
[03:21:12] <~Nasa> [Whois] army army : is logged in as
[03:21:12] <~Nasa> [Whois] Connected: Wed Nov 18 00:22:27 2020 Idle: 0 seconds
|
new fix
| Code: |
namespace eval whois {
variable runchans {#test test1}
variable cmdchar "."
variable command "w"
variable textf "\017\00304"
variable tagf "\017\002"
variable logo "\017\00304\002\[\00306W\00314hois\00304\]\017"
variable lineout "channel users modes topic"
variable channel ""
# setudef flag $whois::command
bind pub -|- [string trimleft $whois::cmdchar]${whois::command} whois::list
bind raw -|- "311" whois::311
bind raw -|- "379" whois::multi
bind raw -|- "378" whois::multi
bind raw -|- "312" whois::312
bind raw -|- "319" whois::319
bind raw -|- "317" whois::317
bind raw -|- "313" whois::multi
bind raw -|- "310" whois::multi
bind raw -|- "335" whois::multi
bind raw -|- "301" whois::301
bind raw -|- "671" whois::multi
bind raw -|- "276" whois::multi
bind raw -|- "320" whois::multi
bind raw -|- "330" whois::multi
bind raw -|- "401" whois::multi
bind raw -|- "318" whois::318
bind raw -|- "307" whois::307
}
proc whois::311 {from key text} {
global whois::channel whois::logo whois::tagf whois::textf
if {[regexp -- {^[^\s]+\s(.+?)\s(.+?)\s(.+?)\s\*\s\:(.+)$} $text wholematch nick ident host realname]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Host\0036:${whois::textf} \
$nick \(${ident}@${host}\) ${whois::tagf}\00314Realname\0036:${whois::textf} $realname"
}
}
proc whois::multi {from key text} {
global whois::channel whois::logo whois::tagf whois::textf
if {[regexp {^[^\s]+\s(.+?):(.*)$} $text match nick $key]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314$nick\0036:${whois::textf} [subst $$key]"
return 1
}
}
proc whois::312 {from key text} {
global whois::channel whois::logo whois::tagf whois::textf
regexp {([^\s]+)\s\:} $text match server
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Server\0036:${whois::textf} $server"
}
proc whois::319 {from key text} {
global whois::channel whois::logo whois::tagf whois::textf
if {[regexp {.+\:(.+)$} $text match channels]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Channels\0036:${whois::textf} $channels"
}
}
proc whois::317 {from key text} {
global whois::channel whois::logo whois::tagf whois::textf
if {[regexp -- {.*\s(\d+)\s(\d+)\s\:} $text wholematch idle signon]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Connected\0036:${whois::textf} \
[ctime $signon] ${whois::tagf}\00314Idle\0036:${whois::textf} [duration $idle]"
}
}
proc whois::301 {from key text} {
global whois::channel whois::logo whois::tagf whois::textf
if {[regexp {^.+\s[^\s]+\s\:(.*)$} $text match awaymsg]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Away\0036:${whois::textf} $awaymsg"
}
}
proc whois::318 {from key text} {
namespace eval whois {
variable channel ""
}
variable whois::channel ""
}
proc whois::307 {from key text} {
global whois::channel whois::logo whois::tagf whois::textf
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Services\0036:${whois::textf} Registered Nick"
}
proc whois::list {nick host hand chan text} {
global whois::runchans
if {[lsearch -exact -nocase ${whois::runchans} $chan] > -1} {
namespace eval whois {
variable channel ""
}
variable whois::channel $chan
putserv "WHOIS $text"
}
}
| [/code] |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Wed Nov 18, 2020 4:08 am Post subject: |
|
|
You have an error in your line 49, it must be:
| Code: | | if {[regexp {^[^\s]+\s(.+?):(.*)$} $text match nick key]} { |
(bad idea to override the $key received in the procedure)
Concerning your raw which is not well displayed, you can debug it by adding a $key in your putserv to know which raw is concerned, and potentialy change the way you parse this particular raw. _________________ 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 |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Wed Nov 18, 2020 4:50 am Post subject: hi |
|
|
Morning CrazyCat thx for ur responde and ur explain
Now errors dont have but is show this raw 330 wrong way
raw330 wrong output
| Code: |
[Whois] army army : is logged in as
|
need to show this way
| Code: |
[Whois] army : is logged in as army
|
| Code: |
bind raw -|- "330" whois::multi
proc whois::multi {from key text} {
global whois::channel whois::logo whois::tagf whois::textf
if {[regexp {^[^\s]+\s(.+?):(.*)$} $text match nick key]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314$nick\0036:${whois::textf} [subst $key]"
return 1
}
}
|
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Wed Nov 18, 2020 5:54 am Post subject: |
|
|
You didn't look how server send its response. Have a look at https://www.alien.net.au/irc/irc2numerics.html
$text contains "dest nick authname info", so you can change your regexp to:
| Code: | | regexp {^[^\s]+\s([^\s]+)\s(.+):(.*)$} $who match nick authname info |
And your message will be:
| Code: | | putserv "PRIVMSG $whois::channel :$nick $info $authname" |
_________________ 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 |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Wed Nov 18, 2020 6:09 am Post subject: |
|
|
| Code: |
bind raw -|- "330" whois::multi
proc whois::multi {from key text} {
global whois::channel
if {[regexp {^[^\s]+\s([^\s]+)\s(.+):(.*)$} $who match nick authname info]} {
putserv "PRIVMSG $whois::channel :$nick $info $authname"
return 1
}
}
|
i replace what u say and is give me this error now
| Code: |
Tcl error [whois::multi]: can't read "who": no such variable
|
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
|
| Back to top |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Wed Nov 18, 2020 6:23 am Post subject: hi |
|
|
| ok thx |
|
| Back to top |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Wed Nov 18, 2020 3:19 pm Post subject: |
|
|
When i replace $key with key and $$key with $key in proc whois::multi
is give me this error:
[Whois] army : is an IRC Operator (army) [netadmin-with-override]
raw 313 army :is an IRC Operator (army) [netadmin-with-override]
| Code: |
Tcl error [whois::multi]: invalid command name "netadmin-with-override"
|
actual code
| Code: |
namespace eval whois {
variable runchans {#shqiperia}
variable cmdchar "."
variable command "w"
variable textf "\017\00304"
variable tagf "\017\002"
variable logo "\017\00304\002\[\00306W\00314hois\00304\]\017"
variable lineout "channel users modes topic"
variable channel ""
# setudef flag $whois::command
bind pub -|- [string trimleft $whois::cmdchar]${whois::command} whois::list
bind raw -|- "311" whois::311
bind raw -|- "379" whois::multi
bind raw -|- "378" whois::multi
bind raw -|- "312" whois::312
bind raw -|- "319" whois::319
bind raw -|- "317" whois::317
bind raw -|- "313" whois::multi
bind raw -|- "310" whois::multi
bind raw -|- "335" whois::multi
bind raw -|- "301" whois::301
bind raw -|- "671" whois::multi
bind raw -|- "276" whois::multi
bind raw -|- "320" whois::multi
bind raw -|- "330" whois::330
bind raw -|- "401" whois::multi
bind raw -|- "318" whois::318
bind raw -|- "307" whois::307
}
proc whois::311 {from key text} {
global whois::channel whois::logo whois::tagf whois::textf
if {[regexp -- {^[^\s]+\s(.+?)\s(.+?)\s(.+?)\s\*\s\:(.+)$} $text wholematch nick ident host realname]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Host\0036:${whois::textf} \
$nick \(${ident}@${host}\) ${whois::tagf}\00314Realname\0036:${whois::textf} $realname"
}
}
proc whois::multi {from key text} {
global whois::channel whois::logo whois::tagf whois::textf
if {[regexp {^[^\s]+\s(.+?):(.*)$} $text match nick key]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314$nick\0036: ${whois::textf} [subst $key]"
return 1
}
}
proc whois::312 {from key text} {
global whois::channel whois::logo whois::tagf whois::textf
regexp {([^\s]+)\s\:} $text match server
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Server\0036:${whois::textf} $server"
}
proc whois::319 {from key text} {
global whois::channel whois::logo whois::tagf whois::textf
if {[regexp {.+\:(.+)$} $text match channels]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Channels\0036:${whois::textf} $channels"
}
}
proc whois::317 {from key text} {
global whois::channel whois::logo whois::tagf whois::textf
if {[regexp -- {.*\s(\d+)\s(\d+)\s\:} $text wholematch idle signon]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Connected\0036:${whois::textf} \
[ctime $signon] ${whois::tagf}\00314Idle\0036:${whois::textf} [duration $idle]"
}
}
proc whois::330 {from key text} {
global whois::channel whois::logo
if {[regexp {^[^\s]+\s([^\s]+)\s(.+):(.*)$} $text match nick authname info]} {
putserv "PRIVMSG $whois::channel :${whois::logo} \002\00314$nick\002 \0036: \0034$info \00314$authname"
return 1
}
}
proc whois::301 {from key text} {
global whois::channel whois::logo whois::tagf whois::textf
if {[regexp {^.+\s[^\s]+\s\:(.*)$} $text match awaymsg]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Away\0036:${whois::textf} $awaymsg"
}
}
proc whois::318 {from key text} {
namespace eval whois {
variable channel ""
}
variable whois::channel ""
}
proc whois::307 {from key text} {
global whois::channel whois::logo whois::tagf whois::textf
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}\00314Services\0036:${whois::textf} Registered Nick"
}
proc whois::list {nick host hand chan text} {
global whois::runchans
if {[lsearch -exact -nocase ${whois::runchans} $chan] > -1} {
namespace eval whois {
variable channel ""
}
variable whois::channel $chan
putserv "WHOIS $text"
}
}
|
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Wed Nov 18, 2020 7:07 pm Post subject: |
|
|
What is the interest of your [subst $key] in your putserv ? Do you know what it does ?
And nothing is disturbing you in your proc whois:multi ? This proc receive key as argument (quite normal) and key is redefined by your regexp... _________________ 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 |
|
 |
|