Skip to content
Snippets Groups Projects
Commit a6fa70df authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Correctly handle nicks without any alphabetical characters

parent c1464aab
Branches
Tags
No related merge requests found
......@@ -181,8 +181,19 @@ class Editor(
if (it is AutoCompleteItem.UserItem) {
val nickName = it.nick
val senderColorIndex = IrcUserUtils.senderColor(nickName)
val initial = nickName.trimStart('-', '_', '[', ']', '{', '}', '|', '`', '^', '.', '\\')
.firstOrNull()?.toUpperCase().toString()
val rawInitial = nickName.trimStart('-',
'_',
'[',
']',
'{',
'}',
'|',
'`',
'^',
'.',
'\\')
.firstOrNull() ?: nickName.firstOrNull()
val initial = rawInitial?.toUpperCase().toString()
val senderColor = senderColors[senderColorIndex]
fun formatNick(nick: CharSequence): CharSequence {
......
......@@ -149,8 +149,9 @@ class QuasselMessageRenderer @Inject constructor(
val content = contentFormatter.format(context, message.content.content, highlight)
val nickName = HostmaskHelper.nick(message.content.sender)
val senderColorIndex = IrcUserUtils.senderColor(nickName)
val initial = nickName.trimStart('-', '_', '[', ']', '{', '}', '|', '`', '^', '.', '\\')
.firstOrNull()?.toUpperCase().toString()
val rawInitial = nickName.trimStart('-', '_', '[', ']', '{', '}', '|', '`', '^', '.', '\\')
.firstOrNull() ?: nickName.firstOrNull()
val initial = rawInitial?.toUpperCase().toString()
val senderColor = if (Message_Flag.of(message.content.flag).hasFlag(Message_Flag.Self))
selfColor
else
......
......@@ -78,8 +78,9 @@ class NickListFragment : ServiceBoundFragment() {
it.map {
val nickName = it.nick
val senderColorIndex = IrcUserUtils.senderColor(nickName)
val initial = nickName.trimStart('-', '_', '[', ']', '{', '}', '|', '`', '^', '.', '\\')
.firstOrNull()?.toUpperCase().toString()
val rawInitial = nickName.trimStart('-', '_', '[', ']', '{', '}', '|', '`', '^', '.', '\\')
.firstOrNull() ?: nickName.firstOrNull()
val initial = rawInitial?.toUpperCase().toString()
val senderColor = senderColors[senderColorIndex]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment