aboutsummaryrefslogtreecommitdiff
path: root/lib/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/app.js')
-rw-r--r--lib/app.js63
1 files changed, 0 insertions, 63 deletions
diff --git a/lib/app.js b/lib/app.js
index 7424b50..d22e2b7 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -42,10 +42,6 @@ function App(sbot, config) {
this.unboxContent = memo({cache: lru(100)}, sbot.private.unbox)
this.reverseNameCache = lru(100)
- this.getFriendInfo = memo({cache: false}, this._getFriendInfo)
- this.getFollows = memo({cache: false}, this._getFollows)
- this.getFollowers = memo({cache: false}, this._getFollowers)
-
this.unboxMsg = this.unboxMsg.bind(this)
this.render = new Render(this, this.opts)
@@ -226,65 +222,6 @@ App.prototype.getFollow = function (source, dest, cb) {
)
}
-App.prototype._getFollows = function (id, cb) {
- var self = this
- pull(
- self.sbot.links({source: id, rel: 'contact', values: true}),
- pull.filter(function (msg) {
- var c = msg && msg.value && msg.value.content
- return c && c.type === 'contact' && msg.value.author === id
- }),
- pull.reduce(function (acc, msg) {
- var c = msg.value.content
- if (c.following) acc[c.contact] = true
- else delete acc[c.contact]
- return acc
- }, {}, cb)
- )
-}
-
-App.prototype._getFollowers = function (id, cb) {
- var self = this
- pull(
- self.sbot.links({dest: id, rel: 'contact', values: true}),
- pull.filter(function (msg) {
- var c = msg && msg.value && msg.value.content
- return c && c.type === 'contact' && c.contact === id
- }),
- pull.reduce(function (acc, msg) {
- var c = msg.value.content
- if (c.following) acc[msg.value.author] = true
- else delete acc[msg.value.author]
- return acc
- }, {}, cb)
- )
-}
-
-App.prototype._getFriendInfo = function (id, cb) {
- var self = this
- var done = multicb({pluck: 1, spread: true})
- self.getFollows(id, done())
- self.getFollowers(id, done())
- done(function (err, followsObj, followersObj) {
- if (err) return cb(err)
- var friends = []
- var follows = []
- var followers = []
- for (var k in followsObj) {
- if (followersObj[k]) friends.push(k)
- else follows.push(k)
- }
- for (var k in followersObj) {
- if (!followsObj[k]) followers.push(k)
- }
- cb(null, {
- friends: friends,
- follows: follows,
- followers: followers,
- })
- })
-}
-
App.prototype.unboxMessages = function () {
return pull(
paramap(this.unboxMsg, 16),