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
6a85c610
Commit
6a85c610
authored
Sep 06, 2022
by
Tijmen de Mes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed reloading PGP keys in session after key is updated
parent
a2e89ef2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
messages.py
blink/messages.py
+15
-4
message.py
blink/streams/message.py
+1
-1
No files found.
blink/messages.py
View file @
6a85c610
...
@@ -561,6 +561,16 @@ class MessageManager(object, metaclass=Singleton):
...
@@ -561,6 +561,16 @@ class MessageManager(object, metaclass=Singleton):
with
open
(
filename
,
'wb'
)
as
f
:
with
open
(
filename
,
'wb'
)
as
f
:
data
=
data
if
isinstance
(
data
,
bytes
)
else
data
.
encode
()
data
=
data
if
isinstance
(
data
,
bytes
)
else
data
.
encode
()
f
.
write
(
data
)
f
.
write
(
data
)
try
:
from
blink.contacts
import
URIUtils
contact
,
contact_uri
=
URIUtils
.
find_contact
(
uri
)
blink_session
=
next
(
session
for
session
in
self
.
sessions
if
session
.
contact
.
settings
is
contact
.
settings
)
except
StopIteration
:
pass
else
:
notification_center
=
NotificationCenter
()
notification_center
.
post_notification
(
'PGPKeysShouldReload'
,
sender
=
blink_session
)
def
check_encryption
(
self
,
content_type
,
body
):
def
check_encryption
(
self
,
content_type
,
body
):
if
(
content_type
.
lower
()
.
startswith
(
'text/'
)
and
'-----BEGIN PGP MESSAGE-----'
in
body
and
body
.
strip
()
.
endswith
(
'-----END PGP MESSAGE-----'
)
and
content_type
!=
'text/pgp-private-key'
):
if
(
content_type
.
lower
()
.
startswith
(
'text/'
)
and
'-----BEGIN PGP MESSAGE-----'
in
body
and
body
.
strip
()
.
endswith
(
'-----END PGP MESSAGE-----'
)
and
content_type
!=
'text/pgp-private-key'
):
...
@@ -802,6 +812,10 @@ class MessageManager(object, metaclass=Singleton):
...
@@ -802,6 +812,10 @@ class MessageManager(object, metaclass=Singleton):
request
.
account
.
sms
.
public_key
=
f
'{filename}.pubkey'
request
.
account
.
sms
.
public_key
=
f
'{filename}.pubkey'
request
.
account
.
save
()
request
.
account
.
save
()
for
session
in
[
session
for
session
in
self
.
sessions
if
session
.
account
is
request
.
account
]:
notification_center
=
NotificationCenter
()
notification_center
.
post_notification
(
'PGPKeysShouldReload'
,
sender
=
session
)
while
self
.
_incoming_encrypted_message_queue
:
while
self
.
_incoming_encrypted_message_queue
:
message
,
account
,
contact
=
self
.
_incoming_encrypted_message_queue
.
popleft
()
message
,
account
,
contact
=
self
.
_incoming_encrypted_message_queue
.
popleft
()
try
:
try
:
...
@@ -940,6 +954,7 @@ class MessageManager(object, metaclass=Singleton):
...
@@ -940,6 +954,7 @@ class MessageManager(object, metaclass=Singleton):
if
content_type
.
lower
()
==
'text/pgp-public-key'
:
if
content_type
.
lower
()
==
'text/pgp-public-key'
:
log
.
info
(
'Message is a public key'
)
log
.
info
(
'Message is a public key'
)
self
.
_save_pgp_key
(
body
,
sender
.
uri
)
self
.
_save_pgp_key
(
body
,
sender
.
uri
)
return
from
blink.contacts
import
URIUtils
from
blink.contacts
import
URIUtils
contact
,
contact_uri
=
URIUtils
.
find_contact
(
sender
.
uri
)
contact
,
contact_uri
=
URIUtils
.
find_contact
(
sender
.
uri
)
...
@@ -1001,10 +1016,6 @@ class MessageManager(object, metaclass=Singleton):
...
@@ -1001,10 +1016,6 @@ class MessageManager(object, metaclass=Singleton):
# print("-- IMDN received, ignored")
# print("-- IMDN received, ignored")
return
return
if
content_type
.
lower
()
in
[
'text/pgp-public-key'
,
'text/pgp-private-key'
]:
notification_center
.
post_notification
(
'PGPKeysShouldReload'
,
sender
=
blink_session
)
return
if
content_type
.
lower
()
==
IsComposingDocument
.
content_type
:
if
content_type
.
lower
()
==
IsComposingDocument
.
content_type
:
try
:
try
:
document
=
IsComposingMessage
.
parse
(
body
)
document
=
IsComposingMessage
.
parse
(
body
)
...
...
blink/streams/message.py
View file @
6a85c610
...
@@ -209,7 +209,7 @@ class MessageStream(object, metaclass=MediaStreamType):
...
@@ -209,7 +209,7 @@ class MessageStream(object, metaclass=MediaStreamType):
handler
=
getattr
(
self
,
'_NH_
%
s'
%
notification
.
name
,
Null
)
handler
=
getattr
(
self
,
'_NH_
%
s'
%
notification
.
name
,
Null
)
handler
(
notification
)
handler
(
notification
)
def
PGPKeysShouldReload
(
self
,
notification
):
def
_NH_
PGPKeysShouldReload
(
self
,
notification
):
if
notification
.
sender
is
not
self
.
blink_session
:
if
notification
.
sender
is
not
self
.
blink_session
:
return
return
...
...
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