compose SnowlFeed from SnowlSource attributes

This commit is contained in:
Myk Melez 2009-03-03 17:02:11 -08:00
Родитель 5f5d51a39e
Коммит 9c91b11e8c
1 изменённых файлов: 32 добавлений и 68 удалений

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

@ -108,74 +108,6 @@ SnowlFeed.prototype = {
},
//**************************************************************************//
// SnowlSource
get refreshInterval() {
return SnowlSource.refreshInterval;
},
id: null,
type: null,
name: null,
machineURI: null,
get principal() {
return SnowlSource.__lookupGetter__("principal").call(this);
},
humanURI: null,
username: null,
_lastRefreshed: null,
get lastRefreshed() {
return SnowlSource.__lookupGetter__("lastRefreshed").call(this);
},
set lastRefreshed(newValue) {
return SnowlSource.__lookupSetter__("lastRefreshed").call(this, newValue);
},
importance: null,
placeID: null,
get faviconSvc() {
return SnowlSource.faviconSvc;
},
get faviconURI() {
return SnowlSource.__lookupGetter__("faviconURI").call(this);
},
// refresh is defined elsewhere.
//refresh: function(refreshTime) {},
persist: function() {
SnowlSource.persist.call(this);
},
get _stmtGetInternalIDForExternalID() {
return SnowlSource._stmtGetInternalIDForExternalID;
},
_getInternalIDForExternalID: function(externalID) {
return SnowlSource._getInternalIDForExternalID.call(this, externalID);
},
get _stmtInsertPart() {
return SnowlSource._stmtInsertPart;
},
get _stmtInsertPartText() {
return SnowlSource._stmtInsertPartText;
},
addPart: function(messageID, content, mediaType, partType, baseURI, languageTag) {
return SnowlSource.addPart.call(this, messageID, content, mediaType, partType, baseURI, languageTag);
},
//**************************************************************************//
// XPCOM Interface Goo
@ -748,3 +680,35 @@ SnowlFeed.prototype = {
};
SnowlService.addAccountType(SnowlFeed);
/**
* Acquire attributes (properties, methods, getters/setters) from another
* object. Doesn't acquire attributes that already exist in the acquiring
* object (i.e. that have been overridden by that object).
*
* FIXME: give the acquiring object access to the attributes it overrides.
*
* @param obj {Object} the object from which to acquire attributes
*/
Object.prototype.acquire = function(obj) {
for (let attr in obj) {
// Don't acquire attributes we have overridden.
if (attr in this)
continue;
let getter = obj.__lookupGetter__(attr);
let setter = obj.__lookupSetter__(attr);
if (getter || setter) {
if (getter)
this.__defineGetter__(attr, getter);
if (setter)
this.__defineSetter__(attr, setter);
}
else
this[attr] = obj[attr];
}
}
SnowlFeed.prototype.acquire(SnowlSource);