How to make mIRC compatible with ZNC’s znc.in/self-message CAP

I use three IRC clients with my ZNC bouncer: Textual on Mac, The Lounge for quick IRC access from any web browser including my phone and mIRC on my Windows PC. I am also using the clientbuffer znc module so backlog is saved for every client individually, so I get the whole backlog on each client, including queries.

There was just one issue: While The Lounge and Textual natively support the znc.in/self-message CAP, mIRC doesn’t. This means that ZNC does not forward query messages you send to someone else to your mIRC because mIRC doesn’t tell ZNC that it knows how to handle these messages.

This means that whenever I had a query conversation with someone on, say Textual, I could see the whole conversation in The Lounge too, but on mIRC I could only see the messages sent by my conversation partner, not my own.

To fix this in mIRC, this is what you have to do: Open your remote editor (Alt+R), create a new empty script if necessary (file->new) and put the following:

  1. ; request the self-message CAP when it's available
  2. raw CAP:*LS*znc.in/self-message*:{ .raw CAP REQ :znc.in/self-message }
  3.  
  4. ; Process all private messages delivered to $me for which $me is not the 
  5. ; target/recipient AND when no window for $me exists.
  6. on ^*:OPEN:?:{
  7.   if ($target != $me) {
  8.     ; Make sure we have a query window to print to.
  9.     if (!$window($target)) { query $target }
  10.     ; Print message with proper formatting after checking if it's an ACTION.
  11.     if ($gettok($rawmsg,4,32) == : $+ $chr(1) $+ ACTION) {
  12.       echo $color(own text) -bfmt $+ $msgstamp $target * $nick $1-
  13.     }
  14.     else { echo $color(own text) -bfmt $+ $msgstamp $target < $+ $nick $+ > $1- }
  15.  
  16.     ; Halt further processing.
  17.     haltdef
  18.   }
  19. }
  20.  
  21. ; Process all private messages delivered to $me for which $me is not the 
  22. ; target/recipient AND when a window for $me exists.
  23. on ^*:TEXT:*:?:{
  24.   if ($target != $me) {
  25.     ; Make sure we have a query window to print to.
  26.     if (!$window($target)) { query $target }
  27.     ; Print message with proper formatting after checking if it's an ACTION.
  28.     if ($gettok($rawmsg,4,32) == : $+ $chr(1) $+ ACTION) {
  29.       echo $color(own text) -bfmt $+ $msgstamp $target * $nick $1-
  30.     }
  31.     else { echo $color(own text) -bfmt $+ $msgstamp $target < $+ $nick $+ > $1- }
  32.     ; Halt further processing.
  33.     haltdef
  34.   }
  35. }

Then click OK and restart mIRC.

I found this lovely piece of code in a post by mouse in the mIRC forums.

1 Comment

  1. Thank you sooooo much!!! I have been looking for a solution for this for a very long time!

Leave a Reply