# Path: xclib/utf8.py
# def unutf8(u, opts='strict'):
#     if opts == 'illegal':
#         try:
#             return u.decode('utf-8', 'strict')
#         except UnicodeError:
#             dec = u.decode('utf-8', 'ignore')
#             logging.error('Illegal UTF-8 sequence: %r' % dec)
#             sys.stderr.write('Illegal UTF-8 sequence: %r\n' % dec)
#             traceback.print_exc()
#             return 'illegal-utf8-sequence-' + dec
#     else:
#         return u.decode('utf-8', opts)


import logging
import subprocess
from xclib.utf8 import unutf8

class ejabberdctl:
    def __init__(self, ctx):
        self.ctx = ctx

    def execute(self, args):
        logging.debug(self.ctx.ejabberdctl_path + str(args))
        try:

# Path: xclib/utf8.py
# def unutf8(u, opts='strict'):
#     if opts == 'illegal':
#         try:
#             return u.decode('utf-8', 'strict')
#         except UnicodeError:
#             dec = u.decode('utf-8', 'ignore')
#             logging.error('Illegal UTF-8 sequence: %r' % dec)
#             sys.stderr.write('Illegal UTF-8 sequence: %r\n' % dec)
#             traceback.print_exc()
#             return 'illegal-utf8-sequence-' + dec
#     else:
#         return u.decode('utf-8', opts)


# Path: xclib/ejabberdctl.py
import logging
import subprocess
from xclib.utf8 import unutf8


class ejabberdctl:
    def __init__(self, ctx):
        self.ctx = ctx

    def execute(self, args):
        logging.debug(self.ctx.ejabberdctl_path + str(args))
        try:

            return unutf8(subprocess.check_output([self.ctx.ejabberdctl_path] + args))