Adding a New Domain or Updating Existing One
Prev | Chapter 65. Specification for ad-hoc Commands Used to Manage Virtual Domains | Next

## Adding a New Domain or Updating Existing One

In order to add a new domain or update existing one you have to send an ad-hoc command VHOSTS_UPDATE with at least domain name in the command data form. You can also specify whether the domain is enabled or disabled but this is optional. Future releases may allow for setting additional parameters for the domain: maximum number of user accounts for this domain, anonymous login enabled/disabled for the domain, registration via XMPP enabled/disabled for this domain and some more parameters not specified yet.

The domain add/update command request is of the form:

    <iq type="set"
        to="vhost-man@existing.domain.com"
        id="aacba">
      <command xmlns="http://jabber.org/protocol/commands"
               node="VHOSTS_UPDATE">
        <x xmlns="jabber:x:data" type="submit">
          <field type="text-single"
                 var="VHost">
            <value>new-virt.domain.com</value>
          </field>
          <field type="list-single"
                 var="Enabled">
            <value>true</value>
          </field>
        </x>
      </command>
    </iq>

Please note! Character case in the command field variable names does matter.

Upon successful completion of the command the server sends a response back to the client with information of the existing number of virtual hosts on the server:

    <iq from="vhost-man@existing.domain.com"
        type="result"
        to="cmd-sender-admin@existing.domain.com"
        id="aacba">
      <command xmlns="http://jabber.org/protocol/commands"
               status="completed"
               node="VHOSTS_UPDATE">
        <x xmlns="jabber:x:data" type="result">
          <field type="fixed" var="Note">
            <value>Current number of VHosts: 124</value>
          </field>
        </x>
      </command>
    </iq>

Prev | Up | Next
Chapter 65. Specification for ad-hoc Commands Used to Manage Virtual Domains | Home | Removing a Virtual Domain From the Server