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
c4ca6a80
Commit
c4ca6a80
authored
12 years ago
by
zimio
Browse files
Options
Downloads
Patches
Plain Diff
Cancel an IBB transfer
parent
6894db02
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/protocol/bytestream.py
+18
-1
18 additions, 1 deletion
src/common/protocol/bytestream.py
src/filetransfers_window.py
+5
-1
5 additions, 1 deletion
src/filetransfers_window.py
with
23 additions
and
2 deletions
src/common/protocol/bytestream.py
+
18
−
1
View file @
c4ca6a80
...
...
@@ -803,6 +803,16 @@ class ConnectionIBBytestream(ConnectionBytestream):
file_props
.
fp
=
open
(
file_props
.
file_name
,
'
w
'
)
conn
.
send
(
rep
)
def
CloseIBBStream
(
self
,
file_props
):
file_props
.
connected
=
False
file_props
.
fp
.
close
()
file_props
.
stopped
=
True
self
.
connection
.
send
(
nbxmpp
.
Protocol
(
'
iq
'
,
file_props
.
direction
[
1
:],
'
set
'
,
payload
=
[
nbxmpp
.
Node
(
nbxmpp
.
NS_IBB
+
'
close
'
,
{
'
sid
'
:
file_props
.
sid
})]))
def
OpenStream
(
self
,
sid
,
to
,
fp
,
blocksize
=
4096
):
"""
Start new stream. You should provide stream id
'
sid
'
, the endpoind jid
...
...
@@ -849,6 +859,9 @@ class ConnectionIBBytestream(ConnectionBytestream):
if
file_props
.
direction
[
0
]
==
'
>
'
:
if
file_props
.
paused
:
continue
if
not
file_props
.
connected
:
#TODO: Reply with out of order error
continue
chunk
=
file_props
.
fp
.
read
(
file_props
.
block_size
)
if
chunk
:
datanode
=
nbxmpp
.
Node
(
nbxmpp
.
NS_IBB
+
'
data
'
,
{
'
sid
'
:
sid
,
...
...
@@ -939,6 +952,9 @@ class ConnectionIBBytestream(ConnectionBytestream):
reply
.
delChild
(
'
close
'
)
conn
.
send
(
reply
)
file_props
.
fp
.
close
()
file_props
.
completed
=
file_props
.
received_len
>=
file_props
.
size
if
not
file_props
.
completed
:
file_props
.
error
=
-
1
gajim
.
socks5queue
.
complete_transfer_cb
(
self
.
name
,
file_props
)
else
:
conn
.
send
(
nbxmpp
.
Error
(
stanza
,
nbxmpp
.
ERR_ITEM_NOT_FOUND
))
...
...
@@ -953,8 +969,9 @@ class ConnectionIBBytestream(ConnectionBytestream):
syn_id
=
stanza
.
getID
()
log
.
debug
(
'
IBBAllIqHandler called syn_id->%s
'
%
syn_id
)
for
file_props
in
FilesProp
.
getAllFileProp
():
if
not
file_props
.
direction
:
if
not
file_props
.
direction
or
not
file_props
.
connected
:
# It's socks5 bytestream
# Or we closed the IBB stream
continue
if
file_props
.
syn_id
==
syn_id
:
if
stanza
.
getType
()
==
'
error
'
:
...
...
This diff is collapsed.
Click to expand it.
src/filetransfers_window.py
+
5
−
1
View file @
c4ca6a80
...
...
@@ -943,7 +943,11 @@ class FileTransfersWindow:
account
=
file_props
.
tt_account
if
account
not
in
gajim
.
connections
:
return
gajim
.
connections
[
account
].
disconnect_transfer
(
file_props
)
con
=
gajim
.
connections
[
account
]
# Check if we are in a IBB transfer
if
file_props
.
direction
:
con
.
CloseIBBStream
(
file_props
)
con
.
disconnect_transfer
(
file_props
)
self
.
set_status
(
file_props
,
'
stop
'
)
def
show_tooltip
(
self
,
widget
):
...
...
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