diff --git a/LICENSE b/LICENSE index 70566f2..8612e1a 100644 --- a/LICENSE +++ b/LICENSE @@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} + TS3-Autochannel + Copyright (C) 2015 Simon Körner This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - {project} Copyright (C) {year} {fullname} + TS3-Autochannel Copyright (C) 2015 Simon Körner This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. \ No newline at end of file +. diff --git a/README.md b/README.md index b62058a..1802133 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,4 @@ There are some requirements to the channel structure: The root channels can be nested of course and you can set exceptional channels which are ignored during the excecution. -![reference tree](https://cdn.mediacru.sh/FKlUC2WMHvAo.jpe) - -![live and in action](https://cdn.mediacru.sh/whvu4UCSep_d.jpg) +You can have a look at it live on the TS3 server gamemodeon.de diff --git a/config.inc.php.dist b/config.inc.php.dist index a0374c4..d94fff4 100644 --- a/config.inc.php.dist +++ b/config.inc.php.dist @@ -1,8 +1,8 @@ channelGetByName($root); + $subs = $root->subChannelList(); + foreach($subs as $sub) { + if(catchExceptions($sub['channel_name'], $exceptions)) { + continue; + } + + $groups = $sub->subChannelList(); + $groupCount = count($groups); + + $delete = false; + $i = 0; + foreach($groups as $group) { + if(catchExceptions($group['channel_name'], $exceptions)) { + $groupCount--; + continue; + } + $i++; + if($delete == true AND $group['total_clients'] == 0) { + $group->delete(); + } + if($group['total_clients'] == 0) { + $delete = true; + } + if($i == $groupCount AND $delete == false) { + $regex = '#([0-9]{1,3})#e'; + $replacement = '("$1" + 1)'; + $newName = preg_replace($regex, $replacement, $group['channel_name']); + createChannel($server, $newName, $sub, $options); + } + } + if(empty($groups) OR $i == 0) { + createChannel($server, $default, $sub, $options, array('channel_flag_permanent' => TRUE)); + } + } +} diff --git a/main.php b/main.php deleted file mode 100644 index 93b28f5..0000000 --- a/main.php +++ /dev/null @@ -1,40 +0,0 @@ -channelGetByName($root); - $subs = $root->subChannelList(); - foreach($subs as $sub) { - if(catchExceptions($sub['channel_name'], $exceptions)) { - continue; - } - - $groups = $sub->subChannelList(); - $groupCount = count($groups); - - $delete = false; - $i = 0; - foreach($groups as $group) { - if(catchExceptions($group['channel_name'], $exceptions)) { - $groupCount--; - continue; - } - $i++; - if($delete == true AND $group['total_clients'] == 0) { - $group->delete(); - } - if($group['total_clients'] == 0) { - $delete = true; - } - if($i == $groupCount AND $delete == false) { - $regex = '#([0-9]{1,3})#e'; - $replacement = '("$1" + 1)'; - $newName = preg_replace($regex, $replacement, $group['channel_name']); - createChannel($server, $newName, $sub, $options); - } - } - if(empty($groups) OR $i == 0) { - createChannel($server, $default, $sub, $options, array('channel_flag_permanent' => TRUE)); - } - } -}