Commit ed011da5 authored by Philipp Hörist's avatar Philipp Hörist

Add new Ad-Hoc Command dialog

parent 06848eae
Pipeline #3232 failed with stages
in 0 seconds
......@@ -296,6 +296,13 @@ class LeaveGroupchatsCommand(AdHocCommand):
class AdHocCommands(BaseModule):
_nbxmpp_extends = 'AdHoc'
_nbxmpp_methods = [
'request_command_list',
'execute_command',
]
def __init__(self, con):
BaseModule.__init__(self, con)
......@@ -469,38 +476,6 @@ class AdHocCommands(BaseModule):
raise nbxmpp.NodeProcessed
def request_command_list(self, jid):
"""
Request the command list.
"""
self._log.info('Request Command List: %s', jid)
query = nbxmpp.Iq(typ='get', to=jid, queryNS=nbxmpp.NS_DISCO_ITEMS)
query.setQuerynode(nbxmpp.NS_COMMANDS)
self._con.connection.SendAndCallForResponse(
query, self._command_list_received)
def _command_list_received(self, stanza):
if not nbxmpp.isResultNode(stanza):
self._log.info('Error: %s', stanza.getError())
app.nec.push_incoming_event(
AdHocCommandError(None, conn=self._con,
error=stanza.getError()))
return
items = stanza.getQueryPayload()
commandlist = []
if items:
commandlist = [
(t.getAttr('node'), t.getAttr('name')) for t in items
]
self._log.info('Received: %s', commandlist)
app.nec.push_incoming_event(
AdHocCommandListReceived(
None, conn=self._con, commandlist=commandlist))
def send_command(self, jid, node, session_id,
form, action='execute'):
"""
......@@ -563,10 +538,6 @@ class AdHocCommandError(NetworkIncomingEvent):
name = 'adhoc-command-error'
class AdHocCommandListReceived(NetworkIncomingEvent):
name = 'adhoc-command-list'
class AdHocCommandActionResponse(NetworkIncomingEvent):
name = 'adhoc-command-action-response'
......
......@@ -244,10 +244,15 @@ button.flat.link { padding: 0; border: 0; }
/*Dataforms*/
.field-fixed { font-size: 16px; font-weight: bold; padding-top:5px;}
.data-form-title { font-size: 16px; font-weight: bold; }
.data-form-widget grid { margin: 18px; }
.data-form-widget grid { margin: 0px 18px 18px 18px; }
.data-form-widget treeview { padding: 5px; }
.data-form-widget scrolledwindow { border: 1px solid; border-color:@unfocused_borders; }
.data-form-widget textview { padding: 5px; }
/*Image Preview*/
.preview-image { box-shadow: 0px 0px 3px 0px alpha(@theme_text_color, 0.2); }
/* Treeview */
.adhoc-treeview { padding: 5px; }
.adhoc-scrolled { border: 1px solid; border-color:@unfocused_borders; }
......@@ -79,7 +79,7 @@ from gajim.gtk.filechoosers import AvatarChooserDialog
from gajim.gtk.add_contact import AddNewContactWindow
from gajim.gtk.tooltips import GCTooltip
from gajim.gtk.groupchat_config import GroupchatConfig
from gajim.gtk.adhoc_commands import CommandWindow
from gajim.gtk.adhoc import AdHocCommand
from gajim.gtk.dataform import DataFormWidget
from gajim.gtk.util import NickCompletionGenerator
from gajim.gtk.util import get_icon_name
......@@ -735,7 +735,7 @@ class GroupchatControl(ChatControlBase):
"""
Execute AdHoc commands on the current room
"""
CommandWindow(self.account, self.room_jid)
AdHocCommand(self.account, self.room_jid)
def _on_upload_avatar(self, action, param):
def _on_accept(filename):
......@@ -2815,7 +2815,7 @@ class GroupchatControl(ChatControlBase):
def _on_execute_command_occupant(self, widget, nick):
jid = self.room_jid + '/' + nick
CommandWindow(self.account, jid)
AdHocCommand(self.account, jid)
def on_row_activated(self, widget, path):
"""
......
This diff is collapsed.
This diff is collapsed.
......@@ -59,7 +59,7 @@ from gajim.gtk.dialogs import ErrorDialog
from gajim.gtk.dialogs import InformationDialog
from gajim.gtk.service_registration import ServiceRegistration
from gajim.gtk.discovery_search import SearchWindow
from gajim.gtk.adhoc_commands import CommandWindow
from gajim.gtk.adhoc import AdHocCommand
from gajim.gtk.util import icon_exists
from gajim.gtk.util import get_builder
......@@ -1311,7 +1311,7 @@ class ToplevelAgentBrowser(AgentBrowser):
return
service = model[iter_][0]
node = model[iter_][1]
CommandWindow(self.account, service, commandnode=node)
AdHocCommand(self.account, service)
def on_register_button_clicked(self, widget=None):
"""
......
......@@ -84,7 +84,7 @@ from gajim.gtk.service_registration import ServiceRegistration
from gajim.gtk.discovery import ServiceDiscoveryWindow
from gajim.gtk.accounts import AccountsWindow
from gajim.gtk.tooltips import RosterTooltip
from gajim.gtk.adhoc_commands import CommandWindow
from gajim.gtk.adhoc import AdHocCommand
from gajim.gtk.subscription_request import SubscriptionRequestWindow
from gajim.gtk.util import get_icon_name
from gajim.gtk.util import resize_window
......@@ -3635,7 +3635,7 @@ class RosterWindow:
jid = contact.jid
if resource is not None:
jid = jid + '/' + resource
CommandWindow(account, jid)
AdHocCommand(account, jid)
def on_roster_window_focus_in_event(self, widget, event):
# roster received focus, so if we had urgency REMOVE IT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment