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
8a19e11b
Commit
8a19e11b
authored
16 years ago
by
steve-e
Browse files
Options
Downloads
Patches
Plain Diff
Add some FIXME statements due to open questions. Improve a two default parameters.
parent
1383bb6a
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/xmpp/client_nb.py
+8
-6
8 additions, 6 deletions
src/common/xmpp/client_nb.py
src/common/xmpp/dispatcher_nb.py
+13
-2
13 additions, 2 deletions
src/common/xmpp/dispatcher_nb.py
src/common/xmpp/transports_nb.py
+3
-1
3 additions, 1 deletion
src/common/xmpp/transports_nb.py
with
24 additions
and
9 deletions
src/common/xmpp/client_nb.py
+
8
−
6
View file @
8a19e11b
...
...
@@ -92,6 +92,8 @@ class NonBlockingClient:
self
.
NonBlockingHTTP
.
PlugOut
()
if
'
NonBlockingBOSH
'
in
self
.
__dict__
:
self
.
NonBlockingBOSH
.
PlugOut
()
# FIXME: we never unplug dispatcher, only on next connect
# See _xmpp_connect_machine and SASLHandler
connected
=
self
.
connected
stream_started
=
self
.
stream_started
...
...
@@ -129,7 +131,7 @@ class NonBlockingClient:
self
.
disconnecting
=
False
def
connect
(
self
,
on_connect
,
on_connect_failure
,
hostname
=
None
,
port
=
5222
,
on_proxy_failure
=
None
,
proxy
=
None
,
secure_tuple
=
(
None
,
None
,
None
)):
on_proxy_failure
=
None
,
proxy
=
None
,
secure_tuple
=
(
'
plain
'
,
None
,
None
)):
'''
Open XMPP connection (open XML streams in both directions).
...
...
@@ -353,22 +355,22 @@ class NonBlockingClient:
# if stream version is less than 1.0, we can't do more
log
.
warn
(
'
While connecting with type =
"
tls
"
: stream version is less than 1.0
'
)
self
.
_on_connect
()
return
if
self
.
Dispatcher
.
Stream
.
features
.
getTag
(
'
starttls
'
):
# Server advertises TLS support, start negotiation
self
.
stream_started
=
False
log
.
info
(
'
TLS supported by remote server. Requesting TLS start.
'
)
self
.
_tls_negotiation_handler
()
return
else
:
log
.
warn
(
'
While connecting with type =
"
tls
"
: TLS unsupported by remote server
'
)
self
.
_on_connect
()
return
elif
self
.
connected
in
[
'
ssl
'
,
'
tls
'
]:
self
.
_on_connect
()
return
assert
False
# should never be reached
else
:
log
.
error
(
'
Stream opened for unsupported connection: %s
'
%
(
self
.
connected
or
'
Disconnected
'
))
def
_tls_negotiation_handler
(
self
,
con
=
None
,
tag
=
None
):
'''
takes care of TLS negotioation with <starttls>
'''
...
...
@@ -477,7 +479,7 @@ class NonBlockingClient:
# wrong user/pass, stop auth
if
'
SASL
'
in
self
.
__dict__
:
self
.
SASL
.
PlugOut
()
self
.
connected
=
None
# FIXME: is this intended?
self
.
connected
=
None
# FIXME: is this intended?
We use ''elsewhere
self
.
_on_sasl_auth
(
None
)
elif
self
.
SASL
.
startsasl
==
'
success
'
:
auth_nb
.
NonBlockingBind
.
get_instance
().
PlugIn
(
self
)
...
...
This diff is collapsed.
Click to expand it.
src/common/xmpp/dispatcher_nb.py
+
13
−
2
View file @
8a19e11b
...
...
@@ -52,6 +52,8 @@ class Dispatcher():
XMPPDispatcher
().
PlugIn
(
client_obj
)
elif
client_obj
.
protocol_type
==
'
BOSH
'
:
BOSHDispatcher
().
PlugIn
(
client_obj
,
after_SASL
,
old_features
)
else
:
assert
False
# should never be reached
@classmethod
def
get_instance
(
cls
,
*
args
,
**
kwargs
):
...
...
@@ -111,6 +113,8 @@ class XMPPDispatcher(PlugIn):
'''
Registers default namespaces/protocols/handlers. Used internally.
'''
# FIXME: inject dependencies, do not rely that they are defined by our
# owner
self
.
RegisterNamespace
(
'
unknown
'
)
self
.
RegisterNamespace
(
NS_STREAMS
)
self
.
RegisterNamespace
(
self
.
_owner
.
defaultNamespace
)
...
...
@@ -162,7 +166,7 @@ class XMPPDispatcher(PlugIn):
raise
ValueError
(
'
Incorrect stream start: (%s,%s). Terminating.
'
%
(
tag
,
ns
))
def
ProcessNonBlocking
(
self
,
data
=
None
):
def
ProcessNonBlocking
(
self
,
data
):
'''
Check incoming stream for data waiting.
...
...
@@ -172,6 +176,11 @@ class XMPPDispatcher(PlugIn):
2)
'
0
'
string if no data were processed but link is alive;
3) 0 (zero) if underlying connection is closed.
'''
# FIXME:
# When an error occurs we disconnect the transport directly. Client's
# disconnect method will never be called.
# Is this intended?
# also look at transports start_disconnect()
for
handler
in
self
.
_cycleHandlers
:
handler
(
self
)
if
len
(
self
.
_pendingExceptions
)
>
0
:
...
...
@@ -317,7 +326,7 @@ class XMPPDispatcher(PlugIn):
'''
self
.
_eventHandler
=
handler
def
returnStanzaHandler
(
self
,
conn
,
stanza
):
def
returnStanzaHandler
(
self
,
conn
,
stanza
):
'''
Return stanza back to the sender with <feature-not-implemented/> error set
'''
...
...
@@ -348,6 +357,8 @@ class XMPPDispatcher(PlugIn):
'''
if
self
.
_eventHandler
:
self
.
_eventHandler
(
realm
,
event
,
data
)
else
:
log
.
warning
(
'
Received unhandled event: %s
'
%
event
)
def
dispatch
(
self
,
stanza
,
session
=
None
,
direct
=
0
):
'''
...
...
This diff is collapsed.
Click to expand it.
src/common/xmpp/transports_nb.py
+
3
−
1
View file @
8a19e11b
...
...
@@ -239,6 +239,7 @@ class NonBlockingTransport(PlugIn):
else
:
self
.
on_timeout
=
None
# FIXME: where and why does this need to be called
def
start_disconnect
(
self
):
self
.
set_state
(
DISCONNECTING
)
...
...
@@ -267,7 +268,8 @@ class NonBlockingTCP(NonBlockingTransport, IdleObject):
self
.
proxy_dict
=
proxy_dict
self
.
on_remote_disconnect
=
self
.
disconnect
# FIXME: transport should not be aware xmpp
def
start_disconnect
(
self
):
NonBlockingTransport
.
start_disconnect
(
self
)
self
.
send
(
'
</stream:stream>
'
,
now
=
True
)
...
...
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