blank line is really blank (no \t)

This commit is contained in:
Yann Leboulanger 2006-08-03 10:47:14 +00:00
parent 159e782ce9
commit 274d5270d1
1 changed files with 19 additions and 19 deletions

View File

@ -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]\nCommand 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:]