diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-03-18 11:22:30 -0400 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-03-18 16:21:29 -0400 |
commit | 4ab88e61d4d24f4e690a047d3316d7ab516db03c (patch) | |
tree | d23d6bba5456e270134675a492c76abd898a0afd | |
parent | d6732a0a25115dff558a4218e8c7a96ce9378b73 (diff) | |
download | patchfoo-4ab88e61d4d24f4e690a047d3316d7ab516db03c.tar.gz patchfoo-4ab88e61d4d24f4e690a047d3316d7ab516db03c.zip |
render mutual credit messages
-rw-r--r-- | lib/render-msg.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js index 645e6b9..3fd845d 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -209,6 +209,8 @@ RenderMsg.prototype.message = function (raw, cb) { case 'robeson/update': return this.update(cb) case 'wifi-network': return this.wifiNetwork(cb) + case 'mutual/credit': return this.mutualCredit(cb) + case 'mutual/account': return this.mutualAccount(cb) default: return this.object(cb) } } @@ -599,3 +601,19 @@ RenderMsg.prototype.wifiNetwork = function (cb) { ), ], cb) } + +RenderMsg.prototype.mutualCredit = function (cb) { + var self = this + self.link(self.c.account, function (err, a) { + if (err) return cb(err) + self.wrapMini([ + 'credits ', a || '?', ' ', + self.c.amount, ' ', self.c.currency, + self.c.memo ? [' for ', h('q', self.c.memo)] : '' + ], cb) + }) +} + +RenderMsg.prototype.mutualAccount = function (cb) { + return this.object(cb) +} |