Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
c148994a
Commit
c148994a
authored
Jul 04, 2015
by
Zach
Browse files
Merge pull request #1206 from ZeldaZach/fix_at_space
Fix Crash on Mention Bug
parents
360498c8
24e54fd2
Changes
1
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/chatview.cpp
View file @
c148994a
...
@@ -312,7 +312,7 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
...
@@ -312,7 +312,7 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
QString
fullMentionUpToSpaceOrEnd
=
(
firstSpace
==
-
1
)
?
message
.
mid
(
1
)
:
message
.
mid
(
1
,
firstSpace
-
1
);
QString
fullMentionUpToSpaceOrEnd
=
(
firstSpace
==
-
1
)
?
message
.
mid
(
1
)
:
message
.
mid
(
1
,
firstSpace
-
1
);
QString
mentionIntact
=
fullMentionUpToSpaceOrEnd
;
QString
mentionIntact
=
fullMentionUpToSpaceOrEnd
;
while
(
fullMentionUpToSpaceOrEnd
.
size
())
do
{
{
if
(
isFullMentionAValidUser
(
userList
,
fullMentionUpToSpaceOrEnd
))
// Is there a user online named this?
if
(
isFullMentionAValidUser
(
userList
,
fullMentionUpToSpaceOrEnd
))
// Is there a user online named this?
{
{
...
@@ -343,8 +343,8 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
...
@@ -343,8 +343,8 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
cursor
.
setCharFormat
(
defaultFormat
);
cursor
.
setCharFormat
(
defaultFormat
);
break
;
break
;
}
}
else
if
(
fullMentionUpToSpaceOrEnd
.
right
(
1
).
indexOf
(
notALetterOrNumber
)
==
-
1
)
else
if
(
fullMentionUpToSpaceOrEnd
.
right
(
1
).
indexOf
(
notALetterOrNumber
)
==
-
1
||
fullMentionUpToSpaceOrEnd
.
size
()
<
2
)
{
{
cursor
.
insertText
(
"@"
+
mentionIntact
,
defaultFormat
);
cursor
.
insertText
(
"@"
+
mentionIntact
,
defaultFormat
);
message
=
message
.
mid
(
mentionIntact
.
size
()
+
1
);
message
=
message
.
mid
(
mentionIntact
.
size
()
+
1
);
cursor
.
setCharFormat
(
defaultFormat
);
cursor
.
setCharFormat
(
defaultFormat
);
...
@@ -352,9 +352,10 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
...
@@ -352,9 +352,10 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
}
}
else
else
{
{
fullMentionUpToSpaceOrEnd
=
fullMentionUpToSpaceOrEnd
.
left
(
fullMentionUpToSpaceOrEnd
.
size
()
-
1
);
fullMentionUpToSpaceOrEnd
.
chop
(
1
);
}
}
}
}
while
(
fullMentionUpToSpaceOrEnd
.
size
());
}
}
}
}
else
else
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment