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
37780f6b
Commit
37780f6b
authored
19 years ago
by
dkirov
Browse files
Options
Downloads
Patches
Plain Diff
added prefs_list and prefs_store commands
(prefs_del, prefs_put are not implemented yet)
parent
5aec1863
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/gajim-remote.py
+37
-5
37 additions, 5 deletions
src/gajim-remote.py
src/remote_control.py
+36
-1
36 additions, 1 deletion
src/remote_control.py
with
73 additions
and
6 deletions
src/gajim-remote.py
+
37
−
5
View file @
37780f6b
...
...
@@ -150,6 +150,29 @@ sent using this account'), False),
(
_
(
'
account
'
),
_
(
'
if specified, file will be sent
\
using this account
'
),
False
)
]
],
'
prefs_list
'
:
[
_
(
'
List all preferences and their values
'
),
[
]
],
'
prefs_put
'
:
[
_
(
'
Set value of
\'
key
\'
to
\'
value
\'
. If there is no such key,
\
new item in the preferences is inserted.
'
),
[
(
_
(
'
key=value
'
),
_
(
'
\'
key
\'
is the name of the preference,
\
\'
value
\'
is the value to set it to
'
),
True
)
]
],
'
prefs_del
'
:
[
_
(
'
Delete a preference item
'
),
[
(
_
(
'
key
'
),
_
(
'
name of the preference to be deleted
'
),
True
)
]
],
'
prefs_store
'
:
[
_
(
'
Write the current state of Gajim preferences to the
\
.config file
'
),
[
]
]
}
if
self
.
argv_len
<
2
or
\
...
...
@@ -204,6 +227,12 @@ Please specify account for sending the message.') % sys.argv[2])
accounts
=
self
.
unrepr
(
single_res
)
for
account_dict
in
accounts
:
print
self
.
print_info
(
0
,
account_dict
)
elif
self
.
command
==
'
prefs_list
'
:
prefs_dict
=
self
.
unrepr
(
res
)
pref_keys
=
prefs_dict
[
0
].
keys
()
pref_keys
.
sort
()
for
pref_key
in
pref_keys
:
print
pref_key
,
'
=
'
,
prefs_dict
[
0
][
pref_key
]
elif
res
:
print
res
...
...
@@ -251,16 +280,19 @@ Please specify account for sending the message.') % sys.argv[2])
arguments_str
=
self
.
make_arguments_row
(
command_props
[
1
])
str
=
_
(
'
Usage: %s %s %s
\n\t
'
)
%
(
BASENAME
,
command
,
arguments_str
)
str
+=
command_props
[
0
]
+
'
\n\n
'
+
_
(
'
Arguments:
'
)
+
'
\n
'
for
argument
in
command_props
[
1
]:
str
+=
'
'
+
argument
[
0
]
+
'
-
'
+
argument
[
1
]
+
'
\n
'
if
len
(
command_props
[
1
])
>
0
:
str
+=
command_props
[
0
]
+
'
\n\n
'
+
_
(
'
Arguments:
'
)
+
'
\n
'
for
argument
in
command_props
[
1
]:
str
+=
'
'
+
argument
[
0
]
+
'
-
'
+
argument
[
1
]
+
'
\n
'
return
str
send_error
(
_
(
'
%s not found
'
)
%
command
)
def
compose_help
(
self
):
'''
print usage, and list available commands
'''
str
=
_
(
'
Usage: %s command [arguments]
\n
Command is one of:
\n
'
)
%
BASENAME
for
command
in
self
.
commands
.
keys
():
commands
=
self
.
commands
.
keys
()
commands
.
sort
()
for
command
in
commands
:
str
+=
'
'
+
command
for
argument
in
self
.
commands
[
command
][
1
]:
str
+=
'
'
...
...
@@ -488,7 +520,7 @@ Type "%s help %s" for more info') % (args[argv_len][0], BASENAME, self.command))
res
=
self
.
method
(
sys
.
argv
[
2
],
sys
.
argv
[
3
],
sys
.
argv
[
4
],
sys
.
argv
[
5
])
return
res
except
:
except
Exception
,
e
:
send_error
(
_
(
'
Service not available
'
))
return
None
...
...
This diff is collapsed.
Click to expand it.
src/remote_control.py
+
36
−
1
View file @
37780f6b
...
...
@@ -102,7 +102,11 @@ class SignalObject(DbusPrototype):
self
.
open_chat
,
self
.
send_message
,
self
.
contact_info
,
self
.
send_file
self
.
send_file
,
self
.
prefs_list
,
self
.
prefs_store
,
self
.
prefs_del
,
self
.
prefs_put
,
])
def
raise_signal
(
self
,
signal
,
arg
):
...
...
@@ -359,6 +363,33 @@ class SignalObject(DbusPrototype):
else
:
win
.
window
.
focus
(
long
(
time
()))
def
prefs_list
(
self
,
*
args
):
prefs_dict
=
{}
def
get_prefs
(
data
,
name
,
path
,
value
):
if
value
is
None
:
return
key
=
""
if
path
is
not
None
:
for
node
in
path
:
key
+=
node
+
"
->
"
key
+=
name
prefs_dict
[
key
]
=
unicode
(
value
[
1
])
gajim
.
config
.
foreach
(
get_prefs
)
return
repr
(
prefs_dict
)
def
prefs_store
(
self
,
*
args
):
try
:
self
.
plugin
.
save_config
()
except
Exception
,
e
:
return
False
return
True
def
prefs_del
(
self
,
*
args
):
return
[
'
Not implemented yet
'
]
def
prefs_put
(
self
,
*
args
):
return
[
'
Not implemented yet
'
]
def
_is_first
(
self
):
if
self
.
first_show
:
self
.
first_show
=
False
...
...
@@ -424,6 +455,10 @@ class SignalObject(DbusPrototype):
send_message
=
method
(
INTERFACE
)(
send_message
)
send_file
=
method
(
INTERFACE
)(
send_file
)
VcardInfo
=
signal
(
INTERFACE
)(
VcardInfo
)
prefs_list
=
method
(
INTERFACE
)(
prefs_list
)
prefs_put
=
method
(
INTERFACE
)(
prefs_put
)
prefs_del
=
method
(
INTERFACE
)(
prefs_del
)
prefs_store
=
method
(
INTERFACE
)(
prefs_store
)
class
SessionBusNotPresent
(
Exception
):
'''
This exception indicates that there is no session daemon
'''
...
...
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