When someones sends an invalid command e.g. /k/k (Two slashes, so that it also can be sent with pidgin.) in the lobby chat by using an external xmpp client, 0ad displays just a timestamp and nothing else. This patch fixes that behaviour by just ignoring invalid commands. Demonstrated without any comment or explanation to me by Hanniba_Baraq (same as @Hannibal_Barca ?).
Details
Use an external xmpp client and send e.g. /k/k. 0ad should display nothing.
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Branch
- https://svn.wildfiregames.com/public/ps/trunk
- Lint
Lint OK - Unit
No Unit Test Coverage - Build Status
Buildable 3865 Build 6726: Vulcan Build (Windows) Jenkins Build 6725: Vulcan Build Jenkins Build 6724: arc lint + arc unit
Event Timeline
Yes, all of that.
Accept under the condition to not contradict the function comment and not add a jshint warning.
Yes. jshint also has the ability to show a warning if some return statements dont return something explicitly when others do afaik.
Successful build - Chance fights ever on the side of the prudent.
Updating workspaces... Build (release)... Build (debug)... Running release tests... Running cxxtest tests (308 tests)....................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (308 tests)....................................................................................................................................................................................................................................................................................................................OK! Checking XML files...
Executing section Default... Executing section Source... Executing section JS... binaries/data/mods/public/gui/lobby/lobby.js | 637| » » case·'name': | | [NORMAL] JSHintBear: | | Expected a 'break' statement before 'default'.
If you see a benefit in not always returning a string, inform me prior or after the commit and correct the JSdoc comment that would be lying in that case before the commit.
Only when the user inputs a wrong command and that is already done.
When someone else is spamming invalid commands into the lobby it should just be ignored by everyone else.
Successful build - Chance fights ever on the side of the prudent.
Updating workspaces... Build (release)... Build (debug)... Running release tests... Running cxxtest tests (308 tests)....................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (308 tests)....................................................................................................................................................................................................................................................................................................................OK! Checking XML files...
Executing section Default... Executing section Source... Executing section JS... binaries/data/mods/public/gui/lobby/lobby.js | 637| » » case·'name': | | [NORMAL] JSHintBear: | | Expected a 'break' statement before 'default'.
binaries/data/mods/public/gui/lobby/lobby.js | ||
---|---|---|
1375 | return undefined; or return ""; |
binaries/data/mods/public/gui/lobby/lobby.js | ||
---|---|---|
1375 | Isn't return; the same as return undefined;? |
binaries/data/mods/public/gui/lobby/lobby.js | ||
---|---|---|
1375 | return; and return undefined; both return undefined. return; is most often if not always used for procedures/methods/voids where the return value is not read from. The conclusion is to always return a value explicitly or always return undefined implicitly. ESLint throws a linting warning for that reason, see link. |