Server information
| Retrieve and store information |

### Server information

Similar to querying client and channel data, server information can be checked with

`unsigned int ts3client_getServerVariableAsInt(` | serverConnectionHandlerID, |
| flag, |
| result`)`; |

`anyID serverConnectionHandlerID`;
`VirtualServerProperties flag`;
`int* result`;

`unsigned int ts3client_getServerVariableAsUInt64(` | serverConnectionHandlerID, |
| flag, |
| result`)`; |

`anyID serverConnectionHandlerID`;
`VirtualServerProperties flag`;
`uint64* result`;

`unsigned int ts3client_getServerVariableAsString(` | serverConnectionHandlerID, |
| flag, |
| result`)`; |

`anyID serverConnectionHandlerID`;
`VirtualServerProperties flag`;
`char** result`;

Parameters

- `serverConnectionHandlerID`

  ID of the server connection handler on which the virtual server property is queried.

- `clientID`

  ID of the client whose property is queried.

- `flag`

  Virtual server propery to query, see below.

- `result`

  Address of a variable which receives the result value as int, uint64 or string, depending on which function is used. In case of a string, memory must be released using `ts3client_freeMemory`, unless an error occured.

  The returned type uint64 is defined as __int64 on Windows and uint64_t on Linux and Mac OS X. See the header `public_definitions.h`. This function is currently only used for the flag `VIRTUALSERVER_UPTIME`.

Returns `ERROR_ok` on success, otherwise an error code as defined in `public_errors.h`. For the string version: If an error has occured, the result string is uninitialized and must not be released.

The parameter `flag` specifies the type of queried information. It is defined by the enum VirtualServerProperties:

    enum VirtualServerProperties {
      VIRTUALSERVER_UNIQUE_IDENTIFIER = 0, //available when connected, can be used to identify this particular
                                           //server installation
      VIRTUALSERVER_NAME,                  //available and always up-to-date when connected
      VIRTUALSERVER_WELCOMEMESSAGE,        //available when connected, not updated while connected
      VIRTUALSERVER_PLATFORM,              //available when connected
      VIRTUALSERVER_VERSION,               //available when connected
      VIRTUALSERVER_MAXCLIENTS,            //only available on request (=> requestServerVariables), stores the
                                           //maximum number of clients that may currently join the server
      VIRTUALSERVER_PASSWORD,              //not available to clients, the server password
      VIRTUALSERVER_CLIENTS_ONLINE,        //only available on request (=> requestServerVariables),
      VIRTUALSERVER_CHANNELS_ONLINE,       //only available on request (=> requestServerVariables),
      VIRTUALSERVER_CREATED,               //available when connected, stores the time when the server was created
      VIRTUALSERVER_UPTIME,                //only available on request (=> requestServerVariables), the time
                                           //since the server was started
      VIRTUALSERVER_ENDMARKER,
    };

- `VIRTUALSERVER_UNIQUE_IDENTIFIER`

  Unique ID for this virtual server. Stays the same after restarting the server application. Always available when connected.

- `VIRTUALSERVER_NAME`

  Name of this virtual server. Always available when connected.

- `VIRTUALSERVER_WELCOMEMESSAGE`

  Optional welcome message sent to the client on login. This value should be queried by the client after connection has been established, it is not updated afterwards.

- `VIRTUALSERVER_PLATFORM`

  Operating system used by this server. Always available when connected.

- `VIRTUALSERVER_VERSION`

  Application version of this server. Always available when connected.

- `VIRTUALSERVER_MAXCLIENTS`

  Defines maximum number of clients which may connect to this server. Needs to be requested using `ts3client_requestServerVariables`.

- `VIRTUALSERVER_PASSWORD`

  Optional password of this server. Not available to clients.

- `VIRTUALSERVER_CLIENTS_ONLINE`

  `VIRTUALSERVER_CHANNELS_ONLINE`

  Number of clients and channels currently on this virtual server. Needs to be requested using `ts3client_requestServerVariables`.

- `VIRTUALSERVER_CREATED`

  Time when this virtual server was created. Always available when connected.

- `VIRTUALSERVER_UPTIME`

  Uptime of this virtual server. Needs to be requested using `ts3client_requestServerVariables`.

Example code checking the number of clients online, obviously an integer value:

    int clientsOnline;

    if(ts3client_getServerVariableAsInt(scHandlerID, VIRTUALSERVER_CLIENTS_ONLINE, &clientsOnline) == ERROR_ok)
        printf("There are %d clients online\n", clientsOnline);

A client can request refreshing the server information with:

`unsigned int ts3client_requestServerVariables(` | serverConnectionHandlerID`)`; |

`anyID serverConnectionHandlerID`;

The following event informs the client when the requested information is available:

`unsigned int onServerUpdatedEvent(` | serverConnectionHandlerID`)`; |

`anyID serverConnectionHandlerID`;

The following event notifies the client when virtual server information has been edited:

`void onServerEditedEvent(` | serverConnectionHandlerID, |
| editerID, |
| editerName, |
| editerUniqueIdentifier`)`; |

`anyID serverConnectionHandlerID`;
`anyID editerID`;
`anyID editerName`;
`const char* editerUniqueIdentifier`;

Parameters

- `serverConnectionHandlerID`

  ID of the server connection handler which virtual server information has been changed.

- `editerID`

  ID of the client who edited the information. If zero, the server is the editor.

- `editerName`

  Name of the client who edited the information.

- `editerUniqueIdentifier`

  Unique ID of the client who edited the information.

Channel sorting |  | Interacting with the server