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
b51e7fdd
Commit
b51e7fdd
authored
Aug 29, 2022
by
Tijmen de Mes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced logging with message logging and added some log messages
parent
7288498c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
messages.py
blink/messages.py
+10
-3
No files found.
blink/messages.py
View file @
b51e7fdd
...
...
@@ -13,7 +13,6 @@ from PyQt5.QtWidgets import QApplication, QDialogButtonBox, QStyle, QDialog
from
pgpy
import
PGPMessage
from
pgpy.errors
import
PGPEncryptionError
,
PGPDecryptionError
from
application
import
log
from
application.notification
import
IObserver
,
NotificationCenter
,
NotificationData
from
application.python
import
Null
from
application.system
import
makedirs
...
...
@@ -33,6 +32,7 @@ from sipsimple.streams.msrp.chat import CPIMPayload, CPIMParserError, CPIMNamesp
from
sipsimple.threading
import
run_in_thread
from
sipsimple.util
import
ISOTimestamp
from
blink.logging
import
MessagingTrace
as
log
from
blink.resources
import
Resources
from
blink.sessions
import
SessionManager
,
StreamDescription
,
IncomingDialogBase
from
blink.util
import
run_in_gui_thread
...
...
@@ -669,6 +669,7 @@ class MessageManager(object, metaclass=Singleton):
if
account
is
None
:
return
log
.
info
(
f
'Received a message for {account.id}'
)
data
=
notification
.
data
content_type
=
data
.
headers
.
get
(
'Content-Type'
,
Null
)
.
content_type
...
...
@@ -699,6 +700,8 @@ class MessageManager(object, metaclass=Singleton):
encryption
=
self
.
check_encryption
(
content_type
,
body
)
if
encryption
==
'OpenPGP'
:
log
.
info
(
'Message is Open PGP encrypted'
)
if
account
.
sms
.
enable_pgp
and
(
account
.
sms
.
private_key
is
None
or
not
os
.
path
.
exists
(
account
.
sms
.
private_key
.
normalized
)):
if
not
self
.
pgp_requests
[
account
,
GeneratePGPKeyRequest
]:
generate_dialog
=
GeneratePGPKeyDialog
()
...
...
@@ -708,10 +711,13 @@ class MessageManager(object, metaclass=Singleton):
bisect
.
insort_right
(
self
.
pgp_requests
,
generate_request
)
generate_request
.
dialog
.
show
()
elif
not
account
.
sms
.
enable_pgp
:
log
.
info
(
f
"-- Skipping PGP encrypted message, PGP is disabled for {account.id}"
)
return
if
content_type
.
lower
()
==
'text/pgp-private-key'
:
log
.
info
(
'Message is a private key'
)
if
not
account
.
sms
.
enable_pgp
:
log
.
info
(
f
"-- Skipping private key import, PGP is disabled for {account.id}"
)
return
regex
=
"(?P<public_key>-----BEGIN PGP PUBLIC KEY BLOCK-----.*-----END PGP PUBLIC KEY BLOCK-----)"
matches
=
re
.
search
(
regex
,
body
,
re
.
DOTALL
)
...
...
@@ -732,7 +738,7 @@ class MessageManager(object, metaclass=Singleton):
incoming_request
.
dialog
.
show
()
if
content_type
.
lower
()
==
'text/pgp-public-key'
:
# print('-- Received
public key')
log
.
info
(
'Message is a
public key'
)
self
.
_save_pgp_key
(
body
,
sender
.
uri
)
from
blink.contacts
import
URIUtils
...
...
@@ -748,10 +754,11 @@ class MessageManager(object, metaclass=Singleton):
except
StopIteration
:
blink_session
=
None
if
content_type
.
lower
()
in
self
.
__ignored_content_types__
:
print
(
"Skipping session
"
)
log
.
debug
(
f
"Not creating session for incoming message for content type {content.type.lower()}
"
)
if
content_type
.
lower
()
!=
IMDNDocument
.
content_type
:
return
else
:
log
.
debug
(
"Starting new message session for incoming message"
)
blink_session
=
session_manager
.
create_session
(
contact
,
contact_uri
,
[
StreamDescription
(
'messages'
)],
account
=
account
,
connect
=
False
)
else
:
if
blink_session
.
fake_streams
.
get
(
'messages'
)
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