mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2004
Posts: 2,002
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,002
Apparently it's part of the IRCv3 specs that it's righteous for the server to keep sending you the @time server-time tag as part of the message-tags 'capability' in spite of having requested that the server-time capability be disabled. And the only way to keep from having other people's #channel messages showing timestamps from a different clock than your own messages is to disable message tags completely.

I'm finding this happening at both ircd test servers ...

irc.unrealircd.org
testnet.inspircd.org

... and everyone insists that they're faithfully following the IRCv3 specs, and they claim my client is broken.

Apparently, even though you can request that server time not be sent to you by "/raw CAP REQ -server-time", if the server has message-tags 'capability' enabled, the specs considers that it's righteous for the server to send the @time=servertime tag along with the @msgid and other tags, and that my client is broken because it's supposed to be my client's job to not use the server-time tag if it didn't request it. They were not impressed when I countered that they shouldn't ACK the -server-time and take it off my CAP LIST yet still send it at me, and that the client gives the user the ability to request and un-request things on its own, and that if the tag comes in, that the client assumes that the script must've requested it, because why else would the server be sending it?

So either mIRC will need to start snooping at all /parseline and /raw strings to see if the user tried to disable server-time, or there needs to be some kind of command that can be used in scripts or perform-on-connect to tell mIRC itself to ignore the @time tag being attached to incoming IRCv3 @tag strings.

Or, the only way to disable timestamps using a different clock depending on whether it's me vs everyone else, is to script something with ON PARSELINE:in: to intercept incoming messages to strip out the @time= tag or edit it into being the meaningless @zime= tag.

I tried to find out which other settings besides server-time would have this similar issue, where something is an a-la-carte thing that's LS-listed separately which you can decline, but is still put on your plate as part of the message-tags combo platter, but couldn't get an answer for that. Nor could I get an answer for why someone who had disabled the server-time capability would still want to receive them as part of message-tags.

Joined: Dec 2002
Posts: 245
T
Fjord artisan
Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 245
I second this feature!

For the time being, here's a scripted fix to maintain a global variable per CID of enabled features, and substitue time= by formatting $gmt if 'server-time' is NOT within the list of 'capabilities' which "should" in theory fix the timestamp in the past/future issue when server time isn't the same as your own. mIRC's internal time features like $gmt and $ctime I believe are all based by your system's clock.

Code
on *:START: { unset $+(%,ircv3.*) }
on *:EXIT: { unset $+(%,ircv3.*) }
on *:DISCONNECT: { unset $+(%,ircv3,.,$cid) }

raw CAP:*: {
  var %Cap = $var($+(%,ircv3,.,$cid),1).value , %Type = $2
  tokenize 32 $3-
  if (%Type = LS) { }
  elseif (%Type = ACK || %Type = NAK) { 
    while ($0) {
      if (-* iswm $1) { var %Cap = $remtok(%Cap,$mid($1,2),1,32) }
      else if (%Type = NAK) { var %Cap = $remtok(%Cap,$1,1,32) }
      else { var %Cap = $addtok(%Cap,$1,32) }
      tokenize 32 $2-
    }
    set $+(%,ircv3.,$cid) %Cap
  }
}

on *:PARSELINE:in:*:{
  var %pl = $parseline
  if ($parseutf) { var %pl = $utfdecode(%pl) }

  ; Replace time= tag with our own localtime if we do not have server-time CAP
  if (!$istok($var($+(%,ircv3,.,$cid),1).value,server-time,32)) { var %pl = $regsubex(%pl,/(^@(?:[^ ]+)?time=)([^ \x3b]+)/,\1 $+ $replace($asctime($gmt,yyyy-mm-dd!HH:nn:ss),!,T) $+ Z) }

  .parseline -itu0 %pl
  return
}

Here's an example of Debug output, testing on a local version of UnrealIRCd, turned on echo message to see the return result
Note: the only "Notable" difference here is the loss of milliseconds but as far as I can tell this doesn't affect anything.
Code
-> irc.example.org @label=0 PRIVMSG #Talon :moo?
<- @label=0;msgid=ewAqCDBZHDZZtQgRW6uI1O;time=2022-12-02T05:25:59.722Z :Talon!Talon@localhost PRIVMSG #Talon :moo?
-> irc.example.org CAP REQ :-server-time
<- :irc.example.org CAP Talon ACK :-server-time
-> irc.example.org @label=0 PRIVMSG #Talon :moo again?
<- @label=0;msgid=fgDLXYglqvS8ExDLALLY95;time=2022-12-02T05:26:21Z :Talon!Talon@localhost PRIVMSG #Talon :moo again?


Link Copied to Clipboard