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
22037557
Commit
22037557
authored
14 years ago
by
Zhenchao Li
Browse files
Options
Downloads
Patches
Plain Diff
parse transport, construct streamhosts
parent
2b745570
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_ft.py
+8
-6
8 additions, 6 deletions
src/common/jingle_ft.py
src/common/jingle_transport.py
+15
-1
15 additions, 1 deletion
src/common/jingle_transport.py
src/common/protocol/bytestream.py
+6
-1
6 additions, 1 deletion
src/common/protocol/bytestream.py
with
29 additions
and
8 deletions
src/common/jingle_ft.py
+
8
−
6
View file @
22037557
...
...
@@ -98,6 +98,13 @@ class JingleFileTransfer(JingleContent):
self
.
transport
=
JingleTransportSocks5
()
self
.
transport
.
set_our_jid
(
self
.
session
.
ourjid
)
self
.
transport
.
set_file_props
(
self
.
file_props
)
if
self
.
file_props
.
has_key
(
"
streamhosts
"
):
self
.
file_props
[
'
streamhosts
'
].
extend
(
self
.
transport
.
remote_candidates
)
else
:
self
.
file_props
[
'
streamhosts
'
]
=
self
.
transport
.
remote_candidates
for
host
in
self
.
file_props
[
'
streamhosts
'
]:
host
[
'
initiator
'
]
=
self
.
session
.
initiator
host
[
'
target
'
]
=
self
.
session
.
responder
log
.
info
(
"
FT request: %s
"
%
file_props
)
self
.
session
.
connection
.
dispatch
(
'
FILE_REQUEST
'
,
(
jid
,
file_props
))
...
...
@@ -106,27 +113,22 @@ class JingleFileTransfer(JingleContent):
def
__on_session_accept
(
self
,
stanza
,
content
,
error
,
action
):
log
.
info
(
"
__on_session_accept
"
)
pass
gajim
.
socks5queue
.
send_file
(
self
.
file_props
,
self
.
session
.
ourjid
)
def
__on_session_terminate
(
self
,
stanza
,
content
,
error
,
action
):
log
.
info
(
"
__on_session_terminate
"
)
pass
def
__on_transport_accept
(
self
,
stanza
,
content
,
error
,
action
):
log
.
info
(
"
__on_transport_accept
"
)
pass
def
__on_transport_replace
(
self
,
stanza
,
content
,
error
,
action
):
log
.
info
(
"
__on_transport_replace
"
)
pass
def
__on_transport_reject
(
self
,
stanza
,
content
,
error
,
action
):
log
.
info
(
"
__on_transport_reject
"
)
pass
def
__on_transport_info
(
self
,
stanza
,
content
,
error
,
action
):
log
.
info
(
"
__on_transport_info
"
)
pass
def
_fill_content
(
self
,
content
):
description_node
=
xmpp
.
simplexml
.
Node
(
tag
=
xmpp
.
NS_JINGLE_FILE_TRANSFER
+
'
description
'
)
...
...
This diff is collapsed.
Click to expand it.
src/common/jingle_transport.py
+
15
−
1
View file @
22037557
...
...
@@ -85,6 +85,7 @@ class JingleTransportSocks5(JingleTransport):
"""
def
__init__
(
self
):
JingleTransport
.
__init__
(
self
,
TransportType
.
streaming
)
self
.
remote_candidates
=
[]
def
set_file_props
(
self
,
file_props
):
self
.
file_props
=
file_props
...
...
@@ -116,7 +117,20 @@ class JingleTransportSocks5(JingleTransport):
return
transport
def
parse_transport_stanza
(
self
,
transport
):
pass
candidates
=
[]
for
candidate
in
transport
.
iterTags
(
'
candidate
'
):
cand
=
{
'
state
'
:
0
,
'
target
'
:
self
.
ourjid
,
'
host
'
:
candidate
[
'
host
'
],
'
port
'
:
candidate
[
'
port
'
]
}
candidates
.
append
(
cand
)
# we need this when we construct file_props on session-initiation
self
.
remote_candidates
=
candidates
return
candidates
def
_add_local_ips_as_candidates
(
self
):
local_ip_cand
=
[]
...
...
This diff is collapsed.
Click to expand it.
src/common/protocol/bytestream.py
+
6
−
1
View file @
22037557
...
...
@@ -137,12 +137,17 @@ class ConnectionBytestream:
return
jid
=
gajim
.
get_jid_without_resource
(
file_props
[
'
sender
'
])
resource
=
gajim
.
get_resource_from_jid
(
file_props
[
'
sender
'
])
sid
=
file_props
[
'
sid
'
]
gajim
.
socks5queue
.
add_file_props
(
session
.
ourjid
,
file_props
)
if
not
session
.
accepted
:
session
.
approve_session
()
session
.
approve_content
(
'
file
'
)
if
not
gajim
.
socks5queue
.
get_file_props
(
session
.
ourjid
,
sid
):
gajim
.
socks5queue
.
add_file_props
(
session
.
ourjid
,
file_props
)
gajim
.
socks5queue
.
connect_to_hosts
(
session
.
ourjid
,
sid
,
None
,
None
)
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