ElectronicWar / nbs-irc

Fork of latest nbs-irc code to add support for various modern mIRC features
MIT License
21 stars 3 forks source link

Incompatibility with other scripts #17

Open Sophist-UK opened 6 years ago

Sophist-UK commented 6 years ago

I am responsible for maintaining another mIRC script, dlFilter, designed to filter out adverts and other people's triggers from file sharing channels.

nbs-irc is incompatible with this script because nbs-irc is called on every IRC message and then haltdefs and explicitly echos every message regardless of whether this is needed for specific nbs-irc functionality. dlFilter also does something similar, but only when it is needed to stop messages from being shown or to send them to a different window than mIRC's default, and this is what makes them incompatible.

When dlFilter runs first, nbs-irc does not respect that dlFilter has halted specific messages and still echos them - in this situation nbs-irc's ON events should use the "&" prefix so that they are NOT run if a previous script has halted them and should only echo them if $halted is false.

When dlFilter runs last and wants to stop a message from being displayed, it notes that the messages have been halted, but cannot stop them displaying because nbs-irc echos them directly.

I would like to recommend three changes for how nbs-irc processes messages:

  1. Make the ON events specific to the messages that you need to process to deliver specific functionality and not run on messages not needed for nbs-irc functioning. Split generic routines like ON NOTICE which then check message content into separate ON NOTICE routines for each type of content e.g. have a separate ON me:^*:notice:lag437289 *:?: rather than test with if ($nick == $me) && ($1 == lag437289) this inside a generic on ^*:notice:*:*: which runs on every channel and private notice;

  2. Only haltdef messages when necessary to hide them or redirect them to a different window. Before echoing these messages check $halted and only echo if $halted == $false; and

  3. Prefix your ON events with "&" unless you specifically need to process them (e.g. as responses to requests you have made) in order to respect haltdef of any scripts which run before. Note: This is equivalent to the existing code ìf ($halted) return` that is the first statement in many existing ON events.

I hope that by working on this together we can make our scripts compatible with one another.

ElectronicWar commented 6 years ago

Thank you very much for the detailed issue report.

Although this project is very far down on my priorities at the moment I'd like to at least provide basic compatibility with dlFilter in a timely manner for your users. I might need to poke you during development if it's OK.

Sophist-UK commented 6 years ago

Sure.

If I used nbs-irc myself I would submit a PR, but I don't.

But happy to provide advice.

ElectronicWar commented 6 years ago

Related issue: DukeLupus/dlFilter#44