renamed user.id to user.jid

This commit is contained in:
Adhiraj
2020-08-28 20:22:35 +05:30
parent 890fb726f1
commit 828be7f240
8 changed files with 22 additions and 19 deletions

View File

@@ -34,7 +34,7 @@ export class WAConnection extends Base {
requestPresenceUpdate = async (jid: string) => this.query({json: ['action', 'presence', 'subscribe', jid]})
/** Query the status of the person (see groupMetadata() for groups) */
async getStatus (jid?: string) {
const status: { status: string } = await this.query({json: ['query', 'Status', jid || this.user.id]})
const status: { status: string } = await this.query({json: ['query', 'Status', jid || this.user.jid]})
return status
}
async setStatus (status: string) {
@@ -47,7 +47,7 @@ export class WAConnection extends Base {
]
]
)
this.emit ('user-status-update', { jid: this.user.id, status })
this.emit ('user-status-update', { jid: this.user.jid, status })
return response
}
/** Get your contacts */
@@ -122,7 +122,7 @@ export class WAConnection extends Base {
]
]
const response = await (this.setQuery ([query], [WAMetric.picture, 136], tag) as Promise<WAProfilePictureChange>)
if (jid === this.user.id) this.user.imgUrl = response.eurl
if (jid === this.user.jid) this.user.imgUrl = response.eurl
else if (this.chats.get(jid)) {
this.chats.get(jid).imgUrl = response.eurl
this.emit ('chat-update', { jid, imgUrl: response.eurl })