## Service description file format

Services for libaccounts-glib providers are described with a simple XML file. An example for a hypothetical `CoolProvider` chat service is shown below:

Example 6. Service description for CoolProvider chat service

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    <?xml version="1.0" encoding="UTF-8"?>
    <service id="coolprovider-chat">
      <type>IM</type>
      <name>CoolProvider Chat</name>
      <description>Chat with your cool friends</description>
      <icon>coolprovider</icon>
      <provider>coolprovider</provider>
      <translations>coolprovider</translations>
      <tags>
        <tag>chat</tag>
      </tags>

      <template>
        <group name="telepathy">
          <setting name="manager">gabble</setting>
          <setting name="protocol">jabber</setting>
        </group>

        <group name="auth">
          <setting name="method">oauth2</setting>
          <setting name="mechanism">user_agent</setting>
          <group name="oauth2/user_agent">
            <setting name="ClientId">ABCDEclient.ID</setting>
          </group>
        </group>
      </template>

    </service>

The example service description describes a service called `coolprovider-chat`, indicated by the `id` attribute on the `service` element. The `type` element corresponds to the service type. The `name` element contains a human-readable version of the service name. The `description` is a string that describes the service in general. The `icon` element specifies a themed icon to represent the service. The `provider` element must point to the identifier of the provider which supports this service. The `translations` element is used to indicate the gettext translation domain for the name and description elements, to be used by applications when showing those elements in a UI. The `tags` element is a container of `tag` elements, which are used to describe the service in abstract terms. Finally, a `template` element is a container for `group` elements, which themselves are containers of `setting` elements. Settings stored within the template are default settings for the service, which the applications using the account may need in order to function correctly. The default settings can be overriden, typically at run time during the account configuration phase.

### Installation

Service description filenames should end in `.service` and be installed to `${prefix}/share/accounts/services`, which normally expands to `/usr/share/accounts/services`. The path can be queried with pkg-config by checking the `servicefilesdir` variable of the libaccounts-glib pkg-config file, for example:

    1
    pkg-config --variable=servicefilesdir libaccounts-glib