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
5d1410d1
Commit
5d1410d1
authored
18 years ago
by
sb
Browse files
Options
Downloads
Patches
Plain Diff
better handling of multiple gajim instances on one machine
parent
25b5b85a
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/zeroconf/connection_zeroconf.py
+1
-2
1 addition, 2 deletions
src/common/zeroconf/connection_zeroconf.py
src/common/zeroconf/zeroconf.py
+24
-10
24 additions, 10 deletions
src/common/zeroconf/zeroconf.py
with
25 additions
and
12 deletions
src/common/zeroconf/connection_zeroconf.py
+
1
−
2
View file @
5d1410d1
...
...
@@ -179,7 +179,6 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
# 'NOTIFY' (account, (jid, status, status message, resource, priority,
# keyID, timestamp))
self
.
dispatch
(
'
NOTIFY
'
,
(
jid
,
'
offline
'
,
''
,
'
local
'
,
0
,
None
,
0
))
print
'
connection_zeroconf:186
'
def
connect
(
self
,
data
=
None
,
show
=
'
online
'
):
...
...
@@ -203,7 +202,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
gobject
.
timeout_add
(
1000
,
self
.
_on_resolve_timeout
)
else
:
pass
# display visual notification that we could not connect to avahi
#
TODO:
display visual notification that we could not connect to avahi
def
connect_and_init
(
self
,
show
,
msg
,
signed
):
self
.
continue_connect_info
=
[
show
,
msg
,
signed
]
...
...
This diff is collapsed.
Click to expand it.
src/common/zeroconf/zeroconf.py
+
24
−
10
View file @
5d1410d1
...
...
@@ -50,6 +50,8 @@ class Zeroconf:
self
.
entrygroup
=
None
self
.
connected
=
False
self
.
announced
=
False
self
.
invalid_self_contact
=
{}
## handlers for dbus callbacks
...
...
@@ -58,14 +60,12 @@ class Zeroconf:
print
"
Error:
"
,
str
(
err
)
def
new_service_callback
(
self
,
interface
,
protocol
,
name
,
stype
,
domain
,
flags
):
# we don't want to see ourselves in the list
if
name
!=
self
.
name
:
# print "Found service '%s' in domain '%s' on %i.%i." % (name, domain, interface, protocol)
# print "Found service '%s' in domain '%s' on %i.%i." % (name, domain, interface, protocol)
#synchronous resolving
self
.
server
.
ResolveService
(
int
(
interface
),
int
(
protocol
),
name
,
stype
,
\
domain
,
avahi
.
PROTO_UNSPEC
,
dbus
.
UInt32
(
0
),
\
reply_handler
=
self
.
service_resolved_callback
,
error_handler
=
self
.
print_error_callback
)
#synchronous resolving
self
.
server
.
ResolveService
(
int
(
interface
),
int
(
protocol
),
name
,
stype
,
\
domain
,
avahi
.
PROTO_UNSPEC
,
dbus
.
UInt32
(
0
),
\
reply_handler
=
self
.
service_resolved_callback
,
error_handler
=
self
.
print_error_callback
)
def
remove_service_callback
(
self
,
interface
,
protocol
,
name
,
stype
,
domain
,
flags
):
# print "Service '%s' in domain '%s' on %i.%i disappeared." % (name, domain, interface, protocol)
...
...
@@ -112,9 +112,18 @@ class Zeroconf:
if
name
.
find
(
'
@
'
)
==
-
1
:
name
=
name
+
'
@
'
+
name
self
.
contacts
[
name
]
=
(
name
,
domain
,
interface
,
protocol
,
host
,
address
,
port
,
# we don't want to see ourselves in the list
if
name
!=
self
.
name
:
self
.
contacts
[
name
]
=
(
name
,
domain
,
interface
,
protocol
,
host
,
address
,
port
,
bare_name
,
txt
)
self
.
new_serviceCB
(
name
)
self
.
new_serviceCB
(
name
)
else
:
# remember data
# In case this is not our own record but of another
# gajim instance on the same machine,
# it will be used when we get a new name.
self
.
invalid_self_contact
[
name
]
=
(
name
,
domain
,
interface
,
protocol
,
host
,
address
,
port
,
bare_name
,
txt
)
# different handler when resolving all contacts
def
service_resolved_all_callback
(
self
,
interface
,
protocol
,
name
,
stype
,
domain
,
host
,
aprotocol
,
address
,
port
,
txt
,
flags
):
...
...
@@ -139,8 +148,13 @@ class Zeroconf:
def
service_add_fail_callback
(
self
,
err
):
print
'
Error while adding service:
'
,
str
(
err
)
old_name
=
self
.
name
self
.
name
=
self
.
server
.
GetAlternativeServiceName
(
self
.
name
)
self
.
create_service
()
if
self
.
invalid_self_contact
.
has_key
(
old_name
):
self
.
contacts
[
old_name
]
=
self
.
invalid_self_contact
[
old_name
]
self
.
new_serviceCB
(
old_name
)
del
self
.
invalid_self_contact
[
old_name
]
def
server_state_changed_callback
(
self
,
state
,
error
):
print
'
server.state %s
'
%
state
...
...
@@ -249,7 +263,7 @@ class Zeroconf:
db
.
connect_to_signal
(
'
ItemNew
'
,
self
.
new_domain_callback
)
else
:
self
.
browse_domain
(
avahi
.
IF_UNSPEC
,
avahi
.
PROTO_UNSPEC
,
domain
)
return
True
def
disconnect
(
self
):
...
...
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