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
1799e5f3
Commit
1799e5f3
authored
Sep 02, 2022
by
Tijmen de Mes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for sylk history api
parent
94a8f926
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
221 additions
and
7 deletions
+221
-7
chatwindow.py
blink/chatwindow.py
+17
-3
history.py
blink/history.py
+8
-0
messages.py
blink/messages.py
+196
-4
No files found.
blink/chatwindow.py
View file @
1799e5f3
...
...
@@ -1644,6 +1644,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
notification_center
.
add_observer
(
self
,
name
=
'BlinkGotDispositionNotification'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkMessageDidSucceed'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkMessageDidFail'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkMessageWillRemove'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkMessageHistoryLoadDidSucceed'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkMessageHistoryLoadDidFail'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkMessageHistoryLastContactsDidSucceed'
)
...
...
@@ -2386,6 +2387,11 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
message
=
notification
.
data
.
message
direction
=
notification
.
data
.
message
.
direction
try
:
history
=
notification
.
data
.
history
except
AttributeError
:
history
=
False
try
:
received_account
=
notification
.
data
.
account
except
AttributeError
:
...
...
@@ -2423,10 +2429,10 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
self
.
pending_decryption
.
remove
(
message
)
session
.
chat_widget
.
update_message_text
(
message
.
id
,
content
)
else
:
session
.
chat_widget
.
add_message
(
ChatMessage
(
content
,
sender
,
direction
,
id
=
message
.
id
,
timestamp
=
message
.
timestamp
))
session
.
chat_widget
.
add_message
(
ChatMessage
(
content
,
sender
,
direction
,
id
=
message
.
id
,
timestamp
=
message
.
timestamp
,
history
=
history
))
session
.
chat_widget
.
update_message_encryption
(
message
.
id
,
message
.
is_secure
)
else
:
self
.
render_after_load
.
append
(
ChatMessage
(
content
,
sender
,
direction
,
id
=
message
.
id
,
timestamp
=
message
.
timestamp
))
self
.
render_after_load
.
append
(
ChatMessage
(
content
,
sender
,
direction
,
id
=
message
.
id
,
timestamp
=
message
.
timestamp
,
history
=
history
))
if
direction
!=
'outgoing'
and
message
.
disposition
is
not
None
and
'display'
in
message
.
disposition
and
not
encrypted
:
if
self
.
selected_session
.
blink_session
is
blink_session
and
not
self
.
isMinimized
()
and
self
.
isActiveWindow
():
...
...
@@ -2476,6 +2482,15 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
session
.
chat_widget
.
add_message
(
ChatStatus
(
f
'Delivery failed: {notification.data.data.code} - {notification.data.data.reason}'
))
session
.
chat_widget
.
update_message_status
(
id
=
notification
.
data
.
id
,
status
=
'failed'
)
def
_NH_BlinkMessageWillRemove
(
self
,
notification
):
blink_session
=
notification
.
sender
session
=
blink_session
.
items
.
chat
if
session
is
None
:
return
session
.
chat_widget
.
remove_message
(
notification
.
data
)
def
_NH_PGPMessageDidDecrypt
(
self
,
notification
):
blink_session
=
notification
.
sender
session
=
blink_session
.
items
.
chat
...
...
@@ -2573,7 +2588,6 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
session
.
chat_widget
.
add_message
(
ChatMessage
(
content
,
sender
,
message
.
direction
,
id
=
message
.
message_id
,
timestamp
=
timestamp
,
history
=
True
))
# session.chat_widget.add_message(ChatMessage(content, sender, message.direction, id=message.id, timestamp=timestamp))
if
message
.
direction
==
"outgoing"
:
session
.
chat_widget
.
update_message_status
(
id
=
message
.
message_id
,
status
=
message
.
state
)
elif
message
.
state
!=
'displayed'
and
'display'
in
message
.
disposition
and
not
encrypted
:
...
...
blink/history.py
View file @
1799e5f3
...
...
@@ -61,6 +61,8 @@ class HistoryManager(object, metaclass=Singleton):
notification_center
.
add_observer
(
self
,
name
=
'BlinkGotDispositionNotification'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkDidSendDispositionNotification'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkGotHistoryMessage'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkGotHistoryMessageRemove'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkGotHistoryConversationRemove'
)
@
run_in_thread
(
'file-io'
)
def
save
(
self
):
...
...
@@ -157,6 +159,12 @@ class HistoryManager(object, metaclass=Singleton):
account
=
notification
.
sender
self
.
message_history
.
add_from_history
(
account
,
**
notification
.
data
.
__dict__
)
def
_NH_BlinkGotHistoryMessageRemove
(
self
,
notification
):
self
.
message_history
.
remove_message
(
notification
.
data
)
def
_NH_BlinkGotHistoryConversationRemove
(
self
,
notification
):
self
.
message_history
.
remove_contact_messages
(
notification
.
sender
,
notification
.
data
)
def
_NH_BlinkMessageDidSucceed
(
self
,
notification
):
data
=
notification
.
data
self
.
message_history
.
update
(
data
.
id
,
'accepted'
)
...
...
blink/messages.py
View file @
1799e5f3
This diff is collapsed.
Click to expand it.
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