From 4ab88e61d4d24f4e690a047d3316d7ab516db03c Mon Sep 17 00:00:00 2001 From: cel Date: Sat, 18 Mar 2017 11:22:30 -0400 Subject: render mutual credit messages --- lib/render-msg.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib/render-msg.js') 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) +} -- cgit v1.2.3