2025-11-05 17:04:23 -03:00

25 lines
561 B
JavaScript

import JID from "@xmpp/jid";
import Context from "./Context.js";
export default class OutgoingContext extends Context {
constructor(entity, stanza) {
super(entity, stanza);
const { jid } = entity;
const { domain } = entity.options ?? {};
const from = stanza.attrs.from || jid?.toString();
const to = stanza.attrs.to || domain;
if (from) this.from = new JID(from);
if (to) {
this.to = new JID(to);
this.local = this.to.local;
this.domain = this.to.domain;
this.resource = this.to.resource;
}
}
}