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
Erik Huelsmann
gajim
Commits
1a3a9875
Commit
1a3a9875
authored
18 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
auto-authorize transport contacts when we add a transport. fixes #326
parent
e88c3781
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_handlers.py
+25
-10
25 additions, 10 deletions
src/common/connection_handlers.py
with
25 additions
and
10 deletions
src/common/connection_handlers.py
+
25
−
10
View file @
1a3a9875
...
...
@@ -1033,7 +1033,10 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
self
.
awaiting_answers
=
{}
# List of IDs that will produce a timeout is answer doesn't arrive
# {time_of_the_timeout: (id, message to send to gui), }
self
.
awaiting_timeouts
=
{}
self
.
awaiting_timeouts
=
{}
# keep the jids we auto added (transports contacts) to not send the
# SUBSCRIBED event to gui
self
.
automatically_added
=
[]
try
:
idle
.
init
()
except
:
...
...
@@ -1339,10 +1342,13 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
if
ptype
==
'
available
'
:
ptype
=
None
gajim
.
log
.
debug
(
'
PresenceCB: %s
'
%
ptype
)
who
=
helpers
.
get_full_jid_from_iq
(
prs
)
jid_stripped
,
resource
=
gajim
.
get_room_and_nick_from_fjid
(
who
)
timestamp
=
None
is_gc
=
False
# is it a GC presence ?
sigTag
=
None
avatar_sha
=
None
avatar_sha
=
None
transport_auto_auth
=
False
xtags
=
prs
.
getTags
(
'
x
'
)
for
x
in
xtags
:
if
x
.
getNamespace
().
startswith
(
common
.
xmpp
.
NS_MUC
):
...
...
@@ -1355,10 +1361,13 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
# JEP-0091
tim
=
prs
.
getTimestamp
()
tim
=
time
.
strptime
(
tim
,
'
%Y%m%dT%H:%M:%S
'
)
timestamp
=
time
.
localtime
(
timegm
(
tim
))
timestamp
=
time
.
localtime
(
timegm
(
tim
))
if
x
.
getNamespace
()
==
'
http://delx.cjb.net/protocol/roster-subsync
'
:
# see http://trac.gajim.org/ticket/326
agent
=
gajim
.
get_server_from_jid
(
jid_stripped
)
if
self
.
connection
.
getRoster
().
getItem
(
agent
):
# to be sure it's a transport contact
transport_auto_auth
=
True
who
=
helpers
.
get_full_jid_from_iq
(
prs
)
jid_stripped
,
resource
=
gajim
.
get_room_and_nick_from_fjid
(
who
)
no_log_for
=
gajim
.
config
.
get_per
(
'
accounts
'
,
self
.
name
,
'
no_log_for
'
)
status
=
prs
.
getStatus
()
show
=
prs
.
getShow
()
...
...
@@ -1436,20 +1445,26 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
if
ptype
==
'
subscribe
'
:
gajim
.
log
.
debug
(
'
subscribe request from %s
'
%
who
)
if
gajim
.
config
.
get
(
'
alwaysauth
'
)
or
who
.
find
(
"
@
"
)
<=
0
or
\
jid_stripped
in
self
.
jids_for_auto_auth
:
jid_stripped
in
self
.
jids_for_auto_auth
or
transport_auto_auth
:
if
self
.
connection
:
p
=
common
.
xmpp
.
Presence
(
who
,
'
subscribed
'
)
p
=
self
.
add_sha
(
p
)
self
.
connection
.
send
(
p
)
if
who
.
find
(
"
@
"
)
<=
0
:
if
who
.
find
(
"
@
"
)
<=
0
or
transport_auto_auth
:
self
.
dispatch
(
'
NOTIFY
'
,
(
jid_stripped
,
'
offline
'
,
'
offline
'
,
resource
,
prio
,
keyID
,
timestamp
))
resource
,
prio
,
keyID
,
timestamp
))
if
transport_auto_auth
:
self
.
automatically_added
.
append
(
jid_stripped
)
self
.
request_subscription
(
jid_stripped
)
else
:
if
not
status
:
status
=
_
(
'
I would like to add you to my roster.
'
)
self
.
dispatch
(
'
SUBSCRIBE
'
,
(
who
,
status
))
elif
ptype
==
'
subscribed
'
:
self
.
dispatch
(
'
SUBSCRIBED
'
,
(
jid_stripped
,
resource
))
elif
ptype
==
'
subscribed
'
:
if
jid_stripped
in
self
.
automatically_added
:
self
.
automatically_added
.
remove
(
jid_stripped
)
else
:
self
.
dispatch
(
'
SUBSCRIBED
'
,
(
jid_stripped
,
resource
))
# BE CAREFUL: no con.updateRosterItem() in a callback
gajim
.
log
.
debug
(
_
(
'
we are now subscribed to %s
'
)
%
who
)
elif
ptype
==
'
unsubscribe
'
:
...
...
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