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

fix message from address & group bug

上级 f37354c5
......@@ -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() {
......
......@@ -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
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册