Skip to content

Commit

Permalink
Add support for muted channels
Browse files Browse the repository at this point in the history
  • Loading branch information
Impact123 committed Aug 19, 2015
1 parent e08388a commit 00e5b88
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
19 changes: 19 additions & 0 deletions web/ts3/include/app.config.php
Expand Up @@ -40,6 +40,25 @@



/*
Admins inside these channels will not receive messages
$muted_channels = array
(
'channelname 1',
'channelname 2',
'channelname 3',
);
*/

$muted_channels = array
(
'',
);




/*
*---------------------------------------------------------------
* CONNECTION SETTINGS
Expand Down
30 changes: 30 additions & 0 deletions web/ts3/index.php
Expand Up @@ -90,13 +90,38 @@
require_once("include/TeamSpeak3/TeamSpeak3.php");
$ts3 = new TeamSpeak3();
$alreadyAdded = Array();
$inMutedChannel = Array();

try
{
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://". $user . ":" . $password . "@" . $host . ":" . $queryport . "/?server_port=" . $port);

$uid = "";
//$name = "";

if (isset($muted_channels) && is_array($muted_channels))
{
foreach ($ts3_VirtualServer->channelList() as $ts3_Channel)
{
$channelName = $ts3_Channel->__toString();

if (!in_array($channelName, $muted_channels))
{
continue;
}

foreach ($ts3_Channel->clientList() as $client)
{
$clientUid = (string)$client['client_unique_identifier'];

if (!in_array($clientUid, $inMutedChannel))
{
array_push($inMutedChannel, $clientUid);
}
}
}
}

foreach ($ts3_VirtualServer->clientList() as $ts3_Client)
{
$uid = (string)$ts3_Client['client_unique_identifier'];
Expand All @@ -109,6 +134,11 @@
continue;
}

// If in muted channel, skip this uid
if (in_array($uid, $inMutedChannel))
{
continue;
}

// Is listed as admin, go send him a message
if (in_array($uid, $access_keys[$_GET['key']]))
Expand Down

0 comments on commit 00e5b88

Please sign in to comment.