Last Comment Bug 382085 - ChatZilla should have an auto-away feature
: ChatZilla should have an auto-away feature
Product: Other Applications
Classification: Client Software
Component: ChatZilla (show other bugs)
: Trunk
: All All
-- enhancement (vote)
: ---
Assigned To: :Gijs
Depends on: 402533
Blocks: 410974
  Show dependency treegraph
Reported: 2007-05-25 21:25 PDT by Bryan
Modified: 2008-01-05 15:47 PST (History)
4 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---

Patch (13.22 KB, patch)
2007-09-26 03:09 PDT, :Gijs
bugzilla-mozilla-20000923: review+
gijskruitbosch+bugs: review-
Details | Diff | Splinter Review
Patch (18.93 KB, patch)
2007-12-15 08:34 PST, :Gijs
bugzilla-mozilla-20000923: review+
Details | Diff | Splinter Review

Description User image Bryan 2007-05-25 21:25:58 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20070515 Firefox/
Build Identifier: ChatZilla [Firefox]

i've installed an irc server at work and i've recommended all employees install and use chatzilla.  so first, thank you for an excellent, clean and professional looking client.  one of the features that is has been asked for by just about everyone is a preference to set how many minutes of computer idle time will automatically set the nickname to the away-name.  then when the computer is not idle anymore, the name automatically change back to the nickname.   right now, nobody remembers to manually change their nickname, so this would be a very valuable feature to have. 

Reproducible: Always

Steps to Reproduce:
Comment 1 User image :Gijs 2007-05-26 03:38:56 PDT
Mmhmm, how ironic. I've been too lazy to file this bug myself - this is actually possible now that I added the necessary APIs to Firefox, but unfortunately those only exist on Firefox 3 trunk builds. So even if we implement this, it will only work on Firefox 3 (including current alphas and betas), and concurrent XULRunner trunk builds. I'm not sure you'll want your employees running alpha/beta software :-). For Firefox 2 (and XULRunner 1.8.1 and the like), the APIs simply don't exist and it's impossible for us to do what you ask. :-(

As for nickname changing, you can actually set an away nickname in the preferences This would be "Nickname (away)" in the "Identification" section of the General tab. You can set it globally and per network. Then you can just use /away or the nickname button and your nickname will automagically change, and change back when you use /back or the nickname button again.

If anyone else wants to have a go at implementing this, be my guest. I'm going to be busy the next week and probably after that. Uni sucks :-(. Please note that I'm being, erm, 'convinced' to change the API, (to use seconds instead of minutes for the listener delay period). That's bug 380682.

Oh, and this is obviously a valid RFE, so confirming.
Comment 2 User image :Gijs 2007-09-26 03:09:34 PDT
Created attachment 282379 [details] [diff] [review]

In addition to implementing this stuff, I've taken the liberty to replace some "host application (eg. Mozilla, Firefox)" references with &brandShortName;. Seemed neater to me.
Comment 3 User image James Ross 2007-10-02 09:51:55 PDT
Comment on attachment 282379 [details] [diff] [review]

>Index: mozilla/extensions/irc/locales/en-US/chrome/
> = ChatZilla can't determine if you're away in your version of &brandShortName;. The auto-away feature will now be disabled.

"can't determine when you're away"

>Index: mozilla/extensions/irc/xul/content/commands.js
>-            display(getMsg(MSG_AWAY_ON, e.reason));
>+            client.display(getMsg(MSG_AWAY_ON, e.reason));

Sure this wont force the tab to appear if it isn't already?

>Index: mozilla/extensions/irc/xul/content/prefs.js
>+         ["idleAutoAway",       0,        ".ident"],

I'd prefer it starting "away", perhaps "awayIdleTime"?

>             break;

Nit: whitespace.

>+        case "idleAutoAway":

>Index: mozilla/extensions/irc/xul/content/static.js
>+function initIdleAutoAway(timeout)
>+    if (!timeout)
>+        return;

>+function uninitIdleAutoAway(timeout)
>+    // Don't try to do anything if we were disabled before
>+    if (timeout == 0)
>+        return;

You used if (!timeout) in initIdleAutoAway. Are you expecting a difference or should they be the same? Using the same comment would be nice, too.

>+    var is = getService(";1", "nsIIdleService");
>+    if (!is)
>+        return;

Nit: add blank line after this.

>+    try

r=silver with those nits fixed.
Comment 4 User image :Gijs 2007-10-28 03:53:18 PDT
Comment on attachment 282379 [details] [diff] [review]

Er, so I just realized this will override existing away states. Oops.
Comment 5 User image :Gijs 2007-12-15 08:34:19 PST
Created attachment 293290 [details] [diff] [review]

So this fixes the nits and stops us from killing your current away state.
Comment 6 User image James Ross 2008-01-03 12:22:47 PST
Comment on attachment 293290 [details] [diff] [review]

You didn't put a blank line after:
>+    if (!is)
>+        return;

But otherwise, looks good. r=silver with nit fixed.
Comment 7 User image :Gijs 2008-01-05 09:03:02 PST
Checking in mozilla/extensions/irc/locales/en-US/chrome/;
/cvsroot/mozilla/extensions/irc/locales/en-US/chrome/,v  <--
new revision: 1.149; previous revision: 1.148
Checking in mozilla/extensions/irc/xul/content/commands.js;
/cvsroot/mozilla/extensions/irc/xul/content/commands.js,v  <--  commands.js
new revision: 1.138; previous revision: 1.137
Checking in mozilla/extensions/irc/xul/content/handlers.js;
/cvsroot/mozilla/extensions/irc/xul/content/handlers.js,v  <--  handlers.js
new revision: 1.161; previous revision: 1.160
Checking in mozilla/extensions/irc/xul/content/prefs.js;
/cvsroot/mozilla/extensions/irc/xul/content/prefs.js,v  <--  prefs.js
new revision: 1.47; previous revision: 1.46
Checking in mozilla/extensions/irc/xul/content/static.js;
/cvsroot/mozilla/extensions/irc/xul/content/static.js,v  <--  static.js
new revision: 1.255; previous revision: 1.254

Note You need to log in before you can comment on or make changes to this bug.