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
07587690
Commit
07587690
authored
19 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
don't use the force_nonSASL option (doesn't work in xmpp)
we can now be disconected while registering a new account, it won't TB
parent
3f9e735f
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/connection.py
+40
-27
40 additions, 27 deletions
src/common/connection.py
with
40 additions
and
27 deletions
src/common/connection.py
+
40
−
27
View file @
07587690
...
...
@@ -137,7 +137,8 @@ class Connection:
for
handler
in
self
.
handlers
[
event
]:
handler
(
self
.
name
,
data
)
def
_discover
(
self
,
ns
,
jid
,
node
=
None
):
#FIXME: this is in features.py but it is blocking
# this is in features.py but it is blocking
def
_discover
(
self
,
ns
,
jid
,
node
=
None
):
if
not
self
.
connection
:
return
iq
=
common
.
xmpp
.
Iq
(
typ
=
'
get
'
,
to
=
jid
,
queryNS
=
ns
)
...
...
@@ -227,7 +228,6 @@ class Connection:
def
_presenceCB
(
self
,
con
,
prs
):
"""
Called when we recieve a presence
"""
# if prs.getXNode(common.xmpp.NS_DELAY): return
who
=
str
(
prs
.
getFrom
())
prio
=
prs
.
getPriority
()
if
not
prio
:
...
...
@@ -583,8 +583,9 @@ class Connection:
gajim
.
log
.
debug
(
'
Connected to server
'
)
try
:
auth
=
con
.
auth
(
name
,
self
.
password
,
resource
,
not
gajim
.
config
.
get_per
(
'
accounts
'
,
self
.
name
,
'
force_nonSASL
'
))
#FIXME: blocking
#FIXME: blocking
auth
=
con
.
auth
(
name
,
self
.
password
,
resource
,
1
)
#FIXME: non SASL doesn't work currently
# not gajim.config.get_per('accounts', self.name, 'force_nonSASL'))
except
IOError
:
#probably a timeout
self
.
connected
=
0
self
.
dispatch
(
'
STATUS
'
,
'
offline
'
)
...
...
@@ -600,7 +601,7 @@ class Connection:
self
.
dispatch
(
'
STATUS
'
,
'
offline
'
)
self
.
dispatch
(
'
ERROR
'
,
_
(
'
Authentication failed with %s, check your login and password
'
)
%
name
)
return
None
# END connect
# END connect
def
register_handler
(
self
,
event
,
function
):
if
event
in
self
.
handlers
:
...
...
@@ -786,7 +787,8 @@ class Connection:
def
register_agent
(
self
,
agent
,
info
):
if
not
self
.
connection
:
return
common
.
xmpp
.
features
.
register
(
self
.
connection
,
agent
,
info
)
# FIXME: Blocking
# FIXME: Blocking
common
.
xmpp
.
features
.
register
(
self
.
connection
,
agent
,
info
)
def
new_account
(
self
,
name
,
config
):
# If a connection already exist we cannot create a new account
...
...
@@ -797,30 +799,40 @@ class Connection:
'
user
'
:
config
[
'
proxyuser
'
],
'
password
'
:
config
[
'
proxypass
'
]}
else
:
proxy
=
None
c
=
common
.
xmpp
.
Client
(
server
=
config
[
'
hostname
'
],
debug
=
[])
con_type
=
c
.
connect
(
proxy
=
proxy
)
if
gajim
.
verbose
:
c
=
common
.
xmpp
.
Client
(
server
=
config
[
'
hostname
'
])
else
:
c
=
common
.
xmpp
.
Client
(
server
=
config
[
'
hostname
'
],
debug
=
[])
common
.
xmpp
.
dispatcher
.
DefaultTimeout
=
45
c
.
UnregisterDisconnectHandler
(
c
.
DisconnectHandler
)
c
.
RegisterDisconnectHandler
(
self
.
_disconnectedCB
)
port
=
5222
# if usessl:
# port = 5223
#FIXME: blocking
con_type
=
c
.
connect
((
config
[
'
hostname
'
],
port
),
proxy
=
proxy
)
if
not
con_type
:
gajim
.
log
.
debug
(
"
Couldn
'
t connect to %s
"
%
name
)
self
.
dispatch
(
'
ERROR
'
,
_
(
"
Couldn
'
t connect to %s
"
)
%
name
)
return
False
gajim
.
log
.
debug
(
'
Connected to server
'
)
# FIXME! This blocks!
req
=
common
.
xmpp
.
features
.
getRegInfo
(
c
,
config
[
'
hostname
'
]).
asDict
()
req
[
'
username
'
]
=
config
[
'
name
'
]
req
[
'
password
'
]
=
config
[
'
password
'
]
if
not
common
.
xmpp
.
features
.
register
(
c
,
config
[
'
hostname
'
],
req
):
self
.
dispatch
(
'
ERROR
'
,
_
(
'
Error:
'
)
+
c
.
lastErr
)
return
False
self
.
name
=
name
self
.
connected
=
0
self
.
password
=
config
[
'
password
'
]
if
USE_GPG
:
self
.
gpg
=
GnuPG
.
GnuPG
()
gajim
.
config
.
set
(
'
usegpg
'
,
True
)
else
:
gajim
.
log
.
debug
(
'
Connected to server
'
)
req
=
common
.
xmpp
.
features
.
getRegInfo
(
c
,
config
[
'
hostname
'
]).
asDict
()
# FIXME! This blocks!
req
[
'
username
'
]
=
config
[
'
name
'
]
req
[
'
password
'
]
=
config
[
'
password
'
]
if
not
common
.
xmpp
.
features
.
register
(
c
,
config
[
'
hostname
'
],
req
):
#FIXME: error
self
.
dispatch
(
'
ERROR
'
,
_
(
'
Error:
'
)
+
c
.
lastErr
)
else
:
self
.
name
=
name
self
.
connected
=
0
self
.
password
=
config
[
'
password
'
]
if
USE_GPG
:
self
.
gpg
=
GnuPG
.
GnuPG
()
gajim
.
config
.
set
(
'
usegpg
'
,
True
)
else
:
gajim
.
config
.
set
(
'
usegpg
'
,
False
)
gajim
.
connections
[
name
]
=
self
self
.
dispatch
(
'
ACC_OK
'
,
(
name
,
config
))
gajim
.
config
.
set
(
'
usegpg
'
,
False
)
gajim
.
connections
[
name
]
=
self
self
.
dispatch
(
'
ACC_OK
'
,
(
name
,
config
))
def
account_changed
(
self
,
new_name
):
self
.
name
=
new_name
...
...
@@ -930,7 +942,8 @@ class Connection:
iq
=
common
.
xmpp
.
Iq
(
typ
=
'
set
'
,
to
=
room_jid
,
queryNS
=
\
common
.
xmpp
.
NS_MUC_OWNER
)
query
=
iq
.
getTag
(
'
query
'
)
x
=
query
.
setTag
(
common
.
xmpp
.
NS_DATA
+
'
x
'
,
attrs
=
{
'
type
'
:
'
submit
'
})
# FIXME: should really use XData class
# FIXME: should really use XData class
x
=
query
.
setTag
(
common
.
xmpp
.
NS_DATA
+
'
x
'
,
attrs
=
{
'
type
'
:
'
submit
'
})
i
=
0
while
config
.
has_key
(
i
):
if
not
config
[
i
].
has_key
(
'
type
'
):
...
...
@@ -1006,4 +1019,4 @@ class Connection:
gajim
.
log
.
debug
(
'
error appeared while processing xmpp:
'
)
traceback
.
print_exc
()
self
.
connection
=
None
# END
GajimCore
# END
Connection
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