Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vmj-qt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
vmj-qt
Commits
74404d88
Commit
74404d88
authored
Aug 29, 2022
by
Tijmen de Mes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed chatview to add messages ordered by date and time
parent
b703b4f6
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
5 deletions
+29
-5
chatwindow.py
blink/chatwindow.py
+25
-1
message.html
resources/chat/styles/Smooth Operator/html/message.html
+1
-1
message_continuation.html
...hat/styles/Smooth Operator/html/message_continuation.html
+1
-1
message.html
resources/chat/styles/Stockholm/html/message.html
+1
-1
message_continuation.html
...rces/chat/styles/Stockholm/html/message_continuation.html
+1
-1
No files found.
blink/chatwindow.py
View file @
74404d88
...
@@ -22,6 +22,7 @@ from application.system import makedirs
...
@@ -22,6 +22,7 @@ from application.system import makedirs
from
collections.abc
import
MutableSet
from
collections.abc
import
MutableSet
from
collections
import
deque
from
collections
import
deque
from
datetime
import
datetime
,
timedelta
,
timezone
from
datetime
import
datetime
,
timedelta
,
timezone
from
dateutil.tz
import
tzlocal
from
itertools
import
count
from
itertools
import
count
from
lxml
import
etree
,
html
from
lxml
import
etree
,
html
from
lxml.html.clean
import
autolink
from
lxml.html.clean
import
autolink
...
@@ -669,6 +670,7 @@ class ChatWidget(base_class, ui_class):
...
@@ -669,6 +670,7 @@ class ChatWidget(base_class, ui_class):
self
.
last_message
=
None
self
.
last_message
=
None
self
.
session
=
session
self
.
session
=
session
self
.
history_loaded
=
False
self
.
history_loaded
=
False
self
.
timestamp_rendered_messages
=
[]
if
session
is
not
None
:
if
session
is
not
None
:
notification_center
=
NotificationCenter
()
notification_center
=
NotificationCenter
()
notification_center
.
add_observer
(
ObserverWeakrefProxy
(
self
),
sender
=
session
.
blink_session
)
notification_center
.
add_observer
(
ObserverWeakrefProxy
(
self
),
sender
=
session
.
blink_session
)
...
@@ -691,6 +693,25 @@ class ChatWidget(base_class, ui_class):
...
@@ -691,6 +693,25 @@ class ChatWidget(base_class, ui_class):
exists
=
self
.
chat_element
.
findFirst
(
f
'#text-{message.id}'
)
exists
=
self
.
chat_element
.
findFirst
(
f
'#text-{message.id}'
)
if
not
exists
.
isNull
():
if
not
exists
.
isNull
():
return
return
if
self
.
last_message
is
not
None
and
not
self
.
last_message
.
history
and
message
.
history
:
message
.
history
=
False
for
i
,
(
timestamp
,
id
)
in
enumerate
(
self
.
timestamp_rendered_messages
):
if
timestamp
>=
message
.
timestamp
:
insertion_point
=
self
.
chat_element
.
findFirst
(
f
'#message-{id}'
)
if
message
.
is_related_to
(
self
.
last_message
):
message
.
consecutive
=
True
sibling
=
insertion_point
.
previousSibling
()
sibling
.
appendInside
(
message
.
to_html
(
self
.
style
,
user_icons
=
self
.
user_icons_css_class
)
.
replace
(
"<div id=
\"
insert
\"
></div>"
,
''
))
else
:
insertion_point
.
prependOutside
(
message
.
to_html
(
self
.
style
,
user_icons
=
self
.
user_icons_css_class
)
.
replace
(
"<div id=
\"
insert
\"
></div>"
,
''
))
self
.
timestamp_rendered_messages
.
insert
(
i
,
(
message
.
timestamp
,
message
.
id
))
self
.
last_message
=
message
return
insertion_point
=
self
.
chat_element
.
findFirst
(
'#insert'
)
insertion_point
=
self
.
chat_element
.
findFirst
(
'#insert'
)
if
message
.
is_related_to
(
self
.
last_message
):
if
message
.
is_related_to
(
self
.
last_message
):
message
.
consecutive
=
True
message
.
consecutive
=
True
...
@@ -698,6 +719,9 @@ class ChatWidget(base_class, ui_class):
...
@@ -698,6 +719,9 @@ class ChatWidget(base_class, ui_class):
else
:
else
:
insertion_point
.
removeFromDocument
()
insertion_point
.
removeFromDocument
()
self
.
chat_element
.
appendInside
(
message
.
to_html
(
self
.
style
,
user_icons
=
self
.
user_icons_css_class
))
self
.
chat_element
.
appendInside
(
message
.
to_html
(
self
.
style
,
user_icons
=
self
.
user_icons_css_class
))
if
hasattr
(
message
,
'id'
):
self
.
timestamp_rendered_messages
.
append
((
message
.
timestamp
,
message
.
id
))
self
.
last_message
=
message
self
.
last_message
=
message
def
update_message_text
(
self
,
id
,
text
):
def
update_message_text
(
self
,
id
,
text
):
...
@@ -2523,7 +2547,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
...
@@ -2523,7 +2547,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
else
:
else
:
uri
=
message
.
remote_uri
uri
=
message
.
remote_uri
timestamp
=
message
.
timestamp
.
replace
(
tzinfo
=
timezone
.
utc
)
.
astimezone
(
)
.
replace
(
tzinfo
=
None
)
timestamp
=
message
.
timestamp
.
replace
(
tzinfo
=
timezone
.
utc
)
.
astimezone
(
tzlocal
()
)
# print(f"t: {timestamp}")
# print(f"t: {timestamp}")
account_manager
=
AccountManager
()
account_manager
=
AccountManager
()
if
account_manager
.
has_account
(
uri
):
if
account_manager
.
has_account
(
uri
):
...
...
resources/chat/styles/Smooth Operator/html/message.html
View file @
74404d88
<div
class=
"{message.css_classes} {user_icons}"
user=
"{message.sender.name}"
style=
"background-color: {message.sender.color};"
id=
"{message.id}"
>
<div
class=
"{message.css_classes} {user_icons}"
user=
"{message.sender.name}"
style=
"background-color: {message.sender.color};"
id=
"
message-
{message.id}"
>
<img
class=
"x-icon"
src=
"{message.sender.iconpath}"
/>
<img
class=
"x-icon"
src=
"{message.sender.iconpath}"
/>
<span
class=
"x-iconmask"
style=
"-webkit-mask-box-image: {message.sender.iconpath};"
></span>
<span
class=
"x-iconmask"
style=
"-webkit-mask-box-image: {message.sender.iconpath};"
></span>
<span
class=
"x-color"
style=
"background-color: {message.sender.color};"
src=
"{message.sender.iconpath}"
></span>
<span
class=
"x-color"
style=
"background-color: {message.sender.color};"
src=
"{message.sender.iconpath}"
></span>
...
...
resources/chat/styles/Smooth Operator/html/message_continuation.html
View file @
74404d88
<div
class=
"{message.css_classes} {user_icons}"
user=
"{message.sender.name}"
style=
"background-color: {message.sender.color};"
>
<div
id=
"message-{message.id}"
class=
"{message.css_classes} {user_icons}"
user=
"{message.sender.name}"
style=
"background-color: {message.sender.color};"
>
<img
class=
"x-icon"
src=
"{message.sender.iconpath}"
/>
<img
class=
"x-icon"
src=
"{message.sender.iconpath}"
/>
<span
class=
"x-iconmask"
style=
"-webkit-mask-box-image: {message.sender.iconpath};"
></span>
<span
class=
"x-iconmask"
style=
"-webkit-mask-box-image: {message.sender.iconpath};"
></span>
<span
class=
"x-color"
style=
"background-color: {message.sender.color};"
src=
"{message.sender.iconpath}"
></span>
<span
class=
"x-color"
style=
"background-color: {message.sender.color};"
src=
"{message.sender.iconpath}"
></span>
...
...
resources/chat/styles/Stockholm/html/message.html
View file @
74404d88
<div
id=
"{message.id}"
class=
"x-container {message.css_classes} {user_icons} {message.text_direction}"
>
<div
id=
"
message-
{message.id}"
class=
"x-container {message.css_classes} {user_icons} {message.text_direction}"
>
<img
class=
"x-buddyicon"
src=
"{message.sender.iconpath}"
/>
<img
class=
"x-buddyicon"
src=
"{message.sender.iconpath}"
/>
<div
class=
"x-iconoverlay"
></div>
<div
class=
"x-iconoverlay"
></div>
<div
class=
"x-mentionicon"
title=
"Mentioned!"
></div>
<div
class=
"x-mentionicon"
title=
"Mentioned!"
></div>
...
...
resources/chat/styles/Stockholm/html/message_continuation.html
View file @
74404d88
<div
class=
"x-message {message.css_classes} {message.text_direction}"
>
<div
id=
"message-{message.id}"
class=
"x-message {message.css_classes} {message.text_direction}"
>
<span
id=
"encryption-{message.id}"
class=
"stockholm"
></span>
<span
id=
"encryption-{message.id}"
class=
"stockholm"
></span>
<span
id=
"status-{message.id}"
>
{message.status}
</span>
<span
id=
"status-{message.id}"
>
{message.status}
</span>
<div
class=
"x-time"
title=
"{message.date}"
>
{message.time}
</div>
<div
class=
"x-time"
title=
"{message.date}"
>
{message.time}
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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