292 $props =
new stdClass();
294 if (is_a($this->currObj, Node::class)) {
297 $props->version = $this->currObj->version(
"version")->toString();
298 $props->platform = $this->currObj->version(
"platform")->toString();
299 $props->users = $this->currObj->virtualservers_total_clients_online;
300 $props->slots = $this->currObj->virtualservers_total_maxclients;
302 } elseif (is_a($this->currObj, Server::class)) {
303 $props->id = $this->currObj->getId();
304 $props->icon = ($this->currObj->virtualserver_icon_id < 0) ? pow(2, 32) - ($this->currObj->virtualserver_icon_id * -1) : $this->currObj->virtualserver_icon_id;
305 $props->welcmsg = strlen($this->currObj->virtualserver_welcomemessage) ? trim($this->currObj->virtualserver_welcomemessage) :
null;
306 $props->hostmsg = strlen($this->currObj->virtualserver_hostmessage) ? trim($this->currObj->virtualserver_hostmessage) :
null;
307 $props->version = Convert::versionShort($this->currObj->virtualserver_version)->toString();
308 $props->platform = $this->currObj->virtualserver_platform->toString();
309 $props->country =
null;
310 $props->users = $this->currObj->clientCount();
311 $props->slots = $this->currObj->virtualserver_maxclients;
314 $props->flags += $this->currObj->virtualserver_status ===
"online" ? 1 : 0;
315 $props->flags += $this->currObj->virtualserver_flag_password ? 2 : 0;
316 $props->flags += $this->currObj->virtualserver_autostart ? 4 : 0;
317 $props->flags += $this->currObj->virtualserver_weblist_enabled ? 8 : 0;
318 $props->flags += $this->currObj->virtualserver_ask_for_privilegekey ? 16 : 0;
319 } elseif (is_a($this->currObj, Channel::class)) {
320 $props->id = $this->currObj->getId();
322 if (!$this->currObj->isSpacer()) {
323 $props->icon = $this->currObj->channel_icon_id < 0 ? (2 ** 32) - ($this->currObj->channel_icon_id * -1) : $this->currObj->channel_icon_id;
326 $props->path = trim($this->currObj->getPathway());
327 $props->topic = strlen($this->currObj->channel_topic) ? trim($this->currObj->channel_topic) :
null;
328 $props->codec = $this->currObj->channel_codec;
329 $props->users = $this->currObj->total_clients == -1 ? 0 : $this->currObj->total_clients;
330 $props->slots = $this->currObj->channel_maxclients == -1 ? $this->currObj->getParent()->virtualserver_maxclients : $this->currObj->channel_maxclients;
331 $props->famusers = $this->currObj->total_clients_family == -1 ? 0 : $this->currObj->total_clients_family;
332 $props->famslots = $this->currObj->channel_maxfamilyclients == -1 ? $this->currObj->getParent()->virtualserver_maxclients : $this->currObj->channel_maxfamilyclients;
336 $props->flags += $this->currObj->channel_flag_default ? 1 : 0;
337 $props->flags += $this->currObj->channel_flag_password ? 2 : 0;
338 $props->flags += $this->currObj->channel_flag_permanent ? 4 : 0;
339 $props->flags += $this->currObj->channel_flag_semi_permanent ? 8 : 0;
340 $props->flags += ($props->codec == 3 || $props->codec == 5) ? 16 : 0;
341 $props->flags += $this->currObj->channel_needed_talk_power != 0 ? 32 : 0;
342 $props->flags += $this->currObj->total_clients != -1 ? 64 : 0;
343 $props->flags += $this->currObj->isSpacer() ? 128 : 0;
344 } elseif (is_a($this->currObj, Client::class)) {
345 $props->id = $this->currObj->getId();
346 $props->icon = $this->currObj->client_icon_id < 0 ? pow(2, 32) - ($this->currObj->client_icon_id * -1) : $this->currObj->client_icon_id;
347 $props->version = Convert::versionShort($this->currObj->client_version)->toString();
348 $props->platform = $this->currObj->client_platform->toString();
349 $props->country = strlen($this->currObj->client_country) ? trim($this->currObj->client_country) :
null;
350 $props->awaymesg = strlen($this->currObj->client_away_message) ? trim($this->currObj->client_away_message) :
null;
351 $props->memberof = [];
352 $props->badges = $this->currObj->getBadges();
355 foreach ($this->currObj->memberOf() as $num => $group) {
356 $props->memberof[$num] =
new stdClass();
358 $props->memberof[$num]->name = trim($group->name);
359 $props->memberof[$num]->icon = $group->iconid < 0 ? pow(2, 32) - ($group->iconid * -1) : $group->iconid;
360 $props->memberof[$num]->order = $group->sortid;
361 $props->memberof[$num]->flags = 0;
363 $props->memberof[$num]->flags += $group->namemode;
364 $props->memberof[$num]->flags += $group->type == 2 ? 4 : 0;
365 $props->memberof[$num]->flags += $group->type == 0 ? 8 : 0;
366 $props->memberof[$num]->flags += $group->savedb ? 16 : 0;
367 $props->memberof[$num]->flags += $group instanceof
ServerGroup ? 32 : 0;
370 $props->flags += $this->currObj->client_away ? 1 : 0;
371 $props->flags += $this->currObj->client_is_recording ? 2 : 0;
372 $props->flags += $this->currObj->client_is_channel_commander ? 4 : 0;
373 $props->flags += $this->currObj->client_is_priority_speaker ? 8 : 0;
374 $props->flags += $this->currObj->client_is_talker ? 16 : 0;
375 $props->flags += $this->currObj->channelGetById($this->currObj->cid)->channel_needed_talk_power > $this->currObj->client_talk_power && !$this->currObj->client_is_talker ? 32 : 0;
376 $props->flags += $this->currObj->client_input_muted || !$this->currObj->client_input_hardware ? 64 : 0;
377 $props->flags += $this->currObj->client_output_muted || !$this->currObj->client_output_hardware ? 128 : 0;
378 } elseif (is_a($this->currObj, ServerGroup::class) || is_a($this->currObj, ChannelGroup::class)) {
379 $props->id = $this->currObj->getId();
380 $props->icon = $this->currObj->iconid < 0 ? pow(2, 32) - ($this->currObj->iconid * -1) : $this->currObj->iconid;
381 $props->order = $this->currObj->sortid;
382 $props->n_map = $this->currObj->n_member_addp;
383 $props->n_mrp = $this->currObj->n_member_removep;
386 $props->flags += $this->currObj->namemode;
387 $props->flags += $this->currObj->type == 2 ? 4 : 0;
388 $props->flags += $this->currObj->type == 0 ? 8 : 0;
389 $props->flags += $this->currObj->savedb ? 16 : 0;
390 $props->flags += $this->currObj instanceof
ServerGroup ? 32 : 0;