[Zope-CVS] CVS: Packages/Moztop - nsXmlRpcClient.js:1.1 Makefile:1.3

Stephan Richter srichter@cbu.edu
Tue, 14 Jan 2003 20:27:03 -0500


Update of /cvs-repository/Packages/Moztop
In directory cvs.zope.org:/tmp/cvs-serv6091

Modified Files:
	Makefile 
Added Files:
	nsXmlRpcClient.js 
Log Message:
I think this is a good checkpoint to make a checkin:

- Now we can add Folders in any arbitrary Sub-Folder.

- I needed to fix the nsXmlRpcClient.js file, so I provide the fixed 
  version here.

- Updated CHANGES.txt.

- Updated INSTALL.txt to reflect the fix for nzXmlRpcClient.js and made
  a note that a nightly build is required, since the XML-RPC lib does not
  work in 1.2.1.


=== Added File Packages/Moztop/nsXmlRpcClient.js === (1303/1403 lines abridged)
/*
 * 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 XML-RPC Client component.
 *
 * The Initial Developer of the Original Code is Digital Creations 2, Inc.
 * Portions created by Digital Creations 2, Inc. are Copyright (C) 2000 Digital
 * Creations 2, Inc.  All Rights Reserved.
 *
 * Contributor(s): Martijn Pieters <mj@digicool.com> (original author)
 *                 Samuel Sieb <samuel@sieb.net> brought it up to date with 
 *                             current APIs and added authentication
 */

/*
 *  nsXmlRpcClient XPCOM component
 *  Version: $Revision: 1.1 $
 *
 *  $Id: nsXmlRpcClient.js,v 1.1 2003/01/15 01:26:30 srichter Exp $
 */

/*
 * Constants
 */
const XMLRPCCLIENT_CONTRACTID = '@mozilla.org/xml-rpc/client;1';
const XMLRPCCLIENT_CID =
    Components.ID('{37127241-1e6e-46aa-ba87-601d41bb47df}');
const XMLRPCCLIENT_IID = Components.interfaces.nsIXmlRpcClient;

const XMLRPCFAULT_CONTRACTID = '@mozilla.org/xml-rpc/fault;1';
const XMLRPCFAULT_CID =
    Components.ID('{691cb864-0a7e-448c-98ee-4a7f359cf145}');
const XMLRPCFAULT_IID = Components.interfaces.nsIXmlRpcFault;

const DEBUG = false;
const DEBUGPARSE = false;

/*
 * Class definitions
 */

/* The nsXmlRpcFault class constructor. */
function nsXmlRpcFault() {}


[-=- -=- -=- 1303 lines omitted -=- -=- -=-]

/* Convert Base64 data to a string */
const toBinaryTable = [
    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63,
    52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1, 0,-1,-1,
    -1, 0, 1, 2,  3, 4, 5, 6,  7, 8, 9,10, 11,12,13,14,
    15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1,
    -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40,
    41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1
];
function base64ToString(data) {
    var result = '';
    var leftbits = 0; // number of bits decoded, but yet to be appended
    var leftdata = 0; // bits decoded, bt yet to be appended

    // Convert one by one.
    for (var i in data) {
        var c = toBinaryTable[data.charCodeAt(i) & 0x7f];
        var padding = (data[i] == base64Pad);
        // Skip illegal characters and whitespace
        if (c == -1) continue;
        
        // Collect data into leftdata, update bitcount
        leftdata = (leftdata << 6) | c;
        leftbits += 6;

        // If we have 8 or more bits, append 8 bits to the result
        if (leftbits >= 8) {
            leftbits -= 8;
            // Append if not padding.
            if (!padding)
                result += String.fromCharCode((leftdata >> leftbits) & 0xff);
            leftdata &= (1 << leftbits) - 1;
        }
    }

    // If there are any bits left, the base64 string was corrupted
    if (leftbits)
        throw Components.Exception('Corrupted base64 string');

    return result;
}

if (DEBUG) debug = function(msg) { 
    dump(' -- XML-RPC client -- : ' + msg + '\n'); 
};
else debug = function() {}

// vim:sw=4:sr:sta:et:sts:


=== Packages/Moztop/Makefile 1.2 => 1.3 ===
--- Packages/Moztop/Makefile:1.2	Tue Jan 14 15:42:23 2003
+++ Packages/Moztop/Makefile	Tue Jan 14 20:26:30 2003
@@ -16,7 +16,7 @@
 # $Id$
 ZIP=zip
 XPI_NAME=moztop.xpi
-MOZILLA=/opt/moz-nightly/mozilla
+MOZILLA=/opt/moz-nightly/mozilla -jsconsole
 
 all: build-xpi