Skip to content
Snippets Groups Projects
Commit 0291b50f authored by dkirov's avatar dkirov
Browse files

added command start_chat (Geobert QUACH patch)

parent 76bed366
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
.SH "NAME" .SH "NAME"
Gajim-remote Gajim-remote
.SH "SYNOPSIS" .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" .SH "DESCRIPTION"
.B Gajim-remote .B Gajim-remote
is a script to control Gajim by D-Bus is a script to control Gajim by D-Bus
......
...@@ -216,6 +216,12 @@ class GajimRemote: ...@@ -216,6 +216,12 @@ class GajimRemote:
_('Returns number of unreaded messages'), _('Returns number of unreaded messages'),
[ ] [ ]
], ],
'start_chat': [
_('Open \'Start Chat\' dialog'),
[
(_('account'), _('Starts chat, using this account'), True)
]
],
} }
if self.argv_len < 2 or \ if self.argv_len < 2 or \
sys.argv[1] not in self.commands.keys(): # no args or bad args sys.argv[1] not in self.commands.keys(): # no args or bad args
...@@ -246,7 +252,7 @@ class GajimRemote: ...@@ -246,7 +252,7 @@ class GajimRemote:
def print_result(self, res): def print_result(self, res):
''' Print retrieved result to the output ''' ''' Print retrieved result to the output '''
if res is not None: 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': if self.command == 'send_message':
self.argv_len -= 2 self.argv_len -= 2
......
...@@ -32,7 +32,7 @@ from common import gajim ...@@ -32,7 +32,7 @@ from common import gajim
from common import helpers from common import helpers
from time import time from time import time
from common import i18n from common import i18n
from dialogs import AddNewContactWindow from dialogs import AddNewContactWindow, NewChatDialog
_ = i18n._ _ = i18n._
import dbus_support import dbus_support
...@@ -171,6 +171,7 @@ class SignalObject(DbusPrototype): ...@@ -171,6 +171,7 @@ class SignalObject(DbusPrototype):
self.remove_contact, self.remove_contact,
self.get_status, self.get_status,
self.get_status_message, self.get_status_message,
self.start_chat,
]) ])
def raise_signal(self, signal, arg): def raise_signal(self, signal, arg):
...@@ -546,6 +547,14 @@ class SignalObject(DbusPrototype): ...@@ -546,6 +547,14 @@ class SignalObject(DbusPrototype):
def get_unread_msgs_number(self, *args): def get_unread_msgs_number(self, *args):
return str(gajim.interface.roster.nb_unread) 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: if dbus_support.version[1] >= 30 and dbus_support.version[1] <= 40:
method = dbus.method method = dbus.method
signal = dbus.signal signal = dbus.signal
...@@ -575,3 +584,4 @@ class SignalObject(DbusPrototype): ...@@ -575,3 +584,4 @@ class SignalObject(DbusPrototype):
get_status_message = method(INTERFACE)(get_status_message) get_status_message = method(INTERFACE)(get_status_message)
account_info = method(INTERFACE)(account_info) account_info = method(INTERFACE)(account_info)
get_unread_msgs_number = method(INTERFACE)(get_unread_msgs_number) get_unread_msgs_number = method(INTERFACE)(get_unread_msgs_number)
start_chat = method(INTERFACE)(start_chat)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment