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
f443673b
Commit
f443673b
authored
16 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
allow to wait for more than one answer at the same time with SendAndCallForResponse. Fixes #4299
parent
06d41884
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/common/xmpp/dispatcher_nb.py
+18
-18
18 additions, 18 deletions
src/common/xmpp/dispatcher_nb.py
with
18 additions
and
18 deletions
src/common/xmpp/dispatcher_nb.py
+
18
−
18
View file @
f443673b
...
...
@@ -463,20 +463,20 @@ class XMPPDispatcher(PlugIn):
if
not
res
:
return
self
.
_owner
.
remove_timeout
()
if
self
.
_expected
[
self
.
_witid
]
is
None
:
# If the expected Stanza would have arrived, ProcessNonBlocking would
#
have placed the reply stanza in there
return
if
self
.
_witid
in
self
.
on_responses
:
i
=
self
.
_witid
# copy id cause it can change in resp() call
self
.
_owner
.
onreceive
(
None
)
resp
,
args
=
self
.
on_responses
[
self
.
_wit
id
]
del
(
self
.
on_responses
[
self
.
_wit
id
])
if
args
is
None
:
resp
(
self
.
_expected
[
self
.
_witid
]
)
else
:
resp
(
self
.
_owner
,
self
.
_expected
[
self
.
_witid
]
,
**
args
)
del
self
.
_expected
[
i
]
for
(
_id
,
_iq
)
in
self
.
_expected
.
items
()
:
if
_iq
is
None
:
#
If the expected Stanza would have arrived, ProcessNonBlocking
# would have placed the reply stanza in there
continue
i
f
_id
in
self
.
on_responses
:
self
.
_owner
.
onreceive
(
None
)
resp
,
args
=
self
.
on_responses
[
_
id
]
del
(
self
.
on_responses
[
_
id
])
if
args
is
None
:
resp
(
_iq
)
else
:
resp
(
self
.
_owner
,
_iq
,
**
args
)
del
self
.
_expected
[
_id
]
def
SendAndWaitForResponse
(
self
,
stanza
,
timeout
=
None
,
func
=
None
,
args
=
None
):
'''
...
...
@@ -487,14 +487,14 @@ class XMPPDispatcher(PlugIn):
'''
if
timeout
is
None
:
timeout
=
DEFAULT_TIMEOUT_SECONDS
self
.
_witid
=
self
.
send
(
stanza
)
_w
a
itid
=
self
.
send
(
stanza
)
if
func
:
self
.
on_responses
[
self
.
_witid
]
=
(
func
,
args
)
self
.
on_responses
[
_w
a
itid
]
=
(
func
,
args
)
if
timeout
:
self
.
_owner
.
set_timeout
(
timeout
)
self
.
_owner
.
onreceive
(
self
.
_WaitForData
)
self
.
_expected
[
self
.
_witid
]
=
None
return
self
.
_witid
self
.
_expected
[
_w
a
itid
]
=
None
return
_w
a
itid
def
SendAndCallForResponse
(
self
,
stanza
,
func
=
None
,
args
=
None
):
'''
Put stanza on the wire and call back when recipient replies.
...
...
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