jp: all commands now use the new start method and set need_loop in __init__ when needed
This commit is contained in:
parent
89f6fe8605
commit
169bc43793
1 changed files with 46 additions and 84 deletions
|
|
@ -17,11 +17,7 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from logging import debug, info, error, warning
|
||||
|
||||
import base
|
||||
import sys
|
||||
import os
|
||||
from sat.core.i18n import _
|
||||
|
||||
__commands__ = ["AdHoc"]
|
||||
|
|
@ -31,7 +27,7 @@ MAGIC_BAREJID = '@PROFILE_BAREJID@'
|
|||
|
||||
class Remote(base.CommandBase):
|
||||
def __init__(self, host):
|
||||
super(Remote, self).__init__(host, 'remote', help=_('Remote control a software'))
|
||||
super(Remote, self).__init__(host, 'remote', use_verbose=True, help=_('Remote control a software'))
|
||||
|
||||
def add_parser_options(self):
|
||||
self.parser.add_argument("software", type=str, help=_("Software name"))
|
||||
|
|
@ -41,8 +37,7 @@ class Remote(base.CommandBase):
|
|||
self.parser.add_argument("--forbidden-jids", type=base.unicode_decoder, nargs='*', default=[], help=_("Jids that are *NOT* allowed to use the command"))
|
||||
self.parser.add_argument("-l", "--loop", action="store_true", help=_("Loop on the commands"))
|
||||
|
||||
def connected(self):
|
||||
super(Remote, self).connected()
|
||||
def start(self):
|
||||
name = self.args.software.lower()
|
||||
flags = []
|
||||
magics = {jid for jid in self.args.jids if jid.count('@')>1}
|
||||
|
|
@ -53,13 +48,13 @@ class Remote(base.CommandBase):
|
|||
bus_name, methods = self.host.bridge.adHocDBusAddAuto(name, jids, self.args.groups, magics,
|
||||
self.args.forbidden_jids, self.args.forbidden_groups,
|
||||
flags, self.profile)
|
||||
debug(_("Bus name found: [%s]" % bus_name))
|
||||
self.disp(_("Bus name found: [%s]" % bus_name), 1)
|
||||
for method in methods:
|
||||
path, iface, command = method
|
||||
debug (_("Command found: (path:%(path)s, iface: %(iface)s) [%(command)s]" % {'path': path,
|
||||
self.disp(_("Command found: (path:%(path)s, iface: %(iface)s) [%(command)s]" % {'path': path,
|
||||
'iface': iface,
|
||||
'command': command
|
||||
}))
|
||||
}),1)
|
||||
|
||||
class AdHoc(base.CommandBase):
|
||||
subcommands = (Remote,)
|
||||
|
|
|
|||
Loading…
Reference in a new issue