5

In XMPP (i.e. gtalk) we can set resource to our wanting (specifying machine/location/etc) and this works well with all/most servers and clients. But in case of google it doesn't exactly work as expected because each time user connect google appends random string to the resource set by user. This is particularly annoying because many clients differentiate user chats by jid AND resource part which results in multiple windows/tabs open after one is reconnected (and new resource is generated).

tl;dr - is there a way to prevent google from appending random string to resource set by user?

Wojtek
  • 1,316
  • 6
  • 24

2 Answers2

1

Short answer, there is no way. A resource should be unpredictable for security reasons. And The GTalk server enforces this by adding a random string to your resource.

Alex
  • 3,936
  • 2
  • 17
  • 20
  • 4
    Could you explain *why* it should be unpredictable? I've always enjoyed sending messages to certain resources (e.g. `alice@example.org/mobile` if it's urgent, `alice@example.org/home` if not) – unor Jan 31 '13 at 13:56
  • when I can guess your resource and know your jid I can spam you with IQs – Alex Jan 31 '13 at 15:17
  • And this "IQ" spam is only possible if you guess/know the resource? So it would not be possible to simply use `alice@example.org` without specifying any resource? – unor Jan 31 '13 at 18:34
  • yes, Iqs are always sent to the full jid (with some exceptions like vcard) – Alex Jan 31 '13 at 19:26
  • I see. If you use client settings like "Don't allow messages from contacts not on your roster", would this prevent this kind of spam? – unor Jan 31 '13 at 19:33
  • 1
    then you don't get it displayed, but it still gets routed through the network to your client which is bad. Just use unpredictable resources and you are fine. We have other xmpp protocol extensions today like caps or disco to expose the stuff we put ages ago in the resource until we found better ways. See also Joe's reply above. – Alex Jan 31 '13 at 22:17
  • I understand. Thanks for the explanation :) – unor Feb 01 '13 at 00:44
1

In addition to @Alex's correct answer, don't use resources semantically. For chats, clients really shouldn't treat each resource as a separate conversation anymore. We learned that lesson over a decade ago. For identifying the client, use XEP-0115 instead of a hard-coded resource.

Joe Hildebrand
  • 9,616
  • 1
  • 32
  • 45
  • 5
    What are you referring to with "We learned that lesson over a decade ago"? – unor Jan 31 '13 at 13:57
  • 1
    Ok, but where/how do we fit resource priority in that context? Not to mention any control of where we want to sent the message (i.e to what 'end point')? – Wojtek Jan 31 '13 at 14:51
  • @Joe Hildebrand Would you mind answering comments asking for clarification? – Piotr Dobrogost Apr 01 '20 at 09:27