
const FLOCK_PHOTOPERSON_CID = Components.ID('{440dd9f3-cea2-41ad-af2b-cfc80ed4d5b5}');
const FLOCK_PHOTOPERSON_CONTRACTID = '@flock.com/photo-person;1';
const FLOCK_PHOTOPERSON_IID = Components.interfaces.flockIPhotoPerson;


function flockPhotoPerson() {
}

flockPhotoPerson.prototype= {
    service: null,
    username: "",
    fullname: "",
    id: "",
    seq: 0,
    lastNewSeq: 0,

    QueryInterface: function(iid) {
        if (!iid.equals(Components.interfaces.nsISupports) &&
            !iid.equals(FLOCK_PHOTOPERSON_IID))
            throw Components.results.NS_ERROR_NO_INTERFACE;
        return this;
    }
};


var flockPhotoPersonModule = {
    registerSelf: function(compMgr, fileSpec, location, type) {
        compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
        compMgr.registerFactoryLocation(FLOCK_PHOTOPERSON_CID, 
                                        "flockPhotoPerson JS component", 
                                        FLOCK_PHOTOPERSON_CONTRACTID, 
                                        fileSpec, 
                                        location,
                                        type);
    },

    getClassObject: function(compMgr, cid, iid) {
        if (!cid.equals(FLOCK_PHOTOPERSON_CID))
            throw Components.results.NS_ERROR_NO_INTERFACE;

        if (!iid.equals(Components.interfaces.nsIFactory))
            throw Components.results.NS_ERROR_NOT_IMPLEMENTED;

        return flockPhotoPersonFactory;
    },

    canUnload: function(compMgr) { return true; }
};

var flockPhotoPersonFactory = {
    createInstance: function(outer, iid) {
        if (outer != null)
            throw Components.results.NS_ERROR_NO_AGGREGATION;
    
        if (!iid.equals(FLOCK_PHOTOPERSON_IID) &&
            !iid.equals(Components.interfaces.nsISupports))
            throw Components.results.NS_ERROR_INVALID_ARG;

        return new flockPhotoPerson();
    }
}

/* module initialisation */
function NSGetModule(comMgr, fileSpec) { return flockPhotoPersonModule; }

