#4482 closed defect (fixed)
Improve XmppClient GUIMessage struct handiness
Reported by: | elexis | Owned by: | |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 23 |
Component: | Multiplayer lobby | Keywords: | |
Cc: | Patch: | Phab:D835 |
Description (last modified by )
The lobby xmpp code sends messages to JS via custom struct. But that is bad since it hardcodes a set of possible arguments. Some examples:
- If someone changes the nickname, the old nick will be sent in
text
and the new name will be sent indata
, entirely undescriptive - If someone is kicked (https://code.wildfiregames.com/D116), the nickname will be sent in
text and the disconnect reason in the
data` field
The custom struct is then parsed to a JS::MutableHandleValue
in GuiPollMessage
.
Instead we should create those JS values directly, thus allowing to easily add further arguments. It would also allow merging the "kick" and "ban" case and just pass another boolean.
The code will then appear comparable to CNetClient::GuiPoll
and PushGuiMessage
.
Change History (8)
comment:1 by , 7 years ago
Description: | modified (diff) |
---|
comment:2 by , 7 years ago
Keywords: | simple removed |
---|---|
Milestone: | Backlog → Alpha 23 |
Patch: | → Phab:D835 |
Priority: | Nice to Have → Should Have |
comment:4 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Summary: | Nuke XmppClient GUIMessage struct → Improve XmppClient GUIMessage struct handiness |
Works for now. Creating a custom ScriptInterface by itself can cause trouble and isn't necessary or an enhancement.
comment:5 by , 6 years ago
Since we need a third property in at least one case, the ScriptInterface approach might be nicer, see #4877.
comment:6 by , 5 years ago
In r22856:
Support creating lobby GUI messages with arbitrary arguments instead of forcing every message type into the same struct type, refs #4877 / rP19514 / D339.
Creates the GUI messages directly as JS::Values and removes the intermediary rigid struct.
Implementation similar to ScriptInterface::CreateObject? from D2080.
Differential Revision: https://code.wildfiregames.com/D2264
Tested on: clang 8.0.1, Jenkins
It would becmoe a
std::deque<JS::Heap<JS::Value>> m_GuiMessageQueue
just like in theNetClient.h
.