simple-xmpp / node-simple-xmpp

Simple High Level NodeJS XMPP Client
302 stars 90 forks source link

Incorrect from field for chat started from within a chatroom #82

Closed dceejay closed 3 years ago

dceejay commented 5 years ago

If I use a 3rd party client (Swift on Mac) to join a room - then click on a participant to start a direct chat with them - then the stanza.from arriving at the chatroom looks like

'test@rooms.blah.im/me@blah.im'

with the name of the room first and the sender second - and the stanza.type is chat. The handler for the chat type only looks at the first part and so reports (in this case) - test@rooms.blah.im (i.e. the room) as the sender...

Should it maybe also look at the second part and if the second part (after the slash) contains an @ then use that as the sender ?

I don't know enough of the semantics of the two parts to know if this would be a valid thing to do in all cases ? Any thoughts ? Happy to raise a PR if it makes sense.

dceejay commented 5 years ago

On deeper look - it seems the second part can also be the nickname - so no @ - in which case the whole from address should be sent... - maybe if the second part isn't a 36 char UUID then send the whole thing as the sender ?