Project

General

Profile

Actions

Bug #5792

closed

$target value of privatemessage event is not consistent with channelmessage event

Added by Rei Hakurei 4 months ago. Updated 3 months ago.

Status:
Invalid
Priority:
Normal
Assignee:
Category:
Scripting
Target version:
Start date:
01/13/2024
Due date:
% Done:

0%

Estimated time:
Operative System:
All
Regression:
Yes

Description

I just updated to v4.4 recently, Previously on v3.9 this piece of snippet works correctly.

  if (%ispm) { echo -tfmc %mode $target %nickfmt %msg }
  elseif (%check_hl) { echo -tlmc %mode $target %nickfmt %msg }
  else { echo -tmc %mode $target %nickfmt %msg }

It's a script to check whether I have to ignore an highlight via custom pattern, reformat nick color to match the server's classic coloring output, and filter unwanted words/lines from message.

However as I updated, the script ON TEXT ($chan == $null) now uses $target of my own nickname instead the sender's $nick.
A temporary solution that I made for v4.4 is changing the $target on %ispm condition into $nick into this.

  if (%ispm) { echo -tfmc %mode $nick %nickfmt %msg }
  elseif (%check_hl) { echo -tlmc %mode $target %nickfmt %msg }
  else { echo -tmc %mode $target %nickfmt %msg }

Current behavior of v4.4 bugged output:

[07:37:25] <Rei_Hakurei> faq osr
[07:37:26] Rei_Hakurei <BanchoBot> Entry not found!

Expected behavior (from v3.9) output:

[07:37:25] <Rei_Hakurei> faq osr
[07:37:26] <BanchoBot> Entry not found!

Actions #1

Updated by Per Amundsen 3 months ago

  • Status changed from New to Invalid
  • Target version set to 4.5

This is the correct behavior, the $target is you and the $nick is the sender. The previous behavior was wrong and fixed in 4.1.

You can verify this by testing in mirc with:

on *:TEXT:*:?:echo -s target is $target

I'm not sure exactly what you are trying to do, but you can determine if the target is a channel with:

if ($target ischan) {
  echo -ag $nick said $1- in a channel named $target
}
else {
  echo -ag $nick said $1- in a private message to $me
}

You can also check if ($target == $me)

Actions

Also available in: Atom PDF