1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:37:37 +00:00

IRCClient: Add nick_without_prefix and nick_at helpers

`IRCChannelMemberListModel->nick_at` returns the nick name of a channel
member at the specified index.

`IRCClient->nick_without_prefix` returns a formatted nick name without
privilege prefix.
This commit is contained in:
Brendan Coles 2020-04-08 16:45:00 +00:00 committed by Andreas Kling
parent 66f7c8e0e8
commit 036fb4c621
5 changed files with 29 additions and 33 deletions

View file

@ -423,6 +423,14 @@ void IRCClient::handle_user_input_in_server(const String& input)
return handle_user_command(input);
}
String IRCClient::nick_without_prefix(const String& nick)
{
assert(!nick.is_empty());
if (IRCClient::is_nick_prefix(nick[0]))
return nick.substring(1, nick.length() - 1);
return nick;
}
bool IRCClient::is_nick_prefix(char ch)
{
switch (ch) {