1
0
mirror of https://github.com/deavmi/birchwood synced 2024-09-20 13:43:19 +02:00
- `user(string, string, string, string)` now checks for illegal characters
This commit is contained in:
Tristan B. Velloza Kildaire 2023-06-28 23:53:08 +02:00
parent d2b4ccfeda
commit f20c078fc3

View File

@ -876,15 +876,25 @@ public class Client : Thread
* hostname = the hostname to use * hostname = the hostname to use
* servername = the servername to use * servername = the servername to use
* realname = your realname * realname = your realname
* Throws:
* `BirchwoodException` if the username, jostname,
* servername or realname contains illegal characters
*/ */
public void user(string username, string hostname, string servername, string realname) public void user(string username, string hostname, string servername, string realname)
{ {
// TODO: Implement me properly with all required checks // TODO: Implement me properly with all required checks
if(isValidText(username) && isValidText(hostname) && isValidText(servername) && isValidText(realname))
{
/* User message */ /* User message */
Message userMessage = new Message("", "USER", username~" "~hostname~" "~servername~" "~":"~realname); Message userMessage = new Message("", "USER", username~" "~hostname~" "~servername~" "~":"~realname);
sendMessage(userMessage); sendMessage(userMessage);
} }
else
{
throw new BirchwoodException(ErrorType.ILLEGAL_CHARACTERS, "Illegal characters present in either the username, hostname, server name or real name");
}
}
/** /**
* Adds a given message onto the receieve queue for * Adds a given message onto the receieve queue for