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
b36cd04f
Commit
b36cd04f
authored
Aug 15, 2022
by
Tijmen de Mes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable PGP generate dialog
parent
8f0e701f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
2 deletions
+52
-2
messages.py
blink/messages.py
+52
-2
No files found.
blink/messages.py
View file @
b36cd04f
...
@@ -495,7 +495,9 @@ class MessageManager(object, metaclass=Singleton):
...
@@ -495,7 +495,9 @@ class MessageManager(object, metaclass=Singleton):
notification_center
=
NotificationCenter
()
notification_center
=
NotificationCenter
()
notification_center
.
add_observer
(
self
,
name
=
'SIPEngineGotMessage'
)
notification_center
.
add_observer
(
self
,
name
=
'SIPEngineGotMessage'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkSessionWasCreated'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkSessionWasCreated'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkSessionNewOutgoing'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkSessionWasDeleted'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkSessionWasDeleted'
)
notification_center
.
add_observer
(
self
,
name
=
'PGPKeysDidGenerate'
)
def
_add_contact_to_messages_group
(
self
,
session
):
# Maybe this needs to be placed in Contacts? -- Tijmen
def
_add_contact_to_messages_group
(
self
,
session
):
# Maybe this needs to be placed in Contacts? -- Tijmen
if
not
session
.
account
.
sms
.
add_unknown_contacts
:
if
not
session
.
account
.
sms
.
add_unknown_contacts
:
...
@@ -622,6 +624,11 @@ class MessageManager(object, metaclass=Singleton):
...
@@ -622,6 +624,11 @@ class MessageManager(object, metaclass=Singleton):
outgoing_message
=
OutgoingMessage
(
account
,
contact
,
message
,
'text/pgp-private-key'
)
outgoing_message
=
OutgoingMessage
(
account
,
contact
,
message
,
'text/pgp-private-key'
)
self
.
_send_message
(
outgoing_message
)
self
.
_send_message
(
outgoing_message
)
def
_SH_GeneratePGPKeys
(
self
,
request
):
session
=
request
.
session
stream
=
session
.
fake_streams
.
get
(
'messages'
)
stream
.
generate_keys
(
session
)
def
_SH_PGPRequestFinished
(
self
,
request
):
def
_SH_PGPRequestFinished
(
self
,
request
):
request
.
dialog
.
hide
()
request
.
dialog
.
hide
()
self
.
pgp_requests
.
remove
(
request
)
self
.
pgp_requests
.
remove
(
request
)
...
@@ -662,7 +669,18 @@ class MessageManager(object, metaclass=Singleton):
...
@@ -662,7 +669,18 @@ class MessageManager(object, metaclass=Singleton):
encryption
=
self
.
check_encryption
(
content_type
,
body
)
encryption
=
self
.
check_encryption
(
content_type
,
body
)
if
encryption
==
'OpenPGP'
:
if
encryption
==
'OpenPGP'
:
if
not
account
.
sms
.
enable_pgp
:
if
account
.
sms
.
enable_pgp
and
(
account
.
sms
.
private_key
is
None
or
not
os
.
path
.
exists
(
account
.
sms
.
private_key
.
normalized
)):
for
request
in
self
.
pgp_requests
[
account
,
GeneratePGPKeyRequest
]:
return
generate_dialog
=
GeneratePGPKeyDialog
()
generate_request
=
GeneratePGPKeyRequest
(
generate_dialog
,
account
,
0
)
generate_request
.
accepted
.
connect
(
self
.
_SH_GeneratePGPKeys
)
generate_request
.
finished
.
connect
(
self
.
_SH_PGPRequestFinished
)
bisect
.
insort_right
(
self
.
pgp_requests
,
generate_request
)
generate_request
.
dialog
.
show
()
elif
not
account
.
sms
.
enable_pgp
:
return
return
if
content_type
.
lower
()
==
'text/pgp-private-key'
:
if
content_type
.
lower
()
==
'text/pgp-private-key'
:
...
@@ -750,7 +768,39 @@ class MessageManager(object, metaclass=Singleton):
...
@@ -750,7 +768,39 @@ class MessageManager(object, metaclass=Singleton):
self
.
sessions
.
append
(
session
)
self
.
sessions
.
append
(
session
)
def
_NH_BlinkSessionWasDeleted
(
self
,
notification
):
def
_NH_BlinkSessionWasDeleted
(
self
,
notification
):
self
.
sessions
.
remove
(
notification
.
sender
)
session
=
notification
.
sender
self
.
sessions
.
remove
(
session
)
for
request
in
self
.
pgp_requests
[
session
.
account
,
GeneratePGPKeyRequest
]:
request
.
dialog
.
hide
()
self
.
pgp_requests
.
remove
(
request
)
def
_NH_BlinkSessionNewOutgoing
(
self
,
notification
):
session
=
notification
.
sender
stream
=
session
.
fake_streams
.
get
(
'messages'
)
if
stream
is
None
:
return
if
session
.
account
.
sms
.
enable_pgp
and
(
session
.
account
.
sms
.
private_key
is
None
or
not
os
.
path
.
exists
(
session
.
account
.
sms
.
private_key
.
normalized
)):
for
request
in
self
.
pgp_requests
[
session
.
account
,
GeneratePGPKeyRequest
]:
return
generate_dialog
=
GeneratePGPKeyDialog
()
generate_request
=
GeneratePGPKeyRequest
(
generate_dialog
,
session
.
account
,
1
,
session
)
generate_request
.
accepted
.
connect
(
self
.
_SH_GeneratePGPKeys
)
generate_request
.
finished
.
connect
(
self
.
_SH_PGPRequestFinished
)
bisect
.
insort_right
(
self
.
pgp_requests
,
generate_request
)
generate_request
.
dialog
.
show
()
elif
session
.
account
.
sms
.
enable_pgp
:
stream
.
enable_pgp
()
def
_NH_PGPKeysDidGenerate
(
self
,
notification
):
session
=
notification
.
sender
outgoing_message
=
OutgoingMessage
(
session
.
account
,
session
.
contact
,
str
(
notification
.
data
.
public_key
),
'text/pgp-public-key'
,
session
=
session
)
self
.
_send_message
(
outgoing_message
)
def
export_private_key
(
self
,
account
):
def
export_private_key
(
self
,
account
):
if
account
is
None
:
if
account
is
None
:
...
...
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