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
29160807
Commit
29160807
authored
18 years ago
by
dkirov
Browse files
Options
Downloads
Patches
Plain Diff
set username from system user everytime on
startup
parent
7dfdefcd
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/zeroconf/connection_zeroconf.py
+9
-6
9 additions, 6 deletions
src/common/zeroconf/connection_zeroconf.py
with
9 additions
and
6 deletions
src/common/zeroconf/connection_zeroconf.py
+
9
−
6
View file @
29160807
...
...
@@ -53,6 +53,8 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
'''
Connection class
'''
def
__init__
(
self
,
name
):
ConnectionHandlersZeroconf
.
__init__
(
self
)
# system username
self
.
username
=
None
self
.
name
=
name
self
.
connected
=
0
# offline
self
.
connection
=
None
...
...
@@ -102,6 +104,11 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
def
get_config_values_or_default
(
self
):
'''
get name, host, port from config, or
create zeroconf account with default values
'''
if
not
self
.
username
:
self
.
username
=
unicode
(
getpass
.
getuser
())
gajim
.
config
.
set_per
(
'
accounts
'
,
gajim
.
LOCAL_ACC
,
'
name
'
,
self
.
username
)
else
:
self
.
username
=
gajim
.
config
.
get_per
(
'
accounts
'
,
gajim
.
LOCAL_ACC
,
'
name
'
)
if
not
gajim
.
config
.
get_per
(
'
accounts
'
,
gajim
.
LOCAL_ACC
,
'
name
'
):
print
'
Creating zeroconf account
'
gajim
.
config
.
add_per
(
'
accounts
'
,
gajim
.
LOCAL_ACC
)
...
...
@@ -109,9 +116,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
gajim
.
config
.
set_per
(
'
accounts
'
,
gajim
.
LOCAL_ACC
,
'
no_log_for
'
,
''
)
gajim
.
config
.
set_per
(
'
accounts
'
,
gajim
.
LOCAL_ACC
,
'
password
'
,
'
zeroconf
'
)
gajim
.
config
.
set_per
(
'
accounts
'
,
gajim
.
LOCAL_ACC
,
'
sync_with_global_status
'
,
True
)
self
.
username
=
unicode
(
getpass
.
getuser
())
gajim
.
config
.
set_per
(
'
accounts
'
,
gajim
.
LOCAL_ACC
,
'
name
'
,
self
.
username
)
#XXX make sure host is US-ASCII
self
.
host
=
unicode
(
socket
.
gethostname
())
gajim
.
config
.
set_per
(
'
accounts
'
,
gajim
.
LOCAL_ACC
,
'
hostname
'
,
self
.
host
)
...
...
@@ -119,7 +124,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
gajim
.
config
.
set_per
(
'
accounts
'
,
gajim
.
LOCAL_ACC
,
'
custom_port
'
,
self
.
port
)
gajim
.
config
.
set_per
(
'
accounts
'
,
gajim
.
LOCAL_ACC
,
'
is_zeroconf
'
,
True
)
else
:
self
.
username
=
gajim
.
config
.
get_per
(
'
accounts
'
,
gajim
.
LOCAL_ACC
,
'
name
'
)
self
.
host
=
gajim
.
config
.
get_per
(
'
accounts
'
,
gajim
.
LOCAL_ACC
,
'
hostname
'
)
self
.
port
=
gajim
.
config
.
get_per
(
'
accounts
'
,
gajim
.
LOCAL_ACC
,
'
custom_port
'
)
self
.
autoconnect
=
gajim
.
config
.
get_per
(
'
accounts
'
,
gajim
.
LOCAL_ACC
,
'
autoconnect
'
)
...
...
@@ -200,9 +205,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
self
.
dispatch
(
'
NOTIFY
'
,
(
jid
,
'
offline
'
,
''
,
'
local
'
,
0
,
None
,
0
))
def
connect
(
self
,
data
=
None
,
show
=
'
online
'
,
msg
=
''
):
print
'
CONNECT
'
self
.
get_config_values_or_default
()
print
'
self.username
'
,
self
.
username
self
.
zeroconf
.
txt
[
'
status
'
]
=
show
self
.
zeroconf
.
txt
[
'
msg
'
]
=
msg
...
...
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