mIRC Home    About    Download    Register    News    Help

Print Thread
V
Velouria
Velouria
V
We have an eggdrop bot on channel, and when I do '!ping', mIRC fails to respond to it. Bug occurrs in 6.16, 6.17 and even 5.91 (!)

From a packet dump in Ethereal:

PRIVMSG #urban75 :!ping
:e911!e911@B1CACD66.59D62548.C9984D92.IP PRIVMSG Test591 :.PING -1481841805.

No reply is ever sent by mIRC.

Using the JPilot web client, if I do the same ...

PRIVMSG #urban75 :!ping
:e911!e911@B1CACD66.59D62548.C9984D92.IP PRIVMSG Veltesting :.PING -1481183949.
NOTICE e911 :.PING -1481183949.
:e911!e911@B1CACD66.59D62548.C9984D92.IP PRIVMSG #urban75 :e911 -> Veltesting -> e911 == 1218 ms

The CTCP specifications (such as they are, at http://www.invlogic.com/irc/ctcp.html) say:

4.2 PING <space> <arg> (required)

This request is intended to determine the round trip time of a message from the initiator to the recipient and back to the initiator. The precipient is required to return a duplicate of the received argument without modification. Each client will define its own format for the 16 byte argument. Requests with arguments longer than 16 characters should be silently dropped.

The reply will be formatted as:

<marker> PONG <space> <arg> <marker>

Various clients include the ability to run scripts which may choose to receive and reply to this request. At no time should any such script be permitted to filter the request from the client's internal handling, and as such, a client is REQUIRED to produce its own PONG response, subject to flood control.


Am I correct in thinking this is a bug in mIRC?

mIRC also violates the two parts of this standard which I've put in bold, although the second violation is actually a handy feature rather than a bug imho smile

Edit to add:

[16:09] -> [e911] VERSION
[16:09] [e911 VERSION reply]: eggdrop v1.6.17

Last edited by Velouria; 26/02/06 05:04 PM.
Joined: Jan 2003
Posts: 2,125
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,125
Indeed, mirc doesn't send a reply if the argument doesn't start with a digit.

On a sidenote, your link has a typo, the ) is included in the url. Also, the ctcp draft on that page isn't the original draft compiled by Klaus Zeuge and revised by Ben Mesander, assuming that mirc adheres to the latter. It certainly doesn't adhere to the former, as there is no irc client (including mirc) that sends a ctcp PONG reply after receiving a ctcp ping. There also other differences in it. This has nothing to do with the issue you reported, I just think you should've quoted the original draft, as it's the one with most "followers".

V
Velouria
Velouria
V
I have edited the link. It was the fault of the forum software ... :tongue:

The link I posted is the one that comes up first on a Google search for 'irc ctcp' ...

Notwithstanding that, I read the *other* document, and it says:

PING
====
Ping is used to measure the time delay between clients on the IRC
network. A ping query is encoded in a privmsg, and has the form:

\001PING timestamp\001

where `timestamp' is the current time encoded in any form the querying
client finds convienent
. The replying client sends back an identical
message inside a notice:

\001PING timestamp\001

The querying client can then subtract the recieved timestamp from the
current time to obtain the delay between clients over the IRC network.


Note the section in bold.

Neither of the specifications say the timestamp must be a positive integer, which is what mIRC is assuming. It could just as well be 'BLAHBLAH' by either of those standards. It's up to the client how it sends the timestamp, and how it interprets the reply.

Joined: Jan 2003
Posts: 2,125
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,125
As mentioned in my previous post, mirc doens't accept only positive integers, it accepts anything that starts with a digit (eg "1sdf-23#$@" is fine). In any case, this is a violation of the draft that mirc (most probably) adheres to in general; what remains to be seen is whether this is intentional.

V
Velouria
Velouria
V
Been speaking to the services op and looking into the problem. The reason it is sending a negative timestamp in the first place is due to a limitation of Tcl:

Quote:
# ping.tcl
# Makes the eggdrop PING the requestor and displays the results.
# By Pistos - irc.freenode.net#geoshell

# Usage:
# !ping

set ping_min_delay 15000

bind pub - !ping ping
bind ctcr - PING ping_received

proc ping {nick uhost handle chan arg} {
global ping_time ping_channel ping_min_delay

set ms [clock clicks -milliseconds]
if {[info exists ping_time($nick)]} {
if {[expr $ms - $ping_time($nick)] < $ping_min_delay} {
putserv "NOTICE $nick :You just requested a ping. Try again later."
return
}
}
set ping_time($nick) $ms
set ping_channel $chan

putserv "PRIVMSG $nick :\001PING $ping_time($nick)\001";

}

proc ping_received {nick uhost handle {dest ""} keyword text} {
global botnick ping_time ping_channel
if {$dest == ""} {set dest $botnick}

if {$dest == $botnick} {
set ms [clock clicks -milliseconds]
set difference [expr $ms - $ping_time($nick)]
putserv "PRIVMSG $ping_channel :$botnick -> $nick -> $botnick == $difference ms"
}
}

putlog "ping.tcl loaded"


And looking at http://www.tcl.tk/cgi-bin/tct/tip/124.html :

Proposed change

This TIP proposes two changes to clock clicks to make it more useful in situations where absolute times are needed:

1. Change clock clicks -milliseconds to return a wide integer, representing the number of milliseconds since the Posix epoch.


SO the problem stems from a bug in Tcl ... however, mIRC should still honour the requests according to the specifications.

V
Velouria
Velouria
V
[18:41] <Velouria> BTW the easiest answer to the !ping problem is: reboot the server wink
[18:41] <Velouria> From the TCL manpage, http://www.tcl.tk/man/tcl8.4/TclCmd/clock.htm#M5
[18:41] <Velouria> clock clicks ?-milliseconds?
[18:41] <Velouria> Return a high-resolution time value as a system-dependent integer value. The unit of the value is system-dependent but should be the highest resolution clock available on the system such as a CPU cycle counter.
[18:42] <Velouria> Server Up 537 days, 7:30:46
[18:42] <Velouria> -
[18:42] <Velouria> Highest connection count: 33 (32 clients)
[18:42] <Velouria> -
[18:42] <Velouria> End of /STATS report

So - have conclusively traced the root of the problem I'm seeing - but imho it's still an mIRC bug.


Link Copied to Clipboard