Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
e88cfa1b
Commit
e88cfa1b
authored
6 years ago
by
Konstantinos Sideris
Browse files
Options
Downloads
Patches
Plain Diff
Use <em></em> for m.emote messages
parent
7a6816a9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/timeline/TimelineItem.cpp
+21
-8
21 additions, 8 deletions
src/timeline/TimelineItem.cpp
with
21 additions
and
8 deletions
src/timeline/TimelineItem.cpp
+
21
−
8
View file @
e88cfa1b
...
...
@@ -310,27 +310,36 @@ TimelineItem::TimelineItem(mtx::events::MessageType ty,
auto
displayName
=
Cache
::
displayName
(
room_id_
,
userid
);
auto
timestamp
=
QDateTime
::
currentDateTime
();
// Generate the html body to rendered.
auto
formatted_body
=
utils
::
markdownToHtml
(
body
);
// Extract the plain text version for the sidebar.
body
=
QString
::
fromStdString
(
utils
::
stripHtml
(
formatted_body
));
if
(
ty
==
mtx
::
events
::
MessageType
::
Emote
)
{
body
=
QString
(
"%1 %2"
).
arg
(
displayName
).
arg
(
body
);
descriptionMsg_
=
{
""
,
userid
,
body
,
utils
::
descriptiveTime
(
timestamp
),
timestamp
};
formatted_body
=
QString
(
"<em>%1</em>"
).
arg
(
formatted_body
);
descriptionMsg_
=
{
""
,
userid
,
QString
(
"* %1 %2"
).
arg
(
displayName
).
arg
(
body
),
utils
::
descriptiveTime
(
timestamp
),
timestamp
};
}
else
{
descriptionMsg_
=
{
"You: "
,
userid
,
body
,
utils
::
descriptiveTime
(
timestamp
),
timestamp
};
}
body
=
utils
::
markdownToHtml
(
body
);
body
=
utils
::
linkifyMessage
(
body
);
formatted_body
=
utils
::
linkifyMessage
(
formatted_body
);
generateTimestamp
(
timestamp
);
if
(
withSender
)
{
generateBody
(
userid
,
displayName
,
body
);
generateBody
(
userid
,
displayName
,
formatted_
body
);
setupAvatarLayout
(
displayName
);
AvatarProvider
::
resolve
(
room_id_
,
userid
,
this
,
[
this
](
const
QImage
&
img
)
{
setUserAvatar
(
img
);
});
}
else
{
generateBody
(
body
);
generateBody
(
formatted_
body
);
setupSimpleLayout
();
}
...
...
@@ -533,9 +542,13 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Emote>
auto
timestamp
=
QDateTime
::
fromMSecsSinceEpoch
(
event
.
origin_server_ts
);
auto
displayName
=
Cache
::
displayName
(
room_id_
,
sender
);
auto
emoteMsg
=
QString
(
"%1 %2"
).
arg
(
displayName
).
arg
(
formatted_body
);
formatted_body
=
QString
(
"<em>%1</em>"
).
arg
(
formatted_body
);
descriptionMsg_
=
{
""
,
sender
,
emoteMsg
,
utils
::
descriptiveTime
(
timestamp
),
timestamp
};
descriptionMsg_
=
{
""
,
sender
,
QString
(
"* %1 %2"
).
arg
(
displayName
).
arg
(
body
),
utils
::
descriptiveTime
(
timestamp
),
timestamp
};
generateTimestamp
(
timestamp
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment