diff options
Diffstat (limited to 'lib/app.js')
-rw-r--r-- | lib/app.js | 20 |
1 files changed, 7 insertions, 13 deletions
@@ -47,9 +47,7 @@ function App(sbot, config) { this.about = new About(this, sbot.id) this.msgCache = lru(100) this.getMsg = memo({cache: this.msgCache}, getMsgWithValue, sbot) - this.getMsgOoo = sbot.ooo - ? memo({cache: this.msgCache}, sbot.ooo.get) - : function (id, cb) { cb(new Error('missing ssb-ooo plugin')) } + this.getMsgOoo = memo({cache: this.msgCache}, this.getMsgOoo) this.getAbout = memo({cache: this.aboutCache = lru(500)}, this._getAbout.bind(this)) this.unboxContent = memo({cache: lru(100)}, sbot.private.unbox) @@ -184,6 +182,12 @@ App.prototype.getMsgDecrypted = function (key, cb) { }) } +App.prototype.getMsgOoo = function (key, cb) { + var ooo = this.sbot.ooo + if (!ooo) return cb(new Error('missing ssb-ooo plugin')) + ooo.get(key, cb) +} + App.prototype.getMsgDecryptedOoo = function (key, cb) { var self = this this.getMsgOoo(key, function (err, msg) { @@ -346,16 +350,6 @@ function getMsgWithValue(sbot, id, cb) { }) } -function getMsgOooWithValueCreate(sbot) { - if (!sbot.ooo) { - var err = new Error('missing ssb-ooo plugin') - return function (id, cb) { - cb(null, err) - } - } - return sbot.ooo.get -} - App.prototype._getAbout = function (id, cb) { var self = this if (!u.isRef(id)) return cb(null, {}) |