Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Weblate
gajim
Commits
f951df7e
Commit
f951df7e
authored
14 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
ability to accept correct content by its name, not only by it's media
parent
286d788d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/common/jingle_session.py
+7
-6
7 additions, 6 deletions
src/common/jingle_session.py
src/common/jingle_xtls.py
+12
-12
12 additions, 12 deletions
src/common/jingle_xtls.py
src/common/protocol/bytestream.py
+12
-4
12 additions, 4 deletions
src/common/protocol/bytestream.py
with
31 additions
and
22 deletions
src/common/jingle_session.py
+
7
−
6
View file @
f951df7e
...
...
@@ -142,14 +142,14 @@ class JingleSession(object):
reason
.
addChild
(
'
decline
'
)
self
.
_session_terminate
(
reason
)
def
approve_content
(
self
,
media
):
content
=
self
.
get_content
(
media
)
def
approve_content
(
self
,
media
,
name
=
None
):
content
=
self
.
get_content
(
media
,
name
)
if
content
:
content
.
accepted
=
True
self
.
on_session_state_changed
(
content
)
def
reject_content
(
self
,
media
):
content
=
self
.
get_content
(
media
)
def
reject_content
(
self
,
media
,
name
=
None
):
content
=
self
.
get_content
(
media
,
name
)
if
content
:
if
self
.
state
==
JingleStates
.
active
:
self
.
__content_reject
(
content
)
...
...
@@ -167,13 +167,14 @@ class JingleSession(object):
reason
.
addChild
(
'
cancel
'
)
self
.
_session_terminate
(
reason
)
def
get_content
(
self
,
media
=
None
):
def
get_content
(
self
,
media
=
None
,
name
=
None
):
if
media
is
None
:
return
for
content
in
self
.
contents
.
values
():
if
content
.
media
==
media
:
return
content
if
name
is
None
or
content
.
name
==
name
:
return
content
def
add_content
(
self
,
name
,
content
,
creator
=
'
we
'
):
"""
...
...
This diff is collapsed.
Click to expand it.
src/common/jingle_xtls.py
+
12
−
12
View file @
f951df7e
...
...
@@ -25,15 +25,15 @@ log = logging.getLogger('gajim.c.jingle_xtls')
PYOPENSSL_PRESENT
=
False
pending_
session
s
=
{}
# key-exchange id -> session, accept that session once key-exchange completes
pending_
content
s
=
{}
# key-exchange id -> session, accept that session once key-exchange completes
def
key_exchange_pend
(
id
,
session
):
pending_
session
s
[
id
]
=
session
def
key_exchange_pend
(
id
_
,
content
):
pending_
content
s
[
id
_
]
=
content
def
approve_pending_
session
(
id
):
session
=
pending_
session
s
[
id
]
session
.
approve_session
()
session
.
approve_content
(
'
file
'
)
def
approve_pending_
content
(
id
_
):
content
=
pending_
content
s
[
id
_
]
content
.
session
.
approve_session
()
content
.
session
.
approve_content
(
'
file
'
,
name
=
content
.
name
)
try
:
import
OpenSSL
...
...
@@ -133,7 +133,7 @@ def handle_new_cert(con, obj, jid_from):
certpath
=
os
.
path
.
join
(
os
.
path
.
expanduser
(
gajim
.
MY_PEER_CERTS_PATH
),
jid
)
certpath
+=
'
.cert
'
id
=
obj
.
getAttr
(
'
id
'
)
id
_
=
obj
.
getAttr
(
'
id
'
)
x509cert
=
obj
.
getTag
(
'
pubkeys
'
).
getTag
(
'
keyinfo
'
).
getTag
(
'
x509cert
'
)
...
...
@@ -144,16 +144,16 @@ def handle_new_cert(con, obj, jid_from):
f
.
write
(
cert
)
f
.
write
(
'
-----END CERTIFICATE-----
\n
'
)
approve_pending_
session
(
id
)
approve_pending_
content
(
id
_
)
def
send_cert_request
(
con
,
to_jid
):
iq
=
common
.
xmpp
.
Iq
(
'
get
'
,
to
=
to_jid
)
id
=
con
.
connection
.
getAnID
()
iq
.
setAttr
(
'
id
'
,
id
)
id
_
=
con
.
connection
.
getAnID
()
iq
.
setAttr
(
'
id
'
,
id
_
)
pubkey
=
iq
.
setTag
(
'
pubkeys
'
)
pubkey
.
setNamespace
(
common
.
xmpp
.
NS_PUBKEY_PUBKEY
)
con
.
connection
.
send
(
iq
)
return
unicode
(
id
)
return
unicode
(
id
_
)
# the following code is partly due to pyopenssl examples
...
...
This diff is collapsed.
Click to expand it.
src/common/protocol/bytestream.py
+
12
−
4
View file @
f951df7e
...
...
@@ -140,16 +140,24 @@ class ConnectionBytestream:
file_props
[
'
session-sid
'
])
if
not
session
:
return
content
=
None
for
c
in
session
.
contents
.
values
():
if
c
.
transport
.
sid
==
file_props
[
'
sid
'
]:
content
=
c
break
if
not
content
:
return
gajim
.
socks5queue
.
add_file_props
(
self
.
name
,
file_props
)
if
not
session
.
accepted
:
if
session
.
get_content
(
'
file
'
).
use_security
:
id_
=
jingle_xtls
.
send_cert_request
(
self
,
file_props
[
'
sender
'
])
jingle_xtls
.
key_exchange_pend
(
id_
,
session
)
if
session
.
get_content
(
'
file
'
,
content
.
name
).
use_security
:
id_
=
jingle_xtls
.
send_cert_request
(
self
,
file_props
[
'
sender
'
])
jingle_xtls
.
key_exchange_pend
(
id_
,
content
)
return
session
.
approve_session
()
session
.
approve_content
(
'
file
'
)
session
.
approve_content
(
'
file
'
,
content
.
name
)
return
iq
=
xmpp
.
Iq
(
to
=
unicode
(
file_props
[
'
sender
'
]),
typ
=
'
result
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment