Index: js/lib/chatzilla-service.js =================================================================== RCS file: /cvsroot/mozilla/extensions/irc/js/lib/chatzilla-service.js,v retrieving revision 1.44 retrieving revision 1.45 diff -d -p -u -6 -r1.44 -r1.45 --- js/lib/chatzilla-service.js 25 Jul 2007 17:21:42 -0000 1.44 +++ js/lib/chatzilla-service.js 10 Feb 2008 21:54:59 -0000 1.45 @@ -157,20 +157,22 @@ function spawnChatZilla(uri, count) // We have a window. if (w) { dump("cz-service: Existing, fully loaded window. Using.\n"); // Window is working and initialized ok. Use it. w.focus(); - w.gotoIRCURL(uri); + if (uri) + w.gotoIRCURL(uri); return true; } dump("cz-service: No windows, starting new one.\n"); // Ok, no available window, loading or otherwise, so start ChatZilla. var args = new Object(); - args.url = uri; + if (uri) + args.url = uri; hiddenWin.ChatZillaStarting = new Date(); hiddenWin.openDialog("chrome://chatzilla/content/chatzilla.xul", "_blank", "chrome,menubar,toolbar,status,resizable,dialog=no", args); @@ -208,34 +210,24 @@ CLineService.prototype.defaultArgs = ""; CLineService.prototype.openWindowWithArgs = true; /* nsICommandLineHandler */ CLineService.prototype.handle = function handler_handle(cmdLine) { - var args; + var uri; try { - var uristr = cmdLine.handleFlagWithParam("chat", false); - if (uristr) - { - args = new Object(); - args.url = uristr; - } + uri = cmdLine.handleFlagWithParam("chat", false); } catch (e) { } - if (args || cmdLine.handleFlag("chat", false)) + if (uri || cmdLine.handleFlag("chat", false)) { - var assClass = Components.classes[ASS_CONTRACTID]; - var ass = assClass.getService(nsIAppShellService); - var hWin = ass.hiddenDOMWindow; - hWin.openDialog("chrome://chatzilla/content/", "_blank", - "chrome,menubar,toolbar,status,resizable,dialog=no", - args); + spawnChatZilla(uri || null) cmdLine.preventDefault = true; } } CLineService.prototype.helpInfo = " -chat [] Start with an IRC chat client.\n"