added command start_chat (Geobert QUACH patch)

This commit is contained in:
Dimitur Kirov 2006-05-09 22:13:46 +00:00
parent 76bed366e2
commit 0291b50fec
3 changed files with 19 additions and 3 deletions

View File

@ -3,7 +3,7 @@
.SH "NAME"
Gajim-remote
.SH "SYNOPSIS"
.B gajim-remote [help] [toggle_roster_appearance] [show_next_unread] [list_contacts] [list_accounts] [change_status] [open_chat] [send_message] [send_file] [contact_info] [account_info] [send_file] [prefs_list] [prefs_put] [prefs_del] [prefs_store] [remove_contact] [add_contact] [get_status] [get_status_message] [get_unread_msgs_number]
.B gajim-remote [help] [toggle_roster_appearance] [show_next_unread] [list_contacts] [list_accounts] [change_status] [open_chat] [send_message] [send_file] [contact_info] [account_info] [send_file] [prefs_list] [prefs_put] [prefs_del] [prefs_store] [remove_contact] [add_contact] [get_status] [get_status_message] [get_unread_msgs_number] [start_chat]
.SH "DESCRIPTION"
.B Gajim-remote
is a script to control Gajim by D-Bus

View File

@ -216,6 +216,12 @@ class GajimRemote:
_('Returns number of unreaded messages'),
[ ]
],
'start_chat': [
_('Open \'Start Chat\' dialog'),
[
(_('account'), _('Starts chat, using this account'), True)
]
],
}
if self.argv_len < 2 or \
sys.argv[1] not in self.commands.keys(): # no args or bad args
@ -246,7 +252,7 @@ class GajimRemote:
def print_result(self, res):
''' Print retrieved result to the output '''
if res is not None:
if self.command in ('open_chat', 'send_message'):
if self.command in ('open_chat', 'send_message', 'start_chat'):
if self.command == 'send_message':
self.argv_len -= 2

View File

@ -32,7 +32,7 @@ from common import gajim
from common import helpers
from time import time
from common import i18n
from dialogs import AddNewContactWindow
from dialogs import AddNewContactWindow, NewChatDialog
_ = i18n._
import dbus_support
@ -171,6 +171,7 @@ class SignalObject(DbusPrototype):
self.remove_contact,
self.get_status,
self.get_status_message,
self.start_chat,
])
def raise_signal(self, signal, arg):
@ -546,6 +547,14 @@ class SignalObject(DbusPrototype):
def get_unread_msgs_number(self, *args):
return str(gajim.interface.roster.nb_unread)
def start_chat(self, *args):
[account] = self._get_real_arguments(args, 1)
if not account:
# error is shown in gajim-remote check_arguments(..)
return None
NewChatDialog(account)
return True
if dbus_support.version[1] >= 30 and dbus_support.version[1] <= 40:
method = dbus.method
signal = dbus.signal
@ -575,3 +584,4 @@ class SignalObject(DbusPrototype):
get_status_message = method(INTERFACE)(get_status_message)
account_info = method(INTERFACE)(account_info)
get_unread_msgs_number = method(INTERFACE)(get_unread_msgs_number)
start_chat = method(INTERFACE)(start_chat)