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.

sign in time missing in whois script

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
F
Fraud
Op
Posts: 101
Joined: Mon May 19, 2008 7:57 am

sign in time missing in whois script

Post by Fraud »

Hello. I found an old whois script but idletime is not working. Hope u cna help me. Thanks in advance

Tcl error [whois:idle]: wrong # args: should be "set varName ?newValue?"

Code: Select all

bind pub $whois(acc) ".whois" whois:nick

	proc whois:nick { nickname hostname handle channel arguments } {
	global whois
      set target [lindex [split $arguments] 0]
	if {$target == ""} {
	putquick "PRIVMSG $channel :Please choose a target first."
	return 0
	}
	if {[string length $target] >= "14"} {
	putquick "PRIVMSG $channel :Sorry, That nickname is too long. Please try a user with less than 14 characters."; return
	}
	if {[regexp -all -- {[~\[\]\{\}\|\_\\]} $target]} {
	putquick "PRIVMSG $channel :Sorry, I can't whois a user with special characters in it."; return
	}
	putquick "WHOIS $target $target"
      set ::whoischannel $channel
	set ::whoistarget $target
	bind RAW - 401 whois:nosuch
	bind RAW - 311 whois:info
	bind RAW - 319 whois:channels
	bind RAW - 301 whois:away
	bind RAW - 313 whois:ircop
	bind RAW - 330 whois:auth
	bind RAW - 317 whois:idle
	}

	proc whois:putmsg { channel arguments } {
		putquick "PRIVMSG $channel :$arguments"
	}

	proc whois:info { from keyword arguments } {
		set channel $::whoischannel
		set nickname [lindex [split $arguments] 1]
		set ident [lindex [split $arguments] 2]
		set host [lindex [split $arguments] 3]
		set realname [string range [join [lrange $arguments 5 end]] 1 end]
		whois:putmsg $channel "$nickname - $ident@$host * $realname"
		unbind RAW - 311 whois:info
	}

	proc whois:ircop { from keyword arguments } {
		set channel $::whoischannel
		set target $::whoistarget
		whois:putmsg $channel "$target is an IRC Operator"
		unbind RAW - 313 whois:ircop
	}

	proc whois:away { from keyword arguments } {
		set channel $::whoischannel
		set target $::whoistarget
		set awaymessage [string range [join [lrange $arguments 2 end]] 1 end]
		whois:putmsg $channel "$target ist away: $awaymessage"
		unbind RAW - 301 whois:away
	}

	proc whois:channels { from keyword arguments } {
		set channel $::whoischannel
		set channels [string range [join [lrange $arguments 2 end]] 1 end]
		set target $::whoistarget
		whois:putmsg $channel "$target in $channels"
		unbind RAW - 319 whois:channels
	}

	proc whois:auth { from keyword arguments } {
		set channel $::whoischannel
		set target $::whoistarget
		set authname [lindex [split $arguments] 2]
		whois:putmsg $channel "$target ist geauthed als $authname"
		unbind RAW - 330 whois:auth
	}

	proc whois:nosuch { from keyword arguments } {
		set channel $::whoischannel
		set target $::whoistarget
		whois:putmsg $channel "Nickname nicht gefunden \"$target\""
		unbind RAW - 401 whois:nosuch
	}

	proc whois:idle { from keyword arguments } {
		set channel $::whoischannel
		set target $::whoistarget
		set idletime [lindex [split $arguments] 2]
		set signon [lindex [split $arguments] 3]
		set zeitdiff [unixtime] - $signon
		whois:putmsg $channel "$target has been idle for [duration $idletime]. signon time [ctime $signon] $zeitdiff"
		unbind RAW - 317 whois:idle
	}
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Code: Select all

set zeitdiff [unixtime] - $signon
should be

Code: Select all

set zeitdiff [expr {[unixtime]-$signon}]
Have you ever read "The Manual"?
F
Fraud
Op
Posts: 101
Joined: Mon May 19, 2008 7:57 am

Post by Fraud »

Thanks works but the output is bit strange

Output:
has been idle for 2 hours 1 minute 16 seconds. signon time Mon Dec 15 16:15:21 2008 169840

Is it possible to get the signon time like signed on 21mins 6secs ago?

Thank u
Post Reply