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
e42c26b8
Commit
e42c26b8
authored
Sep 07, 2022
by
Tijmen de Mes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store pending decryted messages per session
parent
aac47bb6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
chatwindow.py
blink/chatwindow.py
+12
-8
No files found.
blink/chatwindow.py
View file @
e42c26b8
...
@@ -671,6 +671,7 @@ class ChatWidget(base_class, ui_class):
...
@@ -671,6 +671,7 @@ class ChatWidget(base_class, ui_class):
self
.
session
=
session
self
.
session
=
session
self
.
history_loaded
=
False
self
.
history_loaded
=
False
self
.
timestamp_rendered_messages
=
[]
self
.
timestamp_rendered_messages
=
[]
self
.
pending_decryption
=
[]
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
)
...
@@ -1619,7 +1620,6 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
...
@@ -1619,7 +1620,6 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
self
.
pending_displayed_notifications
=
{}
self
.
pending_displayed_notifications
=
{}
self
.
render_after_load
=
[]
self
.
render_after_load
=
[]
self
.
pending_decryption
=
[]
notification_center
=
NotificationCenter
()
notification_center
=
NotificationCenter
()
notification_center
.
add_observer
(
self
,
name
=
'SIPApplicationDidStart'
)
notification_center
.
add_observer
(
self
,
name
=
'SIPApplicationDidStart'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkSessionNewIncoming'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkSessionNewIncoming'
)
...
@@ -2408,7 +2408,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
...
@@ -2408,7 +2408,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
content
=
f
'<img src={session.chat_widget.encrypted_icon.filename} class="inline-message-icon">Encrypted Message'
content
=
f
'<img src={session.chat_widget.encrypted_icon.filename} class="inline-message-icon">Encrypted Message'
content
=
HtmlProcessor
.
autolink
(
content
)
content
=
HtmlProcessor
.
autolink
(
content
)
encrypted
=
True
encrypted
=
True
se
lf
.
pending_decryption
.
append
((
message
))
se
ssion
.
chat_widget
.
pending_decryption
.
append
((
message
))
else
:
else
:
content
=
message
.
content
content
=
message
.
content
content
=
HtmlProcessor
.
autolink
(
content
if
message
.
content_type
==
'text/html'
else
QTextDocument
(
content
)
.
toHtml
())
content
=
HtmlProcessor
.
autolink
(
content
if
message
.
content_type
==
'text/html'
else
QTextDocument
(
content
)
.
toHtml
())
...
@@ -2428,8 +2428,8 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
...
@@ -2428,8 +2428,8 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
account
=
None
account
=
None
sender
=
ChatSender
(
message
.
sender
.
display_name
or
session
.
name
,
uri
,
session
.
icon
.
filename
)
sender
=
ChatSender
(
message
.
sender
.
display_name
or
session
.
name
,
uri
,
session
.
icon
.
filename
)
if
session
.
chat_widget
.
history_loaded
:
if
session
.
chat_widget
.
history_loaded
:
if
message
in
se
lf
.
pending_decryption
and
not
encrypted
:
if
message
in
se
ssion
.
chat_widget
.
pending_decryption
and
not
encrypted
:
se
lf
.
pending_decryption
.
remove
(
message
)
se
ssion
.
chat_widget
.
pending_decryption
.
remove
(
message
)
session
.
chat_widget
.
update_message_text
(
message
.
id
,
content
)
session
.
chat_widget
.
update_message_text
(
message
.
id
,
content
)
else
:
else
:
session
.
chat_widget
.
add_message
(
ChatMessage
(
content
,
sender
,
direction
,
id
=
message
.
id
,
timestamp
=
message
.
timestamp
,
history
=
history
))
session
.
chat_widget
.
add_message
(
ChatMessage
(
content
,
sender
,
direction
,
id
=
message
.
id
,
timestamp
=
message
.
timestamp
,
history
=
history
))
...
@@ -2505,8 +2505,8 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
...
@@ -2505,8 +2505,8 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
if
isinstance
(
message
,
BlinkMessage
):
if
isinstance
(
message
,
BlinkMessage
):
return
return
if
message
in
se
lf
.
pending_decryption
:
if
message
in
se
ssion
.
chat_widget
.
pending_decryption
:
se
lf
.
pending_decryption
.
remove
(
message
)
se
ssion
.
chat_widget
.
pending_decryption
.
remove
(
message
)
content
=
message
.
content
content
=
message
.
content
content
=
HtmlProcessor
.
autolink
(
content
if
message
.
content_type
==
'text/html'
else
QTextDocument
(
content
)
.
toHtml
())
content
=
HtmlProcessor
.
autolink
(
content
if
message
.
content_type
==
'text/html'
else
QTextDocument
(
content
)
.
toHtml
())
session
.
chat_widget
.
update_message_text
(
message
.
message_id
,
content
)
session
.
chat_widget
.
update_message_text
(
message
.
message_id
,
content
)
...
@@ -2534,9 +2534,13 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
...
@@ -2534,9 +2534,13 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
def
_NH_MessageStreamPGPKeysDidLoad
(
self
,
notification
):
def
_NH_MessageStreamPGPKeysDidLoad
(
self
,
notification
):
stream
=
notification
.
sender
stream
=
notification
.
sender
blink_session
=
stream
.
blink_session
blink_session
=
stream
.
blink_session
session
=
blink_session
.
items
.
chat
if
session
is
None
:
return
stream
=
blink_session
.
fake_streams
.
get
(
'messages'
)
stream
=
blink_session
.
fake_streams
.
get
(
'messages'
)
for
message
in
se
lf
.
pending_decryption
:
for
message
in
se
ssion
.
chat_widget
.
pending_decryption
:
if
isinstance
(
message
,
BlinkMessage
):
if
isinstance
(
message
,
BlinkMessage
):
continue
continue
if
stream
and
stream
.
can_decrypt
:
if
stream
and
stream
.
can_decrypt
:
...
@@ -2560,7 +2564,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
...
@@ -2560,7 +2564,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
content
=
f
'<img src={session.chat_widget.encrypted_icon.filename} class="inline-message-icon">Encrypted Message'
content
=
f
'<img src={session.chat_widget.encrypted_icon.filename} class="inline-message-icon">Encrypted Message'
content
=
HtmlProcessor
.
autolink
(
content
)
content
=
HtmlProcessor
.
autolink
(
content
)
encrypted
=
True
encrypted
=
True
se
lf
.
pending_decryption
.
append
((
message
))
se
ssion
.
chat_widget
.
pending_decryption
.
append
((
message
))
stream
=
blink_session
.
fake_streams
.
get
(
'messages'
)
stream
=
blink_session
.
fake_streams
.
get
(
'messages'
)
if
stream
and
stream
.
can_decrypt
:
if
stream
and
stream
.
can_decrypt
:
stream
.
decrypt
(
message
)
stream
.
decrypt
(
message
)
...
...
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