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
4c4a95e8
Commit
4c4a95e8
authored
Sep 20, 2022
by
Tijmen de Mes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend message stream info
parent
85aeb986
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
5 deletions
+30
-5
sessions.py
blink/sessions.py
+30
-5
No files found.
blink/sessions.py
View file @
4c4a95e8
...
@@ -219,10 +219,29 @@ class MessageStreamInfo(object):
...
@@ -219,10 +219,29 @@ class MessageStreamInfo(object):
def
__init__
(
self
):
def
__init__
(
self
):
self
.
encryption
=
None
self
.
encryption
=
None
self
.
private_key
=
None
self
.
private_key
=
None
self
.
encryption_cipher
=
None
self
.
otr_key_fingerprint
=
None
self
.
otr_peer_fingerprint
=
None
self
.
otr_peer_name
=
''
self
.
otr_verified
=
False
self
.
smp_status
=
SMPVerification
.
Unavailable
def
update
(
self
,
stream
):
def
update
(
self
,
stream
):
if
stream
is
not
None
:
if
stream
is
not
None
:
self
.
encryption
=
'OpenPGP'
if
stream
.
can_encrypt
else
None
self
.
encryption
=
'OTR'
if
stream
.
encryption
.
active
else
None
self
.
encryption_cipher
=
stream
.
encryption
.
cipher
if
stream
.
encryption
.
active
else
None
if
self
.
encryption
is
None
:
self
.
encryption
=
'OpenPGP'
if
stream
.
can_encrypt
else
None
if
self
.
encryption
==
'OTR'
:
self
.
otr_key_fingerprint
=
stream
.
encryption
.
key_fingerprint
.
upper
()
self
.
otr_peer_fingerprint
=
stream
.
encryption
.
peer_fingerprint
.
upper
()
self
.
otr_peer_name
=
stream
.
encryption
.
peer_name
self
.
otr_verified
=
stream
.
encryption
.
verified
def
reset
(
self
):
pass
class
StreamsInfo
(
object
):
class
StreamsInfo
(
object
):
...
@@ -242,12 +261,12 @@ class StreamsInfo(object):
...
@@ -242,12 +261,12 @@ class StreamsInfo(object):
except
AttributeError
:
except
AttributeError
:
raise
KeyError
(
key
)
raise
KeyError
(
key
)
def
update
(
self
,
streams
):
def
update
(
self
,
streams
,
fake_streams
):
self
.
audio
.
update
(
streams
.
get
(
'audio'
))
self
.
audio
.
update
(
streams
.
get
(
'audio'
))
self
.
video
.
update
(
streams
.
get
(
'video'
))
self
.
video
.
update
(
streams
.
get
(
'video'
))
self
.
chat
.
update
(
streams
.
get
(
'chat'
))
self
.
chat
.
update
(
streams
.
get
(
'chat'
))
self
.
screen_sharing
.
update
(
streams
.
get
(
'screen-sharing'
))
self
.
screen_sharing
.
update
(
streams
.
get
(
'screen-sharing'
))
self
.
messages
.
update
(
streams
.
get
(
'messages'
))
self
.
messages
.
update
(
fake_
streams
.
get
(
'messages'
))
class
SessionInfo
(
object
):
class
SessionInfo
(
object
):
...
@@ -266,7 +285,7 @@ class SessionInfo(object):
...
@@ -266,7 +285,7 @@ class SessionInfo(object):
self
.
local_address
=
session
.
account
.
contact
[
self
.
transport
]
.
host
self
.
local_address
=
session
.
account
.
contact
[
self
.
transport
]
.
host
self
.
remote_address
=
sip_session
.
peer_address
# consider reading from sip_session.route if peer_address is None (route can also be None) -Dan
self
.
remote_address
=
sip_session
.
peer_address
# consider reading from sip_session.route if peer_address is None (route can also be None) -Dan
self
.
remote_user_agent
=
sip_session
.
remote_user_agent
self
.
remote_user_agent
=
sip_session
.
remote_user_agent
self
.
streams
.
update
(
session
.
streams
)
self
.
streams
.
update
(
session
.
streams
,
session
.
fake_streams
)
class
StreamDescription
(
object
):
class
StreamDescription
(
object
):
...
@@ -1065,7 +1084,7 @@ class BlinkSession(BlinkSessionBase):
...
@@ -1065,7 +1084,7 @@ class BlinkSession(BlinkSessionBase):
if
self
.
state
not
in
(
'ending'
,
'ended'
,
'deleted'
):
if
self
.
state
not
in
(
'ending'
,
'ended'
,
'deleted'
):
self
.
state
=
'connected'
self
.
state
=
'connected'
if
accepted_streams
:
if
accepted_streams
:
self
.
info
.
streams
.
update
(
self
.
streams
)
self
.
info
.
streams
.
update
(
self
.
streams
,
self
.
fake_streams
)
notification
.
center
.
post_notification
(
'BlinkSessionInfoUpdated'
,
sender
=
self
,
data
=
NotificationData
(
elements
=
{
'media'
}))
notification
.
center
.
post_notification
(
'BlinkSessionInfoUpdated'
,
sender
=
self
,
data
=
NotificationData
(
elements
=
{
'media'
}))
def
_NH_SIPSessionProposalRejected
(
self
,
notification
):
def
_NH_SIPSessionProposalRejected
(
self
,
notification
):
...
@@ -1205,6 +1224,8 @@ class BlinkSession(BlinkSessionBase):
...
@@ -1205,6 +1224,8 @@ class BlinkSession(BlinkSessionBase):
def
_NH_ChatStreamOTREncryptionStateChanged
(
self
,
notification
):
def
_NH_ChatStreamOTREncryptionStateChanged
(
self
,
notification
):
self
.
info
.
streams
.
chat
.
update
(
notification
.
sender
)
self
.
info
.
streams
.
chat
.
update
(
notification
.
sender
)
if
self
.
chat_type
is
None
:
self
.
info
.
streams
.
messages
.
update
(
notification
.
sender
)
notification
.
center
.
post_notification
(
'BlinkSessionInfoUpdated'
,
sender
=
self
,
data
=
NotificationData
(
elements
=
{
'media'
}))
notification
.
center
.
post_notification
(
'BlinkSessionInfoUpdated'
,
sender
=
self
,
data
=
NotificationData
(
elements
=
{
'media'
}))
if
notification
.
data
.
new_state
is
OTRState
.
Encrypted
:
if
notification
.
data
.
new_state
is
OTRState
.
Encrypted
:
self
.
_smp_handler
=
SMPVerificationHandler
(
self
)
self
.
_smp_handler
=
SMPVerificationHandler
(
self
)
...
@@ -1216,10 +1237,14 @@ class BlinkSession(BlinkSessionBase):
...
@@ -1216,10 +1237,14 @@ class BlinkSession(BlinkSessionBase):
def
_NH_ChatStreamOTRVerifiedStateChanged
(
self
,
notification
):
def
_NH_ChatStreamOTRVerifiedStateChanged
(
self
,
notification
):
self
.
info
.
streams
.
chat
.
update
(
notification
.
sender
)
self
.
info
.
streams
.
chat
.
update
(
notification
.
sender
)
if
self
.
chat_type
is
None
:
self
.
info
.
streams
.
messages
.
update
(
notification
.
sender
)
notification
.
center
.
post_notification
(
'BlinkSessionInfoUpdated'
,
sender
=
self
,
data
=
NotificationData
(
elements
=
{
'media'
}))
notification
.
center
.
post_notification
(
'BlinkSessionInfoUpdated'
,
sender
=
self
,
data
=
NotificationData
(
elements
=
{
'media'
}))
def
_NH_ChatStreamOTRPeerNameChanged
(
self
,
notification
):
def
_NH_ChatStreamOTRPeerNameChanged
(
self
,
notification
):
self
.
info
.
streams
.
chat
.
update
(
notification
.
sender
)
self
.
info
.
streams
.
chat
.
update
(
notification
.
sender
)
if
self
.
chat_type
is
None
:
self
.
info
.
streams
.
messages
.
update
(
notification
.
sender
)
notification
.
center
.
post_notification
(
'BlinkSessionInfoUpdated'
,
sender
=
self
,
data
=
NotificationData
(
elements
=
{
'media'
}))
notification
.
center
.
post_notification
(
'BlinkSessionInfoUpdated'
,
sender
=
self
,
data
=
NotificationData
(
elements
=
{
'media'
}))
def
_NH_ChatStreamSMPVerificationDidNotStart
(
self
,
notification
):
def
_NH_ChatStreamSMPVerificationDidNotStart
(
self
,
notification
):
...
...
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