summaryrefslogtreecommitdiff
path: root/Applications/IRCClient/IRCClient.cpp
diff options
context:
space:
mode:
authorBrendan Coles <bcoles@gmail.com>2020-04-08 16:45:00 +0000
committerAndreas Kling <kling@serenityos.org>2020-04-08 18:42:01 +0200
commit036fb4c62188f984a4eefa4948d1b807320463da (patch)
tree22d1efdd03fe2df88e74be50b1f9910570d8a13a /Applications/IRCClient/IRCClient.cpp
parent66f7c8e0e87e7b60ff87b5ab7d8375684834b1ab (diff)
downloadserenity-036fb4c62188f984a4eefa4948d1b807320463da.zip
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.
Diffstat (limited to 'Applications/IRCClient/IRCClient.cpp')
-rw-r--r--Applications/IRCClient/IRCClient.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Applications/IRCClient/IRCClient.cpp b/Applications/IRCClient/IRCClient.cpp
index 83314e3555..c00d814654 100644
--- a/Applications/IRCClient/IRCClient.cpp
+++ b/Applications/IRCClient/IRCClient.cpp
@@ -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) {