Open Bug 297292 Opened 15 years ago Updated 10 years ago

Need option to flash taskbar on any message on some channel

Categories

(Other Applications :: ChatZilla, enhancement)

enhancement
Not set

Tracking

(Not tracked)

People

(Reporter: eyalroz, Assigned: rginda)

Details

Attachments

(1 file)

Often I want to be notified whenver anything is said on some specific channel,
not necessarily to me (e.g. channel with very low activity); in mIRC this can be
done with the "Options|IRC|Options|Flash On|Channel Message" . This feature,
coupled configurable per-channel, would be extremely useful for me (and many
others, I hope).
And here's the code to do it (I'd post a patch but I don't know what to patch
against...)

in prefs.js, in function getChannelPrefManager():

-         ["outputWindowURL",  defer, "appearance.misc"]
+         ["outputWindowURL",  defer, "appearance.misc"],
+         ["getAttentionOnMessage",  false, "hidden"]

in static.js, in function

-        if (client.prefs["notify.aggressive"])
+        if ( (client.prefs["notify.aggressive"]) ||
+             (o.channel && o.channel.prefs["getAttentionOnMessage"]) )
            window.getAttention();
    }
    else
    {
+        if (o.channel && o.channel.prefs["getAttentionOnMessage"])
+            window.getAttention();


rginda, _please_ say you'll add this to the code, it's a really trivial change...


 

(In reply to comment #1)
> And here's the code to do it (I'd post a patch but I don't know what to patch
> against...)
> 
> in prefs.js, in function getChannelPrefManager():
> 
> -         ["outputWindowURL",  defer, "appearance.misc"]
> +         ["outputWindowURL",  defer, "appearance.misc"],
> +         ["getAttentionOnMessage",  false, "hidden"]

To get this to work right, the prefs need to be added for the network and
globally as well, and made deferable.

> in static.js, in function

in function what?

> 
> -        if (client.prefs["notify.aggressive"])
> +        if ( (client.prefs["notify.aggressive"]) ||
> +             (o.channel && o.channel.prefs["getAttentionOnMessage"]) )
>             window.getAttention();
>     }
>     else
>     {
> +        if (o.channel && o.channel.prefs["getAttentionOnMessage"])
> +            window.getAttention();
> 
> 
> rginda, _please_ say you'll add this to the code, it's a really trivial change...

You're adding preferences, by definition that's NOT a trivial change.

I'd like to have this done using the message filtering system, if possible. You
could then even specify more criteria as to when the window should or should not
flash. This would also prevent the addition of preferences, which seems like a
good idea to me. (Note that I'm not vetoing this change (as if I could), I'm
just saying I think there are better ways to do this, if we want to do it at all)
(In reply to comment #2)
> in function what?

Oh, sorry, in function __display()


> You're adding preferences, by definition that's NOT a trivial change.

Well, no functions are added, and a total of -2 +5 lines of code are changed
(add another two or three or four for deferring to network and global prefs, and
perhaps for addition into the GUI), so it's certainly not much...

> I'd like to have this done using the message filtering system, if possible. 
> You could then even specify more criteria as to when the window
> should or should not flash. This would also prevent the addition of 
> preferences, which seems like a good idea to me.

As this is the first time I have ever even looked at the chatzilla code, I have
no idea what you're talking about. What part of the code is the 'message
filtering system'? Where can I find information about what it's supposed to do
and what it does? (other than reading the code of course)?
(In reply to comment #3)
> (In reply to comment #2)
> > I'd like to have this done using the message filtering system, if possible. 
> > You could then even specify more criteria as to when the window
> > should or should not flash. This would also prevent the addition of 
> > preferences, which seems like a good idea to me.
> 
> As this is the first time I have ever even looked at the chatzilla code, I have
> no idea what you're talking about. What part of the code is the 'message
> filtering system'? Where can I find information about what it's supposed to do
> and what it does? (other than reading the code of course)?

Not even reading the code would help. See bug 252848 - this is yet to be
implemented.

As for GUI inclusion of those preferences, that would happen automatically. Our
preference window code rocks in that respect (kudos to Silver).
(In reply to comment #1)
Bad way to do it. The events system (though labeled and called sounds, which
should change at some point) can easily handle this if you add a new type to the
possible options.
Please try and use the bug fields properly, too. ;)
Severity: normal → enhancement
Summary: [RFE] need option to flash taskbar on any message on some channel → Need option to flash taskbar on any message on some channel
Depends on: 252848
(In reply to comment #2)

Making deferable prefs doesn't work for some reason. I have:

["getAttentionOnChannelMessage",  false,     "global"]

in the client prefs,

["getAttentionOnChannelMessage",  defer, "getAttentionOnChannelMessage"]

in the network prefs and

["getAttentionOnMessage",  defer, "getAttentionOnChannelMessage"]

in the channel prefs. And when I check o.channel.prefs["getAttentionOnMessage"] 
it seems to be undefined. No Javascript warnings/errors either.


(In reply to comment #5)

Uh, I don't mean to sound disrespectful, but I don't think the following 
constitutes an event system...

function playSound(file) {
  if (!client.sound || !client.prefs["sound.enabled"] || !file) return;
  if (file == "beep") client.sound.beep();
  else try {
    var uri = client.iosvc.newURI(file, null, null);
    client.sound.play(uri);
  } catch (ex) {}
}

(In reply to comment #7)
The prefs don't work because you didn't add it to the channel list. And you seem
to be ignorant to most of ChatZilla's code, as there is somewhat more than those
lines in the sound/event system.
OS: Windows XP → All
No longer depends on: 252848
QA Contact: samuel → chatzilla
Hardware: x86 → All
Version: unspecified → Trunk
This patch was made a while back when I was bored; it's not a finished thing, but I'd like comments on it now if that's alright. Basically it renames the sound.* prefs to event.* and migrates them, including the aggressive notify pref into the new events.
You need to log in before you can comment on or make changes to this bug.