Blame dbus/bus.py

Packit 130fc8
# Copyright (C) 2007 Collabora Ltd. <http://www.collabora.co.uk/>
Packit 130fc8
#
Packit 130fc8
# Permission is hereby granted, free of charge, to any person
Packit 130fc8
# obtaining a copy of this software and associated documentation
Packit 130fc8
# files (the "Software"), to deal in the Software without
Packit 130fc8
# restriction, including without limitation the rights to use, copy,
Packit 130fc8
# modify, merge, publish, distribute, sublicense, and/or sell copies
Packit 130fc8
# of the Software, and to permit persons to whom the Software is
Packit 130fc8
# furnished to do so, subject to the following conditions:
Packit 130fc8
#
Packit 130fc8
# The above copyright notice and this permission notice shall be
Packit 130fc8
# included in all copies or substantial portions of the Software.
Packit 130fc8
#
Packit 130fc8
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Packit 130fc8
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Packit 130fc8
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Packit 130fc8
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
Packit 130fc8
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
Packit 130fc8
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Packit 130fc8
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
Packit 130fc8
# DEALINGS IN THE SOFTWARE.
Packit 130fc8
Packit 130fc8
__all__ = ('BusConnection',)
Packit 130fc8
__docformat__ = 'reStructuredText'
Packit 130fc8
Packit 130fc8
import logging
Packit 130fc8
import weakref
Packit 130fc8
Packit 130fc8
from _dbus_bindings import (
Packit 130fc8
    BUS_DAEMON_IFACE, BUS_DAEMON_NAME, BUS_DAEMON_PATH, BUS_SESSION,
Packit 130fc8
    BUS_STARTER, BUS_SYSTEM, DBUS_START_REPLY_ALREADY_RUNNING,
Packit 130fc8
    DBUS_START_REPLY_SUCCESS, NAME_FLAG_ALLOW_REPLACEMENT,
Packit 130fc8
    NAME_FLAG_DO_NOT_QUEUE, NAME_FLAG_REPLACE_EXISTING,
Packit 130fc8
    RELEASE_NAME_REPLY_NON_EXISTENT, RELEASE_NAME_REPLY_NOT_OWNER,
Packit 130fc8
    RELEASE_NAME_REPLY_RELEASED, REQUEST_NAME_REPLY_ALREADY_OWNER,
Packit 130fc8
    REQUEST_NAME_REPLY_EXISTS, REQUEST_NAME_REPLY_IN_QUEUE,
Packit 130fc8
    REQUEST_NAME_REPLY_PRIMARY_OWNER, validate_bus_name, validate_error_name,
Packit 130fc8
    validate_interface_name, validate_member_name, validate_object_path)
Packit 130fc8
from dbus.connection import Connection
Packit 130fc8
from dbus.exceptions import DBusException
Packit 130fc8
from dbus.lowlevel import HANDLER_RESULT_NOT_YET_HANDLED
Packit 130fc8
from dbus._compat import is_py2
Packit 130fc8
Packit 130fc8
Packit 130fc8
_NAME_OWNER_CHANGE_MATCH = ("type='signal',sender='%s',"
Packit 130fc8
                            "interface='%s',member='NameOwnerChanged',"
Packit 130fc8
                            "path='%s',arg0='%%s'"
Packit 130fc8
                            % (BUS_DAEMON_NAME, BUS_DAEMON_IFACE,
Packit 130fc8
                               BUS_DAEMON_PATH))
Packit 130fc8
"""(_NAME_OWNER_CHANGE_MATCH % sender) matches relevant NameOwnerChange
Packit 130fc8
messages"""
Packit 130fc8
Packit 130fc8
_NAME_HAS_NO_OWNER = 'org.freedesktop.DBus.Error.NameHasNoOwner'
Packit 130fc8
Packit 130fc8
_logger = logging.getLogger('dbus.bus')
Packit 130fc8
Packit 130fc8
Packit 130fc8
class NameOwnerWatch(object):
Packit 130fc8
    __slots__ = ('_match', '_pending_call')
Packit 130fc8
Packit 130fc8
    def __init__(self, bus_conn, bus_name, callback):
Packit 130fc8
        validate_bus_name(bus_name)
Packit 130fc8
Packit 130fc8
        def signal_cb(owned, old_owner, new_owner):
Packit 130fc8
            callback(new_owner)
Packit 130fc8
Packit 130fc8
        def error_cb(e):
Packit 130fc8
            if e.get_dbus_name() == _NAME_HAS_NO_OWNER:
Packit 130fc8
                callback('')
Packit 130fc8
            else:
Packit 130fc8
                logging.basicConfig()
Packit 130fc8
                _logger.debug('GetNameOwner(%s) failed:', bus_name,
Packit 130fc8
                              exc_info=(e.__class__, e, None))
Packit 130fc8
Packit 130fc8
        self._match = bus_conn.add_signal_receiver(signal_cb,
Packit 130fc8
                                                   'NameOwnerChanged',
Packit 130fc8
                                                   BUS_DAEMON_IFACE,
Packit 130fc8
                                                   BUS_DAEMON_NAME,
Packit 130fc8
                                                   BUS_DAEMON_PATH,
Packit 130fc8
                                                   arg0=bus_name)
Packit 130fc8
        keywords = {}
Packit 130fc8
        if is_py2:
Packit 130fc8
            keywords['utf8_strings'] = True
Packit 130fc8
        self._pending_call = bus_conn.call_async(BUS_DAEMON_NAME,
Packit 130fc8
                                                 BUS_DAEMON_PATH,
Packit 130fc8
                                                 BUS_DAEMON_IFACE,
Packit 130fc8
                                                 'GetNameOwner',
Packit 130fc8
                                                 's', (bus_name,),
Packit 130fc8
                                                 callback, error_cb,
Packit 130fc8
                                                 **keywords)
Packit 130fc8
Packit 130fc8
    def cancel(self):
Packit 130fc8
        if self._match is not None:
Packit 130fc8
            self._match.remove()
Packit 130fc8
        if self._pending_call is not None:
Packit 130fc8
            self._pending_call.cancel()
Packit 130fc8
        self._match = None
Packit 130fc8
        self._pending_call = None
Packit 130fc8
Packit 130fc8
Packit 130fc8
class BusConnection(Connection):
Packit 130fc8
    """A connection to a D-Bus daemon that implements the
Packit 130fc8
    ``org.freedesktop.DBus`` pseudo-service.
Packit 130fc8
Packit 130fc8
    :Since: 0.81.0
Packit 130fc8
    """
Packit 130fc8
Packit 130fc8
    TYPE_SESSION    = BUS_SESSION
Packit 130fc8
    """Represents a session bus (same as the global dbus.BUS_SESSION)"""
Packit 130fc8
Packit 130fc8
    TYPE_SYSTEM     = BUS_SYSTEM
Packit 130fc8
    """Represents the system bus (same as the global dbus.BUS_SYSTEM)"""
Packit 130fc8
Packit 130fc8
    TYPE_STARTER = BUS_STARTER
Packit 130fc8
    """Represents the bus that started this service by activation (same as
Packit 130fc8
    the global dbus.BUS_STARTER)"""
Packit 130fc8
Packit 130fc8
    START_REPLY_SUCCESS = DBUS_START_REPLY_SUCCESS
Packit 130fc8
    START_REPLY_ALREADY_RUNNING = DBUS_START_REPLY_ALREADY_RUNNING
Packit 130fc8
Packit 130fc8
    def __new__(cls, address_or_type=TYPE_SESSION, mainloop=None):
Packit 130fc8
        bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
Packit 130fc8
Packit 130fc8
        # _bus_names is used by dbus.service.BusName!
Packit 130fc8
        bus._bus_names = weakref.WeakValueDictionary()
Packit 130fc8
Packit 130fc8
        bus._signal_sender_matches = {}
Packit 130fc8
        """Map from SignalMatch to NameOwnerWatch."""
Packit 130fc8
Packit 130fc8
        return bus
Packit 130fc8
Packit 130fc8
    def add_signal_receiver(self, handler_function, signal_name=None,
Packit 130fc8
                            dbus_interface=None, bus_name=None,
Packit 130fc8
                            path=None, **keywords):
Packit 130fc8
        named_service = keywords.pop('named_service', None)
Packit 130fc8
        if named_service is not None:
Packit 130fc8
            if bus_name is not None:
Packit 130fc8
                raise TypeError('bus_name and named_service cannot both be '
Packit 130fc8
                                'specified')
Packit 130fc8
            bus_name = named_service
Packit 130fc8
            from warnings import warn
Packit 130fc8
            warn('Passing the named_service parameter to add_signal_receiver '
Packit 130fc8
                 'by name is deprecated: please use positional parameters',
Packit 130fc8
                 DeprecationWarning, stacklevel=2)
Packit 130fc8
Packit 130fc8
        match = super(BusConnection, self).add_signal_receiver(
Packit 130fc8
                handler_function, signal_name, dbus_interface, bus_name,
Packit 130fc8
                path, **keywords)
Packit 130fc8
Packit 130fc8
        if (bus_name is not None and bus_name != BUS_DAEMON_NAME):
Packit 130fc8
            if bus_name[:1] == ':':
Packit 130fc8
                def callback(new_owner):
Packit 130fc8
                    if new_owner == '':
Packit 130fc8
                        match.remove()
Packit 130fc8
            else:
Packit 130fc8
                callback = match.set_sender_name_owner
Packit 130fc8
            watch = self.watch_name_owner(bus_name, callback)
Packit 130fc8
            self._signal_sender_matches[match] = watch
Packit 130fc8
Packit 130fc8
        self.add_match_string(str(match))
Packit 130fc8
Packit 130fc8
        return match
Packit 130fc8
Packit 130fc8
    def _clean_up_signal_match(self, match):
Packit 130fc8
        # The signals lock is no longer held here (it was in <= 0.81.0)
Packit 130fc8
        self.remove_match_string_non_blocking(str(match))
Packit 130fc8
        watch = self._signal_sender_matches.pop(match, None)
Packit 130fc8
        if watch is not None:
Packit 130fc8
            watch.cancel()
Packit 130fc8
Packit 130fc8
    def activate_name_owner(self, bus_name):
Packit 130fc8
        if (bus_name is not None and bus_name[:1] != ':'
Packit 130fc8
            and bus_name != BUS_DAEMON_NAME):
Packit 130fc8
            try:
Packit 130fc8
                return self.get_name_owner(bus_name)
Packit 130fc8
            except DBusException as e:
Packit 130fc8
                if e.get_dbus_name() != _NAME_HAS_NO_OWNER:
Packit 130fc8
                    raise
Packit 130fc8
                # else it doesn't exist: try to start it
Packit 130fc8
                self.start_service_by_name(bus_name)
Packit 130fc8
                return self.get_name_owner(bus_name)
Packit 130fc8
        else:
Packit 130fc8
            # already unique
Packit 130fc8
            return bus_name
Packit 130fc8
Packit 130fc8
    def get_object(self, bus_name, object_path, introspect=True,
Packit 130fc8
                   follow_name_owner_changes=False, **kwargs):
Packit 130fc8
        """Return a local proxy for the given remote object.
Packit 130fc8
Packit 130fc8
        Method calls on the proxy are translated into method calls on the
Packit 130fc8
        remote object.
Packit 130fc8
Packit 130fc8
        :Parameters:
Packit 130fc8
            `bus_name` : str
Packit 130fc8
                A bus name (either the unique name or a well-known name)
Packit 130fc8
                of the application owning the object. The keyword argument
Packit 130fc8
                named_service is a deprecated alias for this.
Packit 130fc8
            `object_path` : str
Packit 130fc8
                The object path of the desired object
Packit 130fc8
            `introspect` : bool
Packit 130fc8
                If true (default), attempt to introspect the remote
Packit 130fc8
                object to find out supported methods and their signatures
Packit 130fc8
            `follow_name_owner_changes` : bool
Packit 130fc8
                If the object path is a well-known name and this parameter
Packit 130fc8
                is false (default), resolve the well-known name to the unique
Packit 130fc8
                name of its current owner and bind to that instead; if the
Packit 130fc8
                ownership of the well-known name changes in future,
Packit 130fc8
                keep communicating with the original owner.
Packit 130fc8
                This is necessary if the D-Bus API used is stateful.
Packit 130fc8
Packit 130fc8
                If the object path is a well-known name and this parameter
Packit 130fc8
                is true, whenever the well-known name changes ownership in
Packit 130fc8
                future, bind to the new owner, if any.
Packit 130fc8
Packit 130fc8
                If the given object path is a unique name, this parameter
Packit 130fc8
                has no effect.
Packit 130fc8
Packit 130fc8
        :Returns: a `dbus.proxies.ProxyObject`
Packit 130fc8
        :Raises `DBusException`: if resolving the well-known name to a
Packit 130fc8
            unique name fails
Packit 130fc8
        """
Packit 130fc8
        if follow_name_owner_changes:
Packit 130fc8
            self._require_main_loop()   # we don't get the signals otherwise
Packit 130fc8
Packit 130fc8
        named_service = kwargs.pop('named_service', None)
Packit 130fc8
        if named_service is not None:
Packit 130fc8
            if bus_name is not None:
Packit 130fc8
                raise TypeError('bus_name and named_service cannot both '
Packit 130fc8
                                'be specified')
Packit 130fc8
            from warnings import warn
Packit 130fc8
            warn('Passing the named_service parameter to get_object by name '
Packit 130fc8
                 'is deprecated: please use positional parameters',
Packit 130fc8
                 DeprecationWarning, stacklevel=2)
Packit 130fc8
            bus_name = named_service
Packit 130fc8
        if kwargs:
Packit 130fc8
            raise TypeError('get_object does not take these keyword '
Packit 130fc8
                            'arguments: %s' % ', '.join(kwargs.keys()))
Packit 130fc8
Packit 130fc8
        return self.ProxyObjectClass(self, bus_name, object_path,
Packit 130fc8
                                     introspect=introspect,
Packit 130fc8
                                     follow_name_owner_changes=follow_name_owner_changes)
Packit 130fc8
Packit 130fc8
    def get_unix_user(self, bus_name):
Packit 130fc8
        """Get the numeric uid of the process owning the given bus name.
Packit 130fc8
Packit 130fc8
        :Parameters:
Packit 130fc8
            `bus_name` : str
Packit 130fc8
                A bus name, either unique or well-known
Packit 130fc8
        :Returns: a `dbus.UInt32`
Packit 130fc8
        :Since: 0.80.0
Packit 130fc8
        """
Packit 130fc8
        validate_bus_name(bus_name)
Packit 130fc8
        return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
Packit 130fc8
                                  BUS_DAEMON_IFACE, 'GetConnectionUnixUser',
Packit 130fc8
                                  's', (bus_name,))
Packit 130fc8
Packit 130fc8
    def start_service_by_name(self, bus_name, flags=0):
Packit 130fc8
        """Start a service which will implement the given bus name on this Bus.
Packit 130fc8
Packit 130fc8
        :Parameters:
Packit 130fc8
            `bus_name` : str
Packit 130fc8
                The well-known bus name to be activated.
Packit 130fc8
            `flags` : dbus.UInt32
Packit 130fc8
                Flags to pass to StartServiceByName (currently none are
Packit 130fc8
                defined)
Packit 130fc8
Packit 130fc8
        :Returns: A tuple of 2 elements. The first is always True, the
Packit 130fc8
            second is either START_REPLY_SUCCESS or
Packit 130fc8
            START_REPLY_ALREADY_RUNNING.
Packit 130fc8
Packit 130fc8
        :Raises `DBusException`: if the service could not be started.
Packit 130fc8
        :Since: 0.80.0
Packit 130fc8
        """
Packit 130fc8
        validate_bus_name(bus_name)
Packit 130fc8
        return (True, self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
Packit 130fc8
                                         BUS_DAEMON_IFACE,
Packit 130fc8
                                         'StartServiceByName',
Packit 130fc8
                                         'su', (bus_name, flags)))
Packit 130fc8
Packit 130fc8
    # XXX: it might be nice to signal IN_QUEUE, EXISTS by exception,
Packit 130fc8
    # but this would not be backwards-compatible
Packit 130fc8
    def request_name(self, name, flags=0):
Packit 130fc8
        """Request a bus name.
Packit 130fc8
Packit 130fc8
        :Parameters:
Packit 130fc8
            `name` : str
Packit 130fc8
                The well-known name to be requested
Packit 130fc8
            `flags` : dbus.UInt32
Packit 130fc8
                A bitwise-OR of 0 or more of the flags
Packit 130fc8
                `NAME_FLAG_ALLOW_REPLACEMENT`,
Packit 130fc8
                `NAME_FLAG_REPLACE_EXISTING`
Packit 130fc8
                and `NAME_FLAG_DO_NOT_QUEUE`
Packit 130fc8
        :Returns: `REQUEST_NAME_REPLY_PRIMARY_OWNER`,
Packit 130fc8
            `REQUEST_NAME_REPLY_IN_QUEUE`,
Packit 130fc8
            `REQUEST_NAME_REPLY_EXISTS` or
Packit 130fc8
            `REQUEST_NAME_REPLY_ALREADY_OWNER`
Packit 130fc8
        :Raises `DBusException`: if the bus daemon cannot be contacted or
Packit 130fc8
            returns an error.
Packit 130fc8
        """
Packit 130fc8
        validate_bus_name(name, allow_unique=False)
Packit 130fc8
        return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
Packit 130fc8
                                  BUS_DAEMON_IFACE, 'RequestName',
Packit 130fc8
                                  'su', (name, flags))
Packit 130fc8
Packit 130fc8
    def release_name(self, name):
Packit 130fc8
        """Release a bus name.
Packit 130fc8
Packit 130fc8
        :Parameters:
Packit 130fc8
            `name` : str
Packit 130fc8
                The well-known name to be released
Packit 130fc8
        :Returns: `RELEASE_NAME_REPLY_RELEASED`,
Packit 130fc8
            `RELEASE_NAME_REPLY_NON_EXISTENT`
Packit 130fc8
            or `RELEASE_NAME_REPLY_NOT_OWNER`
Packit 130fc8
        :Raises `DBusException`: if the bus daemon cannot be contacted or
Packit 130fc8
            returns an error.
Packit 130fc8
        """
Packit 130fc8
        validate_bus_name(name, allow_unique=False)
Packit 130fc8
        return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
Packit 130fc8
                                  BUS_DAEMON_IFACE, 'ReleaseName',
Packit 130fc8
                                  's', (name,))
Packit 130fc8
Packit 130fc8
    def list_names(self):
Packit 130fc8
        """Return a list of all currently-owned names on the bus.
Packit 130fc8
Packit 130fc8
        :Returns: a dbus.Array of dbus.UTF8String
Packit 130fc8
        :Since: 0.81.0
Packit 130fc8
        """
Packit 130fc8
        keywords = {}
Packit 130fc8
        if is_py2:
Packit 130fc8
            keywords['utf8_strings'] = True
Packit 130fc8
        return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
Packit 130fc8
                                  BUS_DAEMON_IFACE, 'ListNames',
Packit 130fc8
                                  '', (), **keywords)
Packit 130fc8
Packit 130fc8
    def list_activatable_names(self):
Packit 130fc8
        """Return a list of all names that can be activated on the bus.
Packit 130fc8
Packit 130fc8
        :Returns: a dbus.Array of dbus.UTF8String
Packit 130fc8
        :Since: 0.81.0
Packit 130fc8
        """
Packit 130fc8
        keywords = {}
Packit 130fc8
        if is_py2:
Packit 130fc8
            keywords['utf8_strings'] = True
Packit 130fc8
        return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
Packit 130fc8
                                  BUS_DAEMON_IFACE, 'ListActivatableNames',
Packit 130fc8
                                  '', (), **keywords)
Packit 130fc8
Packit 130fc8
    def get_name_owner(self, bus_name):
Packit 130fc8
        """Return the unique connection name of the primary owner of the
Packit 130fc8
        given name.
Packit 130fc8
Packit 130fc8
        :Raises `DBusException`: if the `bus_name` has no owner
Packit 130fc8
        :Since: 0.81.0
Packit 130fc8
        """
Packit 130fc8
        keywords = {}
Packit 130fc8
        if is_py2:
Packit 130fc8
            keywords['utf8_strings'] = True
Packit 130fc8
        validate_bus_name(bus_name, allow_unique=False)
Packit 130fc8
        return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
Packit 130fc8
                                  BUS_DAEMON_IFACE, 'GetNameOwner',
Packit 130fc8
                                  's', (bus_name,), **keywords)
Packit 130fc8
Packit 130fc8
    def watch_name_owner(self, bus_name, callback):
Packit 130fc8
        """Watch the unique connection name of the primary owner of the
Packit 130fc8
        given name.
Packit 130fc8
Packit 130fc8
        `callback` will be called with one argument, which is either the
Packit 130fc8
        unique connection name, or the empty string (meaning the name is
Packit 130fc8
        not owned).
Packit 130fc8
Packit 130fc8
        :Since: 0.81.0
Packit 130fc8
        """
Packit 130fc8
        return NameOwnerWatch(self, bus_name, callback)
Packit 130fc8
Packit 130fc8
    def name_has_owner(self, bus_name):
Packit 130fc8
        """Return True iff the given bus name has an owner on this bus.
Packit 130fc8
Packit 130fc8
        :Parameters:
Packit 130fc8
            `bus_name` : str
Packit 130fc8
                The bus name to look up
Packit 130fc8
        :Returns: a `bool`
Packit 130fc8
        """
Packit 130fc8
        return bool(self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
Packit 130fc8
                                       BUS_DAEMON_IFACE, 'NameHasOwner',
Packit 130fc8
                                       's', (bus_name,)))
Packit 130fc8
Packit 130fc8
    def add_match_string(self, rule):
Packit 130fc8
        """Arrange for this application to receive messages on the bus that
Packit 130fc8
        match the given rule. This version will block.
Packit 130fc8
Packit 130fc8
        :Parameters:
Packit 130fc8
            `rule` : str
Packit 130fc8
                The match rule
Packit 130fc8
        :Raises `DBusException`: on error.
Packit 130fc8
        :Since: 0.80.0
Packit 130fc8
        """
Packit 130fc8
        self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
Packit 130fc8
                           BUS_DAEMON_IFACE, 'AddMatch', 's', (rule,))
Packit 130fc8
Packit 130fc8
    # FIXME: add an async success/error handler capability?
Packit 130fc8
    # (and the same for remove_...)
Packit 130fc8
    def add_match_string_non_blocking(self, rule):
Packit 130fc8
        """Arrange for this application to receive messages on the bus that
Packit 130fc8
        match the given rule. This version will not block, but any errors
Packit 130fc8
        will be ignored.
Packit 130fc8
Packit 130fc8
Packit 130fc8
        :Parameters:
Packit 130fc8
            `rule` : str
Packit 130fc8
                The match rule
Packit 130fc8
        :Raises `DBusException`: on error.
Packit 130fc8
        :Since: 0.80.0
Packit 130fc8
        """
Packit 130fc8
        self.call_async(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
Packit 130fc8
                        BUS_DAEMON_IFACE, 'AddMatch', 's', (rule,),
Packit 130fc8
                        None, None)
Packit 130fc8
Packit 130fc8
    def remove_match_string(self, rule):
Packit 130fc8
        """Arrange for this application to receive messages on the bus that
Packit 130fc8
        match the given rule. This version will block.
Packit 130fc8
Packit 130fc8
        :Parameters:
Packit 130fc8
            `rule` : str
Packit 130fc8
                The match rule
Packit 130fc8
        :Raises `DBusException`: on error.
Packit 130fc8
        :Since: 0.80.0
Packit 130fc8
        """
Packit 130fc8
        self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
Packit 130fc8
                           BUS_DAEMON_IFACE, 'RemoveMatch', 's', (rule,))
Packit 130fc8
Packit 130fc8
    def remove_match_string_non_blocking(self, rule):
Packit 130fc8
        """Arrange for this application to receive messages on the bus that
Packit 130fc8
        match the given rule. This version will not block, but any errors
Packit 130fc8
        will be ignored.
Packit 130fc8
Packit 130fc8
Packit 130fc8
        :Parameters:
Packit 130fc8
            `rule` : str
Packit 130fc8
                The match rule
Packit 130fc8
        :Raises `DBusException`: on error.
Packit 130fc8
        :Since: 0.80.0
Packit 130fc8
        """
Packit 130fc8
        self.call_async(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
Packit 130fc8
                        BUS_DAEMON_IFACE, 'RemoveMatch', 's', (rule,),
Packit 130fc8
                        None, None)