HomeWildfire Games

Don't hardcode the "0ad" resource into lobby XMPP & hosting


Don't hardcode the "0ad" resource into lobby XMPP & hosting

XMPP JID has a concept of 'resources', which can be used to differentiate multiple clients of the same account.

We currently hardcode this 'resource' to '0ad' in two places:

  • The 0 A.D. client always uses '0ad'
  • The network code expects a host resource to be '0ad' when connecting.

As noted in https://code.wildfiregames.com/rP21520#31215, it is less effort to store the JI
D directly. This patch does that. It also makes 0 A.D. use a different resource each time.
Note that resources ought not contain particular information, as the XMPP server is free to
clobber it. I keep '0ad-' here for debug purposes.

This allows:

  • multiple 0 A.D. instances to log on the lobby at the same time (not massively useful, but good for debugging sometimes)
  • hosting a game with a custom resource, which will potentially make it easier to have dedi

cated servers on one account.

Note that hosting multiple games on one account is currently not supported and will have weird behaviour on the lobbybots side. They should be upgraded independently of this.

Refs #3556

Differential Revision: https://code.wildfiregames.com/D3500

Event Timeline

Silier raised a concern with this commit.May 9 2021, 4:19 PM
Silier added a subscriber: Silier.

windows build is broken

"D:\0A.Ddev\build\workspaces\vs2017\pyrogenesis.sln" (pyrogenesis;test target) (1) ->

"D:\0A.Ddev\build\workspaces\vs2017\pyrogenesis.vcxproj.metaproj" (default target) (2) ->
"D:\0A.Ddev\build\workspaces\vs2017\pyrogenesis.vcxproj" (default target) (4) ->
(Link target) ->
  lobby.lib(XmppClient.obj) : error LNK2019: unresolved external symbol "public: class glooxwrapper::string cons
t __thiscall glooxwrapper::Client::getJID(void)const " (?getJID@Client@glooxwrapper@@QBE?BVstring@2@XZ) referenc
ed in function "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<
char> > __thiscall XmppClient::GetJID(void)const " (?GetJID@XmppClient@@UBE?AV?$basic_string@DU?$char_traits@D@s
td@@V?$allocator@D@2@@std@@XZ) [D:\0A.Ddev\build\workspaces\vs2017\pyrogenesis.vcxproj]
  ..\..\..\binaries\system\pyrogenesis.exe : fatal error LNK1120: 1 unresolved externals [D:\0A.Ddev\build\works
This commit now has outstanding concerns.May 9 2021, 4:19 PM
Silier resigned from this commit.May 9 2021, 4:23 PM
This commit no longer requires audit.May 9 2021, 4:23 PM