diff --git a/src/message.js b/src/message.js index 7960822bd6b0f8445f874b43821eed1531434673..e007b8e52d2e6a0d393437bf71a960d901eaeb69 100644 --- a/src/message.js +++ b/src/message.js @@ -48,7 +48,7 @@ class Message { } getSenderString() { const name = Contact.load(this.obj.from).toStringEx() - const group = this.obj.group ? Contact.load(this.obj.group).toStringEx() : null + const group = this.obj.group ? Group.load(this.obj.group).toStringEx() : null return '<' + name + (group ? `@${group}` : '') + '>' } getContentString() { @@ -72,9 +72,15 @@ class Message { group() { return this.obj.group } reply(replyContent) { - return new Message() - .set('to' , this.group() ? this.group() : this.from()) - .set('content', replyContent) + const m = new Message() + .set('from' , this.to()) + .set('group' , this.group()) + .set('to' , (this.group() ? this.group() : this.from())) + .set('content' , replyContent) + +console.log(m) + + return m } ready() { diff --git a/src/puppet-web.js b/src/puppet-web.js index eb30fc6e5678380511d0af453b5f48bc9bad7b89..6a731a0f4a6739ea7d422aacd9ccc30a7e9bf32e 100644 --- a/src/puppet-web.js +++ b/src/puppet-web.js @@ -154,7 +154,7 @@ class PuppetWeb extends Puppet { const m = new Message(data) if (!this.user) { log.warn('PuppetWeb', 'onServerMessage() without this.user') - } else if (this.user.id===m.from) { + } else if (this.user.id===m.get('from')) { log.silly('PuppetWeb', 'onServerMessage skip msg send by self') return }