diff --git a/extensions/irc/xpi/.cvsignore b/extensions/irc/xpi/.cvsignore new file mode 100644 index 00000000000..a2bd0a315bc --- /dev/null +++ b/extensions/irc/xpi/.cvsignore @@ -0,0 +1,3 @@ +jar-tree +xpi-tree +chatzilla-*.xpi diff --git a/extensions/irc/xpi/makexpi.sh b/extensions/irc/xpi/makexpi.sh new file mode 100644 index 00000000000..1c78f831ed7 --- /dev/null +++ b/extensions/irc/xpi/makexpi.sh @@ -0,0 +1,128 @@ +#! /bin/bash + +# Set up paths for finding files. +if [ -z "$FEDIR" ]; then FEDIR=$PWD/..; fi +if [ -z "$CONFIGDIR" ]; then CONFIGDIR=$FEDIR/../../config; fi +if [ -z "$XPIFILES" ]; then XPIFILES=$PWD/resources; fi +if [ -z "$XPIROOT" ]; then XPIROOT=$PWD/xpi-tree; fi +if [ -z "$JARROOT" ]; then JARROOT=$PWD/jar-tree; fi + + +if [ "$1" == "clean" ]; then + echo -n "Cleaning up files" + echo -n . + rm -rf "$XPIROOT" + echo -n . + rm -rf "$JARROOT" + echo ". done." + + exit +fi + + +# Check setup. +if ! [ -d "$FEDIR" ]; then + echo "ERROR: Base ChatZilla directory (FEDIR) not found." + exit 1 +fi +if ! [ -d "$CONFIGDIR" ]; then + echo "ERROR: mozilla/config directory (CONFIGDIR) not found." + exit 1 +fi + + +# Extract version number. +VERSION=`grep "const __cz_version" "$FEDIR/xul/content/static.js" | sed "s|.*\"\([^\"]\+\)\".*|\1|"` + +echo Begining build of ChatZilla $VERSION... + + +# Check for existing. +if [ -r "chatzilla-$VERSION.xpi" ]; then + echo " WARNING: output XPI will be overwritten." +fi + + +# Check for required directory layouts. +echo -n " Checking XPI structure" +echo -n . +if ! [ -d xpi-tree ]; then mkdir xpi-tree; fi +echo -n . +if ! [ -d xpi-tree/chrome ]; then mkdir xpi-tree/chrome; fi +echo -n . +if ! [ -d xpi-tree/components ]; then mkdir xpi-tree/components; fi +echo -n . +if ! [ -d xpi-tree/defaults ]; then mkdir xpi-tree/defaults; fi +echo ". done" + +echo -n " Checking JAR structure" +echo -n . +if ! [ -d jar-tree ]; then mkdir jar-tree; fi +echo ". done" + + +# Make Firefox updates. +echo -n " Updating Firefox Extension files" +echo -n . +sed "s|@REVISION@|$VERSION|g" < "$XPIFILES/install.rdf" > "$XPIROOT/install.rdf" +echo -n . +cp "$XPIFILES/chatzilla-window.ico" "$XPIROOT/defaults/chatzilla-window.ico" +echo -n . +cp "$XPIFILES/chatzilla-window.xpm" "$XPIROOT/defaults/chatzilla-window.xpm" +echo -n . +cp "$XPIFILES/chatzilla-window16.xpm" "$XPIROOT/defaults/chatzilla-window16.xpm" +echo ". done" + + +# Make Mozilla Suite updates. +echo -n " Updating Mozilla Extension files" +echo -n . +sed "s|@REVISION@|$VERSION|g" < "$XPIFILES/install.js" > "$XPIROOT/install.js" +echo -n . +mv "$FEDIR/xul/content/contents.rdf" "$FEDIR/xul/content/contents.rdf.in" +sed "s|@MOZILLA_VERSION@|cz-$VERSION|g;s|\(chrome:displayName=\)\"[^\"]\+\"|\1\"ChatZilla $VERSION\"|g" < "$FEDIR/xul/content/contents.rdf.in" > "$FEDIR/xul/content/contents.rdf" +rm "$FEDIR/xul/content/contents.rdf.in" +echo -n . +mv "$FEDIR/xul/locale/en-US/contents.rdf" "$FEDIR/xul/locale/en-US/contents.rdf.in" +sed "s|@MOZILLA_VERSION@|cz-$VERSION|g" < "$FEDIR/xul/locale/en-US/contents.rdf.in" > "$FEDIR/xul/locale/en-US/contents.rdf" +rm "$FEDIR/xul/locale/en-US/contents.rdf.in" +echo ". done" + + +# Create JAR. +echo -n " Constructing JAR package" +echo -n . +pushd "$CONFIGDIR" >/dev/null +echo -n . +OUT=`perl make-jars.pl -v -z zip -p preprocessor.pl -s "$FEDIR" -d "$JARROOT" < "$FEDIR/jar.mn" 2>&1` +if [ "$?" != "0" ]; then echo ERROR; echo $OUT; exit 1; fi +echo -n . +OUT=`perl make-jars.pl -v -z zip -p preprocessor.pl -s "$FEDIR/sm" -d "$JARROOT" < "$FEDIR/sm/jar.mn" 2>&1` +if [ "$?" != "0" ]; then echo ERROR; echo $OUT; exit 1; fi +echo -n . +OUT=`perl make-jars.pl -v -z zip -p preprocessor.pl -s "$FEDIR/ff" -d "$JARROOT" < "$FEDIR/ff/jar.mn" 2>&1` +if [ "$?" != "0" ]; then echo ERROR; echo $OUT; exit 1; fi +echo -n . +popd >/dev/null +echo ". done" + + +# Make XPI. +echo -n " Constructing XPI package" +echo -n . +OUT=`cp -v "$JARROOT/chatzilla.jar" "$XPIROOT/chrome/"` +if [ "$?" != "0" ]; then echo ERROR; echo $OUT; exit 1; fi +echo -n . +OUT=`cp -v "$FEDIR/js/lib/chatzilla-service.js" "$XPIROOT/components/"` +if [ "$?" != "0" ]; then echo ERROR; echo $OUT; exit 1; fi +echo -n . +chmod 664 "$XPIROOT/chrome/chatzilla.jar" +echo -n . +chmod 664 "$XPIROOT/components/chatzilla-service.js" +echo -n . +pushd "$XPIROOT" >/dev/null; OUT=`zip -vr ../chatzilla-$VERSION.xpi * 2>&1`; popd >/dev/null +if [ "$?" != "0" ]; then echo ERROR; echo $OUT; exit 1; fi +echo ". done" + + +echo "Build of ChatZilla $VERSION... ALL DONE" diff --git a/extensions/irc/xpi/resources/chatzilla-window.ico b/extensions/irc/xpi/resources/chatzilla-window.ico new file mode 100644 index 00000000000..c3beee23a57 Binary files /dev/null and b/extensions/irc/xpi/resources/chatzilla-window.ico differ diff --git a/extensions/irc/xpi/resources/chatzilla-window.xpm b/extensions/irc/xpi/resources/chatzilla-window.xpm new file mode 100644 index 00000000000..aab2ff9bfe3 --- /dev/null +++ b/extensions/irc/xpi/resources/chatzilla-window.xpm @@ -0,0 +1,98 @@ +/* XPM */ +static char *cz_logo_32[] = { +/* columns rows colors chars-per-pixel */ +"32 32 60 1", +" c #374552", +". c #384653", +"X c #3b4956", +"o c #3e4b58", +"O c #414e5b", +"+ c #43505d", +"@ c #4a5762", +"# c #4d5965", +"$ c #515d68", +"% c #55616c", +"& c #58646e", +"* c #5a6671", +"= c #5d6873", +"- c #616c77", +"; c #636e78", +": c #66707a", +"> c #6a747e", +", c #6c7780", +"< c #6e7881", +"1 c #717b84", +"2 c #767f88", +"3 c #7a838c", +"4 c #7e8790", +"5 c #828b93", +"6 c #8b939a", +"7 c #90979f", +"8 c #949ca3", +"9 c #9ca3aa", +"0 c #a0a7ad", +"q c #a2a8ae", +"w c #a5abb1", +"e c #a9afb4", +"r c #abb1b6", +"t c #adb2b8", +"y c #b0b5ba", +"u c #b3b8bd", +"i c #b7bcc1", +"p c #b8bdc2", +"a c #bbc0c4", +"s c #bfc4c8", +"d c #c2c6ca", +"f c #c5c9cc", +"g c #caced1", +"h c #cdd1d4", +"j c #d0d3d6", +"k c #d4d7da", +"l c #d6d9dc", +"z c #d9dcde", +"x c #dbdde0", +"c c #dde0e2", +"v c #e1e3e5", +"b c #e5e7e9", +"n c #e7e8ea", +"m c #eaebed", +"M c #eff0f1", +"N c #f4f5f5", +"B c #f6f7f8", +"V c #f7f8f8", +"C c #fefefe", +"Z c None", +/* pixels */ +"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ", +"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ", +"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ", +"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ", +"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ", +"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ", +"ZZZZZZZZZZZZZZZZZZVVNBNBNNNNNVCZ", +"ZZZZZZZZZZZZZZZZMu<&&=**&==&==6v", +"ZZZZZZZZZZZZZZZC8O155555555553O>", +"ZZZZZZZZZZZZZZZc@9VCCCCCCCCCCC9o", +"ZZZZVca856ygmZV6@cCCVcxxcVCCCC9#", +"ZZCh<+o+&$Oo&ugO0CCN6OOO2MCCCg@3", +"ZCt@$9gvNmlp3O%&mCC8X2$$kCCCv&$k", +"ZpO5cCCCCCCCN3 9CCrO56+aCCCN3+fZ", +"m=*mCCCCCCVnCv;5k0+6u+9CCCC8oeCZ", +"eOfCCCCnfmCCCC9.++6f$3BCCCuO6VZZ", +"1;NCCB8$ ;vCCCk$&hu<6v", +"OyCCC5@bZk&. .6CCr+uCCCV5#yOrB6X", +">,VCCc%@>#>xCN2+@1NCCCf+55OrCC6#", +"8@zCCCv9&=hCCCpX&vCCCz%.#OrCCx#6", +"c#1NCCCCmMCCCC9@fCCCCu555uCCC8#c", +"CqowNCCCCCCCCg#9CCCCCCCCCCCCl#6C", +"ZN6O,smNCCVbi$X c #69747d", +", c #6c7780", +"< c #6e7881", +"1 c #717b84", +"2 c #757f88", +"3 c #7a838c", +"4 c #7f8890", +"5 c #838c94", +"6 c #8d959c", +"7 c #90979f", +"8 c #90989f", +"9 c #949ca3", +"0 c #9aa1a7", +"q c #9ca3a9", +"w c #a6acb2", +"e c #a9afb4", +"r c #abb1b6", +"t c #adb2b8", +"y c #b0b6bb", +"u c #b3b8bd", +"i c #b7bcc1", +"p c #b8bdc2", +"a c #bdc1c6", +"s c #c3c7cb", +"d c #c5c9cd", +"f c #caced1", +"g c #cdd0d4", +"h c #d0d3d6", +"j c #d3d6d9", +"k c #d5d8da", +"l c #d8dbdd", +"z c #dbdde0", +"x c #e1e3e5", +"c c #e4e6e8", +"v c #e6e8e9", +"b c #eaeced", +"n c #eff0f1", +"m c #f3f4f5", +"M c #f6f7f8", +"N c #f7f8f8", +"B c #fefefe", +"V c None", +/* pixels */ +"VVVVVVVVVVVVVVVV", +"VVVVVVVVVVVVVVVV", +"VVVVVVVVVNmmMmmB", +"VVVVVVVmw;=*=*=8", +"VVmfisx6#355553O", +"Ba>o+o#+iBmzbBm:", +"6@2tls9>mz>%jBeX", +"O8BBnBMqw%XeBd+>", +"+jBq-ij> .5Nx*.4", +"&mb$ .O .>bm1.=O", +"+lN0$5t:%lB6.1b1", +"+6BBvNN5aBc66cg+", +"8#2tgu6=tuuuuy:&", +"Na>OoX$#OOOOOO+r", +"VVmjugcvlzzzzzxN", +"VVVVVVVVVVVVVVVV" +}; diff --git a/extensions/irc/xpi/resources/install.js b/extensions/irc/xpi/resources/install.js new file mode 100644 index 00000000000..084b224ef2c --- /dev/null +++ b/extensions/irc/xpi/resources/install.js @@ -0,0 +1,132 @@ +// this function verifies disk space in kilobytes +function verifyDiskSpace(dirPath, spaceRequired) +{ + var spaceAvailable; + + // Get the available disk space on the given path + spaceAvailable = fileGetDiskSpaceAvailable(dirPath); + + // Convert the available disk space into kilobytes + spaceAvailable = parseInt(spaceAvailable / 1024); + + // do the verification + if(spaceAvailable < spaceRequired) + { + logComment("Insufficient disk space: " + dirPath); + logComment(" required : " + spaceRequired + " K"); + logComment(" available: " + spaceAvailable + " K"); + return(false); + } + + return(true); +} + +// this function deletes a file if it exists +function deleteThisFile(dirKey, file) +{ + var fFileToDelete; + + fFileToDelete = getFolder(dirKey, file); + logComment("File to delete: " + fFileToDelete); + if(File.isFile(fFileToDelete)) + { + File.remove(fFileToDelete); + return(true); + } + else + return(false); +} + +// this function deletes a folder if it exists +function deleteThisFolder(dirKey, folder, recursiveDelete) +{ + var fToDelete; + + if(typeof recursiveDelete == "undefined") + recursiveDelete = true; + + fToDelete = getFolder(dirKey, folder); + logComment("folder to delete: " + fToDelete); + if(File.isDirectory(fToDelete)) + { + File.dirRemove(fToDelete, recursiveDelete); + return(true); + } + else + return(false); +} + +// OS type detection +// which platform? +function getPlatform() +{ + var platformStr; + var platformNode; + + if('platform' in Install) + { + platformStr = new String(Install.platform); + + if (!platformStr.search(/^Macintosh/)) + platformNode = 'mac'; + else if (!platformStr.search(/^Win/)) + platformNode = 'win'; + else if (!platformStr.search(/^OS\/2/)) + platformNode = 'win'; + else + platformNode = 'unix'; + } + else + { + var fOSMac = getFolder("Mac System"); + var fOSWin = getFolder("Win System"); + + logComment("fOSMac: " + fOSMac); + logComment("fOSWin: " + fOSWin); + + if(fOSMac != null) + platformNode = 'mac'; + else if(fOSWin != null) + platformNode = 'win'; + else + platformNode = 'unix'; + } + + return platformNode; +} + +var srDest = 665; + +var err = initInstall("Chatzilla @REVISION@", "Chatzilla", "@REVISION@"); +logComment("initInstall: " + err); + +if (verifyDiskSpace(getFolder("Program"), srDest)) +{ + addFile("Chatzilla service", + "@REVISION@", + "components/chatzilla-service.js", + getFolder("Components"), + "chatzilla-service.js", + true); + + addFile("Chatzilla Chrome", + "chrome/chatzilla.jar", // jar source folder + getFolder("Chrome"), // target folder + ""); // target subdir + + addFile("ChatZilla Win32 icon", "defaults/chatzilla-window.ico", getFolder("Chrome"), "icons/default/chatzilla-window.ico"); + addFile("ChatZilla Unix 32 icon", "defaults/chatzilla-window.xpm", getFolder("Chrome"), "icons/default/chatzilla-window.xpm"); + addFile("ChatZilla Unix 16 icon", "defaults/chatzilla-window16.xpm", getFolder("Chrome"), "icons/default/chatzilla-window16.xpm"); + + registerChrome(PACKAGE | DELAYED_CHROME, getFolder("Chrome","chatzilla.jar"), "content/chatzilla/"); + registerChrome(PACKAGE | DELAYED_CHROME, getFolder("Chrome","chatzilla.jar"), "content/chatzilla/sm/"); + registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","chatzilla.jar"), "skin/modern/chatzilla/"); + registerChrome(LOCALE | DELAYED_CHROME, getFolder("Chrome","chatzilla.jar"), "locale/en-US/chatzilla/"); + + if (err==SUCCESS) + performInstall(); + else + cancelInstall(err); +} +else + cancelInstall(INSUFFICIENT_DISK_SPACE); diff --git a/extensions/irc/xpi/resources/install.rdf b/extensions/irc/xpi/resources/install.rdf new file mode 100644 index 00000000000..69ca6bc3d89 --- /dev/null +++ b/extensions/irc/xpi/resources/install.rdf @@ -0,0 +1,48 @@ + + + + + {59c81df5-4b7a-477b-912d-4e0fdf64e5f2} + @REVISION@ + + + + + {86c18b42-e466-45a9-ae7a-9b95ba6f5640} + 1.0 + 1.8 + + + + + + + {ec8030f7-c20a-464f-9b0e-13a3a9e97384} + 0.9 + 1.0 + + + + + ChatZilla + A simple, straightforward Internet Relay Chat (IRC) client. + The ChatZilla Team + Robert Ginda + Samuel Sieb + James Ross + Lim Chee Aun (graphics) + chrome://chatzilla/skin/images/logo.png + http://www.hacksrus.com/~ginda/chatzilla/ + javascript:opener.openDialog('chrome://chatzilla/content/config.xul','','chrome,modal,resizable');window.close(); + + + + + content/chatzilla/ + content/chatzilla/ff/ + locale/en-US/chatzilla/ + skin/modern/chatzilla/ + + + +