implementing the chatzilla service that I promised rginda months ago.

now, -chat from the command line works and brings up chatzilla.
(only win32 and unix, until I tweak the mac build.)
This commit is contained in:
sspitzer%netscape.com 2000-04-25 06:39:39 +00:00
Родитель 3ca119d9eb
Коммит 6b56b72e3a
3 изменённых файлов: 103 добавлений и 0 удалений

Просмотреть файл

@ -128,3 +128,4 @@ install::
$(INSTALL) $(CONTENTFILES) $(INSTALLROOT)/content
$(INSTALL) $(SKINFILES) $(INSTALLROOT)/skin
$(INSTALL) $(IMAGEFILES) $(INSTALLROOT)/skin/images
$(INSTALL) $(srcdir)/js/lib/chatzilla-service.js $(DIST)/bin/components

Просмотреть файл

@ -0,0 +1,101 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Seth Spitzer <sspitzer@netscape.com>
*/
const CHATZILLASERVICE_PROGID = "component://netscape/commandlinehandler/general-startup-chat";
const CHATZILLASERVICE_CID = Components.ID("{38a95514-1dd2-11b2-97e7-9da958640f2c}");
const nsICmdLineHandler = Components.interfaces.nsICmdLineHandler;
const nsICategoryManager = Components.interfaces.nsICategoryManager;
const nsISupports = Components.interfaces.nsISupports;
function ChatzillaService()
{
dump("in ChatzillaService()\n");
}
ChatzillaService.prototype.commandLineArgument = "-chat";
ChatzillaService.prototype.prefNameForStartup = "general.startup.chat";
ChatzillaService.prototype.chromeUrlForTask="chrome://chatzilla/content";
ChatzillaService.prototype.helpText = "Start with an IRC chat client";
ChatzillaService.prototype.handlesArgs=false;
ChatzillaService.prototype.defaultArgs ="";
ChatzillaService.prototype.openWindowWithArgs=true;
var chatzillaModule = new Object();
chatzillaModule.registerSelf =
function (compMgr, fileSpec, location, type)
{
dump("registering (all right -- a JavaScript module!)");
compMgr.registerComponentWithType(CHATZILLASERVICE_CID, "Chatzilla Service Component",
CHATZILLASERVICE_PROGID, fileSpec, location,
true, true, type);
catman = Components.classes["mozilla.categorymanager.1"].getService(nsICategoryManager);
catman.addCategoryEntry("command-line-argument-handlers",CHATZILLASERVICE_PROGID, "chatzilla command line handler", true, true);
}
chatzillaModule.unregisterSelf =
function(compMgr, fileSpec, location)
{
compMgr.unregisterComponentSpec(CHATZILLASERVICE_CID, fileSpec);
catman = Components.classes["mozilla.categorymanager.1"].getService(nsICategoryManager);
catman.deleteCategoryEntry("command-line-argument-handlers",CHATZILLASERVICE_PROGID, true);
}
chatzillaModule.getClassObject =
function (compMgr, cid, iid) {
if (!cid.equals(CHATZILLASERVICE_CID))
throw Components.results.NS_ERROR_NO_INTERFACE;
if (!iid.equals(Components.interfaces.nsIFactory))
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
return chatzillaFactory;
}
chatzillaModule.canUnload =
function(compMgr)
{
dump("Unloading component.");
return true;
}
/* factory object */
chatzillaFactory = new Object();
chatzillaFactory.CreateInstance =
function (outer, iid) {
if (outer != null)
throw Components.results.NS_ERROR_NO_AGGREGATION;
if (!iid.equals(nsICmdLineHandler) && !iid.equals(nsISupports))
throw Components.results.NS_ERROR_INVALID_ARG;
return new ChatzillaService();
}
/* entrypoint */
function NSGetModule(compMgr, fileSpec) {
return chatzillaModule;
}

Просмотреть файл

@ -126,4 +126,5 @@ install::
$(MAKE_INSTALL) $(CONTENTFILES) $(INSTALLROOT)\content
$(MAKE_INSTALL) $(SKINFILES) $(INSTALLROOT)\skin
$(MAKE_INSTALL) $(IMAGEFILES) $(INSTALLROOT)\skin\images
$(MAKE_INSTALL) .\js\lib\chatzilla-service.js $(DIST)\bin\components