aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-03-18 11:22:30 -0400
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-03-18 16:21:29 -0400
commit4ab88e61d4d24f4e690a047d3316d7ab516db03c (patch)
treed23d6bba5456e270134675a492c76abd898a0afd
parentd6732a0a25115dff558a4218e8c7a96ce9378b73 (diff)
downloadpatchfoo-4ab88e61d4d24f4e690a047d3316d7ab516db03c.tar.gz
patchfoo-4ab88e61d4d24f4e690a047d3316d7ab516db03c.zip
render mutual credit messages
-rw-r--r--lib/render-msg.js18
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)
+}