提交 79a41a36 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

fix message from address & group bug

上级 f37354c5
...@@ -48,7 +48,7 @@ class Message { ...@@ -48,7 +48,7 @@ class Message {
} }
getSenderString() { getSenderString() {
const name = Contact.load(this.obj.from).toStringEx() 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}` : '') + '>' return '<' + name + (group ? `@${group}` : '') + '>'
} }
getContentString() { getContentString() {
...@@ -72,9 +72,15 @@ class Message { ...@@ -72,9 +72,15 @@ class Message {
group() { return this.obj.group } group() { return this.obj.group }
reply(replyContent) { reply(replyContent) {
return new Message() const m = new Message()
.set('to' , this.group() ? this.group() : this.from()) .set('from' , this.to())
.set('content', replyContent) .set('group' , this.group())
.set('to' , (this.group() ? this.group() : this.from()))
.set('content' , replyContent)
console.log(m)
return m
} }
ready() { ready() {
......
...@@ -154,7 +154,7 @@ class PuppetWeb extends Puppet { ...@@ -154,7 +154,7 @@ class PuppetWeb extends Puppet {
const m = new Message(data) const m = new Message(data)
if (!this.user) { if (!this.user) {
log.warn('PuppetWeb', 'onServerMessage() without 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') log.silly('PuppetWeb', 'onServerMessage skip msg send by self')
return return
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册