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
8f0e701f
Commit
8f0e701f
authored
Aug 15, 2022
by
Tijmen de Mes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable encryption for outgoing sip messages
parent
831e5aa5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
chatwindow.py
blink/chatwindow.py
+2
-0
messages.py
blink/messages.py
+15
-4
No files found.
blink/chatwindow.py
View file @
8f0e701f
...
...
@@ -2403,6 +2403,8 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
if
session
is
None
:
return
session
.
chat_widget
.
update_message_status
(
id
=
notification
.
data
.
id
,
status
=
'accepted'
)
if
blink_session
.
fake_streams
.
get
(
'messages'
)
.
can_encrypt
:
session
.
chat_widget
.
update_message_encryption
(
notification
.
data
.
id
,
True
)
def
_NH_BlinkMessageDidFail
(
self
,
notification
):
blink_session
=
notification
.
sender
...
...
blink/messages.py
View file @
8f0e701f
...
...
@@ -303,12 +303,13 @@ del ui_class, base_class
class
BlinkMessage
(
MSRPChatMessage
):
__slots__
=
'id'
,
'disposition'
__slots__
=
'id'
,
'disposition'
,
'is_secure'
def
__init__
(
self
,
content
,
content_type
,
sender
=
None
,
recipients
=
None
,
courtesy_recipients
=
None
,
subject
=
None
,
timestamp
=
None
,
required
=
None
,
additional_headers
=
None
,
id
=
None
,
disposition
=
None
):
def
__init__
(
self
,
content
,
content_type
,
sender
=
None
,
recipients
=
None
,
courtesy_recipients
=
None
,
subject
=
None
,
timestamp
=
None
,
required
=
None
,
additional_headers
=
None
,
id
=
None
,
disposition
=
None
,
is_secure
=
False
):
super
(
BlinkMessage
,
self
)
.
__init__
(
content
,
content_type
,
sender
,
recipients
,
courtesy_recipients
,
subject
,
timestamp
,
required
,
additional_headers
)
self
.
id
=
id
if
id
is
not
None
else
str
(
uuid
.
uuid4
())
self
.
disposition
=
disposition
self
.
is_secure
=
is_secure
@
implementer
(
IObserver
)
...
...
@@ -327,10 +328,11 @@ class OutgoingMessage(object):
self
.
sip_uri
=
SIPURI
.
parse
(
'sip:
%
s'
%
self
.
uri
)
self
.
session
=
session
self
.
contact
=
contact
self
.
is_secure
=
False
@
property
def
message
(
self
):
return
BlinkMessage
(
self
.
content
,
self
.
content_type
,
self
.
account
,
timestamp
=
self
.
timestamp
,
id
=
self
.
id
)
return
BlinkMessage
(
self
.
content
,
self
.
content_type
,
self
.
account
,
timestamp
=
self
.
timestamp
,
id
=
self
.
id
,
is_secure
=
self
.
is_secure
)
def
_lookup
(
self
):
settings
=
SIPSimpleSettings
()
...
...
@@ -355,7 +357,14 @@ class OutgoingMessage(object):
notification_center
=
NotificationCenter
()
routes
=
routes
if
routes
is
not
None
else
self
.
session
.
routes
from_uri
=
self
.
account
.
uri
content
=
self
.
content
if
isinstance
(
self
.
content
,
bytes
)
else
self
.
content
.
encode
()
content
=
self
.
content
if
self
.
session
is
not
None
:
stream
=
self
.
session
.
fake_streams
.
get
(
'messages'
)
if
self
.
content_type
.
lower
()
not
in
self
.
__disabled_imdn_content_types__
:
if
self
.
account
.
sms
.
enable_pgp
and
stream
.
can_encrypt
:
content
=
stream
.
encrypt
(
self
.
content
)
self
.
is_secure
=
True
content
=
content
if
isinstance
(
content
,
bytes
)
else
content
.
encode
()
additional_sip_headers
=
[]
if
self
.
account
.
sms
.
use_cpim
:
ns
=
CPIMNamespace
(
'urn:ietf:params:imdn'
,
'imdn'
)
...
...
@@ -383,6 +392,8 @@ class OutgoingMessage(object):
credentials
=
self
.
account
.
credentials
,
extra_headers
=
additional_sip_headers
)
notification_center
.
add_observer
(
self
,
sender
=
message_request
)
if
self
.
is_secure
:
notification_center
.
post_notification
(
'BlinkMessageDidEncrypt'
,
sender
=
self
.
session
,
data
=
NotificationData
(
message
=
self
.
message
))
message_request
.
send
()
else
:
pass
...
...
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