1
0
mirror of https://github.com/deavmi/birchwood synced 2024-09-20 09:23:38 +02:00
- Added `nick(string)` command to allow setting of nickname

Unit tests

- Moved from `client.command(Message)` to `client.nick(string)` for setting nickname
This commit is contained in:
Tristan B. Velloza Kildaire 2023-03-25 13:11:58 +02:00
parent 3c347853e4
commit 037118afa9

View File

@ -188,6 +188,29 @@ public class Client : Thread
}
}
/**
* Requests setting of the provided nickname
*
* Params:
* nickname = the nickname to request
* Throws:
* BirchwoodException on invalid nickname
*/
public void nick(string nickname)
{
/* Ensure no illegal characters in nick name */
if(isValidText(nickname))
{
/* Set the nick */
Message nickMessage = new Message("", "NICK", nickname);
sendMessage(nickMessage);
}
else
{
throw new BirchwoodException(ErrorType.ILLEGAL_CHARACTERS);
}
}
/**
* Joins the requested channel
*
@ -1030,7 +1053,8 @@ public class Client : Thread
// TODO: The below should all be automatic, maybe once IRCV3 is done
// ... we should automate sending in NICK and USER stuff
Thread.sleep(dur!("seconds")(2));
client.command(new Message("", "NICK", "birchwood")); // TODO: add nickcommand
// client.command(new Message("", "NICK", "birchwood")); // TODO: add nickcommand
client.nick("birchwood");
Thread.sleep(dur!("seconds")(2));
client.command(new Message("", "USER", "doggie doggie irc.frdeenode.net :Tristan B. Kildaire"));