mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 2 1 2
Re: on open ? behavior [Re: argv0] #227549 14/11/10 02:23 AM
Joined: Feb 2006
Posts: 181
C
Crinul Offline
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2006
Posts: 181
Originally Posted By: argv0
Sorry, no, I don't acknowledge this as more common. You're using workarounds to make things work when they should not-- ie. a /timer to make $input work even though mIRC does not allow modal dialogs in events (for a very good reason). Let these scripts break.


You can make a 'PM / Query Blocker' script without using $input.
You can check (hash table, text file, access level, variables) and depending on result: close query, ignore nick, send message.

Not common?

Re: on open ? behavior [Re: Crinul] #227550 14/11/10 02:52 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Query blockers are common (I provided 2 simple examples myself), don't misquote me. Query blockers in the form provided by jaytea are not. Most are setup to specifically block certain names or message patterns beforehand. As I mentioned, these specific types of scripts would not be affected by the change.

The only ones that would be are those that arbitrarily block nicknames based on modal user input (an invalid case, as I mentioned), or flood control scripts. For flood control, there are alternatives out there (like mIRC's builtin flood control), and worst case scenario is that you accidentally trip your flood control with /query, so it's not a huge incompatibility.

Also, given how *common* query blockers are, how easy they are to script, and how many alternatives are available (server-side ignore, /ignore, mIRC flood control, etc.), breaking a few of these scripts becomes less of a big deal. At least in this case, users have alternatives, and the simplicity of these scripts (they all seem to be < 100 lines of code) means it is trivial to fix them.

Progress should not be stunted simply for backwards compatibility's sake. There's more to the argument than "scripts will break"-- part of the question is: "how bad will it be if they break?". In this case, not so bad.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: on open ? behavior [Re: argv0] #227551 14/11/10 04:09 AM
Joined: Feb 2006
Posts: 181
C
Crinul Offline
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2006
Posts: 181
Originally Posted By: argv0
Sorry, no, I don't acknowledge this as more common.

I thought you meant scripts like that, query blocker scripts.

Originally Posted By: argv0
The only ones that would be are those that arbitrarily block nicknames based on modal user input (an invalid case, as I mentioned), or flood control scripts. For flood control, there are alternatives out there (like mIRC's builtin flood control), and worst case scenario is that you accidentally trip your flood control with /query, so it's not a huge incompatibility.

Also, given how *common* query blockers are, how easy they are to script, and how many alternatives are available (server-side ignore, /ignore, mIRC flood control, etc.), breaking a few of these scripts becomes less of a big deal. At least in this case, users have alternatives, and the simplicity of these scripts (they all seem to be < 100 lines of code) means it is trivial to fix them.


This are compatibility issues, not everyone knows how to fix them.

'server-side ignore', what if the network doesn't support it?
'mIRC flood control', you can't customize it (change my nickname, etc.)
'/ignore', before flood occurs?

Re: on open ? behavior [Re: Crinul] #227552 14/11/10 04:41 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Originally Posted By: Crinul
This are compatibility issues, not everyone knows how to fix them.


My point was that there are enough alternatives that people don't need to fix them on their own. Plenty of such scripts will *not* break, or be promptly updated upon a new release. Your link shows over 20 separate scripts, that's a lot of options for the layman.

Originally Posted By: Crinul
'server-side ignore', what if the network doesn't support it? 'mIRC flood control', you can't customize it (change my nickname, etc.) '/ignore', before flood occurs?


Again, these are *options*. Not all options will automatically work for everybody, but in most cases at least one option will be available. In the case where none of these options work, we can talk about the fact that there are tons of scripts out there to pickup the slack. And I'll bet there would be plenty that would be updated soon after mIRC released a new version, if the behaviour changed.

I just think the idea that a broken script will never be updated is a little faulty. It's certainly a concern for monolithic scripts that no longer get maintained (ircN, PnP, etc.), but small snippets like query blocking should not pose a problem. There are enough alternatives and enough interest to update such scripts.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: on open ? behavior [Re: argv0] #227553 14/11/10 05:40 AM
Joined: Feb 2006
Posts: 546
J
jaytea Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
Originally Posted By: argv0
But ON SOCKOPEN is not. Neither is ON SOCKWRITE. They don't trigger randomly, they trigger in response to typing /sockopen or /sockwrite respectively.


apparently you misunderstood me, or we're thinking about this in different ways. on SOCKOPEN and on SOCKWRITE only follow their respective /sock* commands (i said this originally). you said this:

Originally Posted By: argv0
Actually, by your reasoning, /sockopen should not trigger ON SOCKOPEN. Similarly, /sockwrite should not trigger ON SOCKWRITE.


that's wrong. on SOCKCLOSE doesn't follow /sockclose because there is an external stimulus involved. this external stimulus does not come in to play with on SOCKWRITE or on SOCKOPEN, that's why it's not sensible to compare them to on SOCKCLOSE.

Originally Posted By: argv0
Sorry, no, I don't acknowledge this as more common.


you missed the point i'm afraid. i realize that specific method is uncommon (it's the only example i had, commented out, in my scripts), that's why i qualified it with 'similar to'. what we would typically see is more like:

Code:
on ^*:open:?:*:{
  if (!%qnick) {
    .msg $nick Please await query authorization...
    echo -ea $nick just queried you with: $1-. Press F2 to accept or F3 to reject.
    %qnick = $nick
    halt
  }
}

alias f2 query %qnick I have accepted your query request. | unset %qnick

alias f3 .msg %qnick I have denied your query request | unset %qnick


not great, but typical. i'm not saying the fixes would be complicated, but why do you want to introduce a problem? we've already witnessed the effects on the public of abrupt changes to the client, namely: discontinuation of code page support.

the way i see it, it's as simple as: if you change on OPEN then some people will be impacted negatively, if you add an event prefix then they will not. you said it yourself:

Originally Posted By: argv0

There is no backwards compatibility issue with added behaviour.


what you're proposing is a change, what i'm proposing is added behaviour.


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Re: on open ? behavior [Re: jaytea] #227578 15/11/10 07:29 AM
Joined: Apr 2003
Posts: 342
M
MeStinkBAD Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Apr 2003
Posts: 342
jaytea, you sure are digging yourself a deeper and deeper hole...


Beware of MeStinkBAD! He knows more than he actually does!
Re: on open ? behavior [Re: MeStinkBAD] #227584 15/11/10 09:50 AM
Joined: Feb 2006
Posts: 546
J
jaytea Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
Originally Posted By: MeStinkBAD
jaytea, you sure are digging yourself a deeper and deeper hole...


frankly, i don't know what you're talking about


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Re: on open ? behavior [Re: jaytea] #227640 17/11/10 04:08 AM
Joined: Nov 2009
Posts: 295
P
pball Online OP
Fjord artisan
OP Online
Fjord artisan
P
Joined: Nov 2009
Posts: 295
I'm glad to see some one agree with me. Also please don't get too off topic.

Lastly if mirc doesn't ever break backwards compatibility it can't move forward (not that i feel this change would do anything bad). That's why scripts should/do include what versions they work with. If it doesn't work with a new version tough luck, fix it or bug the creator to fix it.


http://scripting.pball.win
My personal site with some scripts I've released.
Re: on open ? behavior [Re: argv0] #227641 17/11/10 05:14 AM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
I'm responding to everyone, not just argvo.

First of all, I was surprised that certain windows do not trigger the close or open events, but finding a work around was pretty easy. I wouldn't mind support for this but it is unnecessary.

As I said in the original post, if you want to know when a query window has been opened, either you monitor when YOU OPEN THE WINDOW, or you recognize the very first query from someone. At this point you can double check $query($nick).

I don't see how lack of open or close event for a query window would make it so you cannot write a flood protection. Depending on your server there are a few ways to monitor queries.
Ex:
on *:text:*:?:{
raw whisper:*:{

I wrote a few query block scripts. They basically monitored incoming queries and if the person was blocked, either it didn't allow the query window to open in the first place, or it closed the window when needed.

Re: on open ? behavior [Re: pball] #227643 17/11/10 06:51 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
And more importantly, for a backwards incompatible change of this kind, (a) the bug is minor and (b) there are many alternatives already.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: on open ? behavior [Re: DJ_Sol] #227645 17/11/10 07:01 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Originally Posted By: DJ_Sol
either you monitor when YOU OPEN THE WINDOW


How do you do that without overriding aliases? I had already pointed out that overriding /query is extremely poor form, and a very brittle solution at that, since any secondary script that also overrides the alias would effectively wipe your code. A solution that only works "if you don't load any other scripts" isn't much of a working solution, hence the motivation for the suggestion.

Originally Posted By: DJ_Sol
I don't see how lack of open or close event for a query window would make it so you cannot write a flood protection.


Nobody said that you cannot write flood protection scripts if this change is made. What was said was that a small amount of scripts may break due to this change, because of the fact that ON OPEN is generally /halt'ed in these situations.

[Not specifically directed to you, DJ_Sol]:

Again, I should point out that a (far more) backwards compatible way to implement this feature addition would be to trigger ON OPEN for the user opening a query window locally, but *not* the ON ^:OPEN variant. The OP is not looking for a way to halt opened windows, just a reliable and centralized way to detect them.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: on open ? behavior [Re: argv0] #227659 17/11/10 07:20 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
There's absolutely no reason to break backwards compatibility when there are several perfectly good workarounds for this situation already.

One such example that comes to mind is simply changing the alias that is called when you double click on a name in the nicklist through Alt+O > Options > Mouse. Change it to something like my_query_alias_that_nobody_else_will_use and you can be sure it won't be overwritten smile

If the on open even was to be modified then perhaps there can be something similar to $menucontext so that the scripter knows how the window opened.

That way, all existing query blocker scripts that make use of on OPEN could keep their existing functionality by simply wrapping the code block in something like:

Code:
if ($opencontext == message) {
  ; code here
}

Last edited by hixxy; 17/11/10 07:38 PM.
Re: on open ? behavior [Re: argv0] #227670 18/11/10 12:25 AM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Well I connect to my server using a socket so I can use the local socket if I want to. I would have to see the purpose and point of a specific script to comment on how I would know if I opened a query window or not. Bottom line is that you use the /query command to open a query window. You could make an alias that does some checks then opens a query window with the /query command and put that alias in the "command to be performed when you double click the nicklist".

I monitor incoming queries and my input:?: event. I guess you could set a timer to check for query windows but that sounds pretty silly.

Re: on open ? behavior [Re: hixxy] #227688 18/11/10 06:34 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Originally Posted By: hixxy
One such example that comes to mind is simply changing the alias that is called when you double click on a name in the nicklist through Alt+O > Options > Mouse. Change it to something like my_query_alias_that_nobody_else_will_use and you can be sure it won't be overwritten


This is the same problem as overwriting the alias, the problem is just displaced. The option itself can be overwritten, so we're still talking about a centralized point of failure. More importantly, it means only one script can access this information at a time, which is still not a sufficient solution. If I change the alias to "my_query_alias_that_nobody_else_will_use", I break "my_other_scripts_query_alias". This is definitely a workaround, but not even close to a "perfect" one. The whole point of having events is to allow scripters parallel and independent access to state operations. Just like the joining of a channel, one such state operation is the opening of a query window.

Also note that the default popups menu uses /query, so that would need to be changed too. Again, you run into the problem of multiple scripts potentially modifying one centralized setting.

I'm not sure why everyone is so hung up on backwards compatibility, as mentioned, there are a dozen ways in which ON OPEN can trigger WITHOUT breaking backwards compatibility. Let's stop talking about a problem that does not exist.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: on open ? behavior [Re: argv0] #227708 18/11/10 06:13 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
I just think backwards compatibility should be maintained when there are acceptable (admittedly, not perfect) workarounds available.

Perhaps this could be another event that supports the undocumented "me:" prefix so that you can catch the event triggering yourself.

Code:
on me:*:open:?:{ 
  ; I opened the window.
}
on *:open:?:{
  ; Someone/something else caused the window to open.
}

Re: on open ? behavior [Re: hixxy] #227709 18/11/10 06:37 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Although that does well for making everyone happy, it also means there's a difference in how the non-use of the me prefix works depending on the event. For example, using me for on OP will trigger only for you. That would still be true for on OPEN with this example. However, with on OP, not using it means it triggers for everyone including you (based on the level prefix, of course). Not using it for on OPEN, however will trigger for everyone except you. Although the difference in minor and most scripters won't care one way or another, it does add to potential confusion for any new scripters because of the difference in how it works. Of course, since it's undocumented and isn't changing how it currently works, maybe it doesn't matter. I'd just expect any event that takes the me prefix to have the same 2 possibilities - me = just me, no me = everyone including me.

I don't really care either way. I do any flood protection on the TEXT event anyhow rather than the OPEN event and it works very well. Just thinking that having that difference between how it works between events might not be a good thing. Still, anything done or not done will likely not be a perfect solution for everyone, and this is probably the best solution I've seen in this thread even though I personally don't think worrying about backwards compatibility is a good excuse for not making the change in this event. It really won't affect all that many scripts and the improvement can help all of those AND more scripts, so it's a win-win for everyone once the scripts are updated and updating them is very easy.


Invision Support
#Invision on irc.irchighway.net
Re: on open ? behavior [Re: hixxy] #227715 18/11/10 09:39 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Let me be clear, my proposal is this:

ON ^*:OPEN: should not trigger for self-opened query windows. Only ON *:OPEN: should trigger.

Since these /halting flood/spam control scripts make use of ON ^*:OPEN:, this will maintain backwards compatibility for 99.9% of existing scripts-- certainly all the ones I've seen, and all of the ones that were listed here.

As a backup, I wouldn't mind the ME: prefix, but I think simply not triggering the haltdef'd open event effectively avoids the problem.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: on open ? behavior [Re: argv0] #227716 18/11/10 10:51 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
That would work too smile

Re: on open ? behavior [Re: hixxy] #227864 26/11/10 08:08 AM
Joined: Apr 2003
Posts: 342
M
MeStinkBAD Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Apr 2003
Posts: 342
The open event isn't triggered is the user uses a single message window. It's only fired if it's disabled and a query window doesn't already exist for the specific user. The on text event is always fired.

The problem I have is a window opening has nothing to do with receiving a private message. mIRC just happens to open a query window if the appropriate options are set. Ironically there is no option not to open a window and treat the message like it does a notice.

The open event will also fire before the on text (or ctcp action) event strangely.


Beware of MeStinkBAD! He knows more than he actually does!
Page 2 of 2 1 2