on channel_nick
Synopsis
/on [<noise>]channel_nick "<pattern>" [(<argument list>)] { <commands> }
Description
Triggered each time someone, including you, changes nickname while recorded on one of your channels. If you share several channels with that person, EPIC generates one event for each matching channel on the receiving server. The event depends on the client's channel membership records; a nickname change with no matching channel produces no channel_nick event.
This event processes an incoming server nick message. Merely issuing nick does not trigger it before the server accepts the change. Use the standard on pattern and noise controls; the pattern matches all three fields below together. There are no event-specific options.
Parameters
| Parameter | Meaning |
|---|---|
$0 |
Channel shared with the person changing nickname. |
$1 |
Old nickname. |
$2 |
New nickname. |
EPIC updates its own server nickname before invoking these hooks for your change. Channel nickname lists are renamed after the channel hooks and any subsequent nickname hook run.
Default behavior
This event has no direct built-in display. After running all channel events for a nickname change, EPIC generates one on nickname event only if none of the channel events suppressed default handling. If that event also permits default handling, EPIC prints oldnick is now known as newnick with its usual message prefix.
Suppressing a single channel event prevents the later nickname event and its built-in line for the whole change, but does not prevent the remaining channel events or the internal nickname update. If no channel event was generated, the nickname event can still run. The channel event's output context uses the shared channel and the nick message level; replacement output from a hook is therefore associated with that context unless the script overrides it.
Example
Distinguish your own nickname changes from other people's changes while supplying replacement output:
on ^channel_nick * (chan, oldnick, newnick) {
if (newnick == serverctl(get -1 nickname)) {
xecho -b You have changed nicks to $newnick;
} else if (iscurchan($chan)) {
xecho -b $oldnick has changed nicks to $newnick;
} else {
xecho -b $oldnick has changed nicks to $newnick on $chan;
};
};
Your own change can print once per shared channel too. Use on nickname instead when one notification per nickname change is desired, and ensure channel hooks allow that event to run.
History
This event already existed in ircII.
Source references
source/parse.c:p_nickupdates your server nickname, invokes per-channel hooks, conditionally invokesnickname, and then renames channel nicknames.source/names.c:walk_channelsfinds channels containing the old nickname;rename_nickupdates their nickname lists.source/server.c:accept_server_nicknamerecords your accepted nickname.source/hook.c: event registration anddo_hookimplement standard matching and suppression.