You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#292 tried to solve a very real problem - all kinds of code was expecting a room/nick, and couldn't handle different kinds of JID.
For some reason, the solution was to make such code accept an object with various keys. That object would then be turned into a JID according to complex and hard to explain rules.
This led to code having to pass undefined to get the current room broadcast address, {} to get the domain, {room: null} to get the MUC domain, and {jid: '..'} to pass through a JID directly.
The sane way, I now realize, is to simply make all functions expect a JID. domain values can be taken directly from the configuration, a jid can be passed directly, and the only thing remaining is a function that turns a roomnick into a JID.
/**
* Generate a JID from a roomnick.
*
* @param {string} room (defaults to current room)
* @param {string} nick (leave empty for groupchat)
*
*/
jidFromRoomNick: function({room, nick}={}) {
return new this.JID({
domain: config.xmpp.mucService,
node: room || this.room.current,
resource: nick
});
},
The text was updated successfully, but these errors were encountered:
#292 tried to solve a very real problem - all kinds of code was expecting a room/nick, and couldn't handle different kinds of JID.
For some reason, the solution was to make such code accept an object with various keys. That object would then be turned into a JID according to complex and hard to explain rules.
This led to code having to pass
undefined
to get the current room broadcast address,{}
to get the domain,{room: null}
to get the MUC domain, and{jid: '..'}
to pass through a JID directly.The sane way, I now realize, is to simply make all functions expect a JID. domain values can be taken directly from the configuration, a jid can be passed directly, and the only thing remaining is a function that turns a roomnick into a JID.
The text was updated successfully, but these errors were encountered: