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.

whois script

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
G
Gulio
Halfop
Posts: 73
Joined: Sun Nov 01, 2020 11:53 am

whois script

Post by Gulio »

Hi, if someone can help to change Note with Nickname of the user i do .w user nick

actual code is:

Code: Select all

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

[Whois] Guest : is using modes +iowrsxzHtIDRpWG +kcvGnNqSsobDC

Code: Select all


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"
  }
}


G
Gulio
Halfop
Posts: 73
Joined: Sun Nov 01, 2020 11:53 am

Post by Gulio »

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


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


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

Post by CrazyCat »

You have an error in your line 49, it must be:

Code: Select all

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.
G
Gulio
Halfop
Posts: 73
Joined: Sun Nov 01, 2020 11:53 am

hi

Post by Gulio »

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

[Whois] army army : is logged in as
need to show this way

Code: Select all

[Whois] army : is logged in as army

Code: Select all

   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
   }
}

Online
User avatar
CrazyCat
Revered One
Posts: 1216
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

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

regexp {^[^\s]+\s([^\s]+)\s(.+):(.*)$} $who match nick authname info
And your message will be:

Code: Select all

putserv "PRIVMSG $whois::channel :$nick $info $authname"
G
Gulio
Halfop
Posts: 73
Joined: Sun Nov 01, 2020 11:53 am

Post by Gulio »

Code: Select all


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


Tcl error [whois::multi]: can't read "who": no such variable

Online
User avatar
CrazyCat
Revered One
Posts: 1216
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

sorry, $who was my test string, you have to use $text.
Don't copy without trying to understand what you do.
G
Gulio
Halfop
Posts: 73
Joined: Sun Nov 01, 2020 11:53 am

hi

Post by Gulio »

ok thx
G
Gulio
Halfop
Posts: 73
Joined: Sun Nov 01, 2020 11:53 am

Post by Gulio »

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


Tcl error [whois::multi]: invalid command name "netadmin-with-override"


actual code

Code: Select all

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

Post by CrazyCat »

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