Skip to content
Back to top
View this page

# XEP-0080: User Location

class slixmpp.plugins.xep_0080.XEP_0080(xmpp, config=None)

  XEP-0080: User Location

  dependencies: ClassVar[Set[str]] = {'xep_0163'}

    Some plugins may depend on others in order to function properly. Any plugin names included in `dependencies` will be initialized as needed if this plugin is enabled.

  description: str = 'XEP-0080: User Location'

    A longer name for the plugin, describing its purpose. For example, a plugin for XEP-0030 would use ‘Service Discovery’ as its description value.

  name: str = 'xep_0080'

    A short name for the plugin based on the implemented specification. For example, a plugin for XEP-0030 would use ‘xep_0030’.

  publish_location(**kwargs)

    Publish the user’s current location.

    Parameters:

      - accuracy – Horizontal GPS error in meters.

      - alt – Altitude in meters above or below sea level.

      - area – A named area such as a campus or neighborhood.

      - bearing – GPS bearing (direction in which the entity is heading to reach its next waypoint), measured in decimal degrees relative to true north.

      - building – A specific building on a street or in an area.

      - country – The nation where the user is located.

      - countrycode – The ISO 3166 two-letter country code.

      - datum – GPS datum.

      - description – A natural-language name for or description of the location.

      - error – Horizontal GPS error in arc minutes. Obsoleted by the accuracy parameter.

      - floor – A particular floor in a building.

      - lat – Latitude in decimal degrees North.

      - locality – A locality within the administrative region, such as a town or city.

      - lon – Longitude in decimal degrees East.

      - postalcode – A code used for postal delivery.

      - region – An administrative region of the nation, such as a state or province.

      - room – A particular room in a building.

      - speed – The speed at which the entity is moving, in meters per second.

      - street – A thoroughfare within the locality, or a crossing of two thoroughfares.

      - text – A catch-all element that captures any other information about the location.

      - timestamp – UTC timestamp specifying the moment when the reading was taken.

      - uri – A URI or URL pointing to information about the location.

      - options – Optional form of publish options.

    Return type:

      `Future`

  stop(ifrom=None, callback=None, timeout=None)

    Clear existing user location information to stop notifications.

    Return type:

      `Future`

## Stanza elements

class slixmpp.plugins.xep_0080.stanza.Geoloc(xml=None, parent=None)

  XMPP’s <geoloc> stanza allows entities to know the current geographical or physical location of an entity. (XEP-0080: User Location)

  Example <geoloc> stanzas:

      <geoloc xmlns='http://jabber.org/protocol/geoloc'/>

      <geoloc xmlns='http://jabber.org/protocol/geoloc' xml:lang='en'>
        <accuracy>20</accuracy>
        <country>Italy</country>
        <lat>45.44</lat>
        <locality>Venice</locality>
        <lon>12.33</lon>
      </geoloc>

  Stanza Interface:

      accuracy    -- Horizontal GPS error in meters.
      alt         -- Altitude in meters above or below sea level.
      area        -- A named area such as a campus or neighborhood.
      bearing     -- GPS bearing (direction in which the entity is
                     heading to reach its next waypoint), measured in
                     decimal degrees relative to true north.
      building    -- A specific building on a street or in an area.
      country     -- The nation where the user is located.
      countrycode -- The ISO 3166 two-letter country code.
      datum       -- GPS datum.
      description -- A natural-language name for or description of
                     the location.
      error       -- Horizontal GPS error in arc minutes. Obsoleted by
                     the accuracy parameter.
      floor       -- A particular floor in a building.
      lat         -- Latitude in decimal degrees North.
      locality    -- A locality within the administrative region, such
                     as a town or city.
      lon         -- Longitude in decimal degrees East.
      postalcode  -- A code used for postal delivery.
      region      -- An administrative region of the nation, such
                     as a state or province.
      room        -- A particular room in a building.
      speed       -- The speed at which the entity is moving,
                     in meters per second.
      street      -- A thoroughfare within the locality, or a crossing
                     of two thoroughfares.
      text        -- A catch-all element that captures any other
                     information about the location.
      timestamp   -- UTC timestamp specifying the moment when the
                     reading was taken.
      uri         -- A URI or URL pointing to information about
                     the location.

  exception(e)

    Override exception passback for presence.

  get_accuracy()

    Return the value of the <accuracy> element as an integer.

  get_alt()

    Return the value of the <alt> element as an integer.

  get_bearing()

    Return the value of the <bearing> element as a float.

  get_error()

    Return the value of the <error> element as a float.

  get_lat()

    Return the value of the <lat> element as a float.

  get_lon()

    Return the value of the <lon> element as a float.

  get_speed()

    Return the value of the <speed> element as a float.

  get_timestamp()

    Return the value of the <timestamp> element as a DateTime.

  interfaces: ClassVar[Set[str]] = {'accuracy', 'alt', 'area', 'bearing', 'building', 'country', 'countrycode', 'datum', 'description', 'error', 'floor', 'lat', 'locality', 'lon', 'postalcode', 'region', 'room', 'speed', 'street', 'text', 'timestamp', 'uri'}

    The set of keys that the stanza provides for accessing and manipulating the underlying XML object. This set may be augmented with the `plugin_attrib` value of any registered stanza plugins.

  name: ClassVar[str] = 'geoloc'

    The XML tag name of the element, not including any namespace prefixes. For example, an `ElementBase` object for `<message />` would use `name = 'message'`.

  namespace: str = 'http://jabber.org/protocol/geoloc'

    The XML namespace for the element. Given `<foo xmlns="bar" />`, then `namespace = "bar"` should be used. The default namespace is `jabber:client` since this is being used in an XMPP library.

  plugin_attrib: ClassVar[str] = 'geoloc'

    For `ElementBase` subclasses which are intended to be used as plugins, the `plugin_attrib` value defines the plugin name. Plugins may be accessed by using the `plugin_attrib` value as the interface. An example using `plugin_attrib = 'foo'`:

        register_stanza_plugin(Message, FooPlugin)
        msg = Message()
        msg['foo']['an_interface_from_the_foo_plugin']

  set_accuracy(accuracy)

    Set the value of the <accuracy> element.

    Parameters:

      accuracy – Horizontal GPS error in meters

  set_alt(alt)

    Set the value of the <alt> element.

    Parameters:

      alt – Altitude in meters above or below sea level

  set_bearing(bearing)

    Set the value of the <bearing> element.

    Parameters:

      bearing – GPS bearing (direction in which the entity is heading to reach its next waypoint), measured in decimal degrees relative to true north

  set_error(error)

    Set the value of the <error> element.

    Parameters:

      error – Horizontal GPS error in arc minutes; this element is deprecated in favor of <accuracy/>

  set_lat(lat)

    Set the value of the <lat> element.

    Parameters:

      lat – Latitude in decimal degrees North

  set_lon(lon)

    Set the value of the <lon> element.

    Parameters:

      lon – Longitude in decimal degrees East

  set_speed(speed)

    Set the value of the <speed> element.

    Parameters:

      speed – The speed at which the entity is moving, in meters per second

  set_timestamp(timestamp)

    Set the value of the <timestamp> element.

    Parameters:

      timestamp – UTC timestamp specifying the moment when the reading was taken

  sub_interfaces: ClassVar[Set[str]] = {'accuracy', 'alt', 'area', 'bearing', 'building', 'country', 'countrycode', 'datum', 'description', 'error', 'floor', 'lat', 'locality', 'lon', 'postalcode', 'region', 'room', 'speed', 'street', 'text', 'timestamp', 'uri'}

    A subset of `interfaces` which maps interfaces to direct subelements of the underlying XML object. Using this set, the text of these subelements may be set, retrieved, or removed without needing to define custom methods.