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
274d5270
Commit
274d5270
authored
18 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
blank line is really blank (no \t)
parent
159e782c
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/gajim-remote.py
+19
-19
19 additions, 19 deletions
src/gajim-remote.py
with
19 additions
and
19 deletions
src/gajim-remote.py
+
19
−
19
View file @
274d5270
...
...
@@ -66,7 +66,7 @@ BASENAME = 'gajim-remote'
class
GajimRemote
:
def
__init__
(
self
):
self
.
argv_len
=
len
(
sys
.
argv
)
# define commands dict. Prototype :
...
...
@@ -99,7 +99,7 @@ class GajimRemote:
[
(
_
(
'
account
'
),
_
(
'
show only contacts of the given account
'
),
False
)
]
],
'
list_accounts
'
:
[
_
(
'
Prints a list of registered accounts
'
),
...
...
@@ -201,7 +201,7 @@ class GajimRemote:
(
'
jid
'
,
_
(
'
JID of the contact
'
),
True
),
(
_
(
'
account
'
),
_
(
'
if specified, contact is taken from the
'
'
contact list of this account
'
),
False
)
]
],
'
add_contact
'
:
[
...
...
@@ -211,14 +211,14 @@ class GajimRemote:
(
_
(
'
account
'
),
_
(
'
Adds new contact to this account
'
),
False
)
]
],
'
get_status
'
:
[
_
(
'
Returns current status (the global one unless account is specified)
'
),
[
(
_
(
'
account
'
),
_
(
''
),
False
)
]
],
'
get_status_message
'
:
[
_
(
'
Returns current status message(the global one unless account is specified)
'
),
[
...
...
@@ -247,14 +247,14 @@ class GajimRemote:
else
:
print
self
.
compose_help
().
encode
(
PREFERRED_ENCODING
)
sys
.
exit
(
0
)
self
.
init_connection
()
self
.
check_arguments
()
if
self
.
command
==
'
contact_info
'
:
if
self
.
argv_len
<
3
:
send_error
(
_
(
'
Missing argument
"
contact_jid
"'
))
try
:
res
=
self
.
call_remote_method
()
except
exceptions
.
ServiceNotAvailable
:
...
...
@@ -262,14 +262,14 @@ class GajimRemote:
sys
.
exit
(
1
)
else
:
self
.
print_result
(
res
)
def
print_result
(
self
,
res
):
'''
Print retrieved result to the output
'''
if
res
is
not
None
:
if
self
.
command
in
(
'
open_chat
'
,
'
send_message
'
,
'
send_single_message
'
,
'
start_chat
'
):
if
self
.
command
in
(
'
send_message
'
,
'
send_single_message
'
):
self
.
argv_len
-=
2
if
res
is
False
:
if
self
.
argv_len
<
4
:
send_error
(
_
(
'
\'
%s
\'
is not in your roster.
\n
'
...
...
@@ -302,7 +302,7 @@ class GajimRemote:
print
self
.
print_info
(
0
,
res
,
True
)
elif
res
:
print
unicode
(
res
).
encode
(
PREFERRED_ENCODING
)
def
init_connection
(
self
):
'''
create the onnection to the session dbus,
or exit if it is not possible
'''
...
...
@@ -310,7 +310,7 @@ class GajimRemote:
self
.
sbus
=
dbus
.
SessionBus
()
except
:
raise
exceptions
.
SessionBusNotPresent
if
_version
[
1
]
>=
30
:
obj
=
self
.
sbus
.
get_object
(
SERVICE
,
OBJ_PATH
)
interface
=
dbus
.
Interface
(
obj
,
INTERFACE
)
...
...
@@ -319,10 +319,10 @@ class GajimRemote:
interface
=
self
.
service
.
get_object
(
OBJ_PATH
,
INTERFACE
)
else
:
send_error
(
_
(
'
Unknown D-Bus version: %s
'
)
%
_version
[
1
])
# get the function asked
self
.
method
=
interface
.
__getattr__
(
self
.
command
)
def
make_arguments_row
(
self
,
args
):
'''
return arguments list. Mandatory arguments are enclosed with:
'
<
'
,
'
>
'
, optional arguments - with
'
[
'
,
'
]
'
'''
...
...
@@ -339,7 +339,7 @@ class GajimRemote:
else
:
str
+=
'
]
'
return
str
def
help_on_command
(
self
,
command
):
'''
return help message for a given command
'''
if
command
in
self
.
commands
:
...
...
@@ -353,7 +353,7 @@ class GajimRemote:
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
...
...
@@ -374,7 +374,7 @@ class GajimRemote:
str
+=
'
]
'
str
+=
'
\n
'
return
str
def
print_info
(
self
,
level
,
prop_dict
,
encode_return
=
False
):
'''
return formated string from data structure
'''
if
prop_dict
is
None
or
not
isinstance
(
prop_dict
,
(
dict
,
list
,
tuple
)):
...
...
@@ -423,7 +423,7 @@ class GajimRemote:
except
:
pass
return
ret_str
def
check_arguments
(
self
):
'''
Make check if all necessary arguments are given
'''
argv_len
=
self
.
argv_len
-
2
...
...
@@ -433,7 +433,7 @@ class GajimRemote:
send_error
(
_
(
'
Argument
"
%s
"
is not specified.
\n
'
'
Type
"
%s help %s
"
for more info
'
)
%
(
args
[
argv_len
][
0
],
BASENAME
,
self
.
command
))
def
call_remote_method
(
self
):
'''
calls self.method with arguments from sys.argv[2:]
'''
args
=
sys
.
argv
[
2
:]
...
...
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