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
eta
gajim
Commits
30cbdce2
Commit
30cbdce2
authored
14 years ago
by
Zhenchao Li
Browse files
Options
Downloads
Patches
Plain Diff
if the peer supports jingle XTLS, send session-initiate with security element
parent
45834822
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/common/jingle.py
+15
-2
15 additions, 2 deletions
src/common/jingle.py
src/common/jingle_ft.py
+12
-1
12 additions, 1 deletion
src/common/jingle_ft.py
with
27 additions
and
3 deletions
src/common/jingle.py
+
15
−
2
View file @
30cbdce2
...
...
@@ -36,6 +36,7 @@ import helpers
from
jingle_session
import
JingleSession
,
JingleStates
from
jingle_rtp
import
JingleAudio
,
JingleVideo
from
jingle_ft
import
JingleFileTransfer
import
gajim
import
logging
logger
=
logging
.
getLogger
(
'
gajim.c.jingle
'
)
...
...
@@ -140,14 +141,26 @@ class ConnectionJingle(object):
def
start_file_transfer
(
self
,
jid
,
file_props
):
logger
.
info
(
"
start file transfer with file: %s
"
%
file_props
)
jingle
=
self
.
get_jingle_session
(
jid
,
media
=
'
file
'
)
contact
=
gajim
.
contacts
.
get_contact_with_highest_priority
(
self
.
name
,
gajim
.
get_jid_without_resource
(
jid
))
if
contact
is
None
:
return
if
contact
.
supports
(
xmpp
.
NS_JINGLE_XTLS
):
use_security
=
True
else
:
use_security
=
False
if
jingle
:
file_props
[
'
sid
'
]
=
jingle
.
sid
jingle
.
add_content
(
'
file
'
,
JingleFileTransfer
(
jingle
,
file_props
))
jingle
.
add_content
(
'
file
'
,
JingleFileTransfer
(
jingle
,
file_props
=
file_props
,
use_security
=
use_security
)
)
else
:
jingle
=
JingleSession
(
self
,
weinitiate
=
True
,
jid
=
jid
)
self
.
__sessions
[
jingle
.
sid
]
=
jingle
file_props
[
'
sid
'
]
=
jingle
.
sid
jingle
.
add_content
(
'
file
'
,
JingleFileTransfer
(
jingle
,
file_props
=
file_props
))
jingle
.
add_content
(
'
file
'
,
JingleFileTransfer
(
jingle
,
file_props
=
file_props
,
use_security
=
use_security
)
)
jingle
.
start_session
()
return
jingle
.
sid
...
...
This diff is collapsed.
Click to expand it.
src/common/jingle_ft.py
+
12
−
1
View file @
30cbdce2
...
...
@@ -37,7 +37,7 @@ STATE_TRANSPORT_INFO = 3
STATE_PROXY_ACTIVATED
=
4
class
JingleFileTransfer
(
JingleContent
):
def
__init__
(
self
,
session
,
transport
=
None
,
file_props
=
None
):
def
__init__
(
self
,
session
,
transport
=
None
,
file_props
=
None
,
use_security
=
False
):
JingleContent
.
__init__
(
self
,
session
,
transport
)
log
.
info
(
"
transport value: %s
"
%
transport
)
...
...
@@ -54,6 +54,8 @@ class JingleFileTransfer(JingleContent):
self
.
state
=
STATE_NOT_STARTED
self
.
use_security
=
use_security
self
.
file_props
=
file_props
if
file_props
is
None
:
self
.
weinitiate
=
False
...
...
@@ -246,6 +248,15 @@ class JingleFileTransfer(JingleContent):
desc
.
setData
(
self
.
file_props
[
'
desc
'
])
description_node
.
addChild
(
node
=
sioffer
)
if
self
.
use_security
:
security
=
xmpp
.
simplexml
.
Node
(
tag
=
xmpp
.
NS_JINGLE_XTLS
+
'
security
'
)
# TODO: add fingerprint element
for
m
in
(
'
x509
'
,
):
# supported authentication methods
method
=
xmpp
.
simplexml
.
Node
(
tag
=
'
method
'
)
method
.
setAttr
(
'
name
'
,
m
)
security
.
addChild
(
node
=
method
)
content
.
addChild
(
node
=
security
)
content
.
addChild
(
node
=
description_node
)
...
...
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