New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NetPlay: Limit nickname length #7410
NetPlay: Limit nickname length #7410
Conversation
cd827c2
to
cbc7928
Compare
|
Is the limit in this PR actually 30 characters, or is it 30 bytes (when encoded as UTF-8)? The latter might be a bit restrictive for e.g. Japanese, since it would mean you only can use 10 characters. |
|
It's based on whatever |
|
Then it's 30 bytes. |
cbc7928
to
9d9c9de
Compare
Source/Core/Core/NetPlayProto.h
Outdated
| @@ -164,6 +165,7 @@ enum | |||
|
|
|||
| constexpr u32 NETPLAY_LZO_IN_LEN = 1024 * 64; | |||
| constexpr u32 NETPLAY_LZO_OUT_LEN = NETPLAY_LZO_IN_LEN + (NETPLAY_LZO_IN_LEN / 16) + 64 + 3; | |||
| const unsigned int MAX_NAME_LENGTH = 30; | |||
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Core/NetPlayServer.cpp
Outdated
| delete (PlayerId*)netEvent.peer->data; | ||
| netEvent.peer->data = nullptr; | ||
| sf::Packet spac; | ||
| spac << (MessageId)error; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Core/NetPlayServer.cpp
Outdated
| Send(netEvent.peer, spac); | ||
| if (netEvent.peer->data) | ||
| { | ||
| delete (PlayerId*)netEvent.peer->data; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Core/NetPlayServer.cpp
Outdated
| } | ||
| else | ||
| { | ||
| auto it = m_players.find(*(PlayerId*)netEvent.peer->data); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
9d9c9de
to
f2c53fb
Compare
Source/Core/Common/StringUtil.cpp
Outdated
| @@ -449,6 +449,12 @@ void StringPopBackIf(std::string* s, char c) | |||
| s->pop_back(); | |||
| } | |||
|
|
|||
| size_t StringUTF8Size(const std::string& str) | |||
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
f2c53fb
to
fc35bbd
Compare
857d52a
to
9a42b03
Compare
9a42b03
to
2def4d4
Compare
2def4d4
to
9a42b03
Compare
9a42b03
to
92a95ec
Compare
92a95ec
to
18fc714
Compare
18fc714
to
dbf9c14
Compare
dbf9c14
to
9b07d1c
Compare
9b07d1c
to
68e6f08
Compare
Ridiculously long nicknames cause UI silliness, so 30 characters seems like a reasonable limit, as it's the same as the forum.
68e6f08
to
037aa21
Compare
32767 character names is more than a bit silly, so I figured adding a (server enforced) length limit would be a good idea. 30 characters seems like a reasonable limit, as it's the same as the forums.