Skip to content
This repository has been archived by the owner on Aug 5, 2018. It is now read-only.

Commit

Permalink
updated tinyts3 to v1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
hajo-p committed Mar 19, 2013
1 parent 83072c8 commit 88504cf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
43 changes: 24 additions & 19 deletions tinyts3/mods/tinyts3/func.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@
// ClanSphere 2010 - www.clansphere.net
// $Id: $

function cs_ts3_parse($handle, $query) {

$nl = "\n";
$done = false;
$result = '';

fwrite($handle, $query . $nl);

while($done == false)
{
$read = fread($handle, 4096);
$result .= $read;
$ok = substr($read, -9, 7);
if(empty($read) OR $ok == ' msg=ok')
$done = true;
}

return $result;
}

function cs_ts3_status($host, $query_port, $client_port) {

# exit when port data is not available
Expand All @@ -19,31 +39,16 @@ function cs_ts3_status($host, $query_port, $client_port) {
return false;
}
else {
$nl = "\n";
$result = array();

stream_set_timeout($ts3_con, $timeout);

$result['connect'] = fread($ts3_con, 4096);
$result['welcome'] = fread($ts3_con, 4096);

fwrite($ts3_con, "use port=" . $client_port . $nl);
$result['status'] = fread($ts3_con, 4096);

fwrite($ts3_con, 'serverinfo' . $nl);
$result['info'] = fread($ts3_con, 4096);
$result['info_status'] = fread($ts3_con, 4096);

fwrite($ts3_con, 'clientlist' . $nl);
$result['user'] = fread($ts3_con, 4096);
$result['user_status'] = fread($ts3_con, 4096);
$result['connect'] = cs_ts3_parse($ts3_con, 'use port=' . $client_port);
$result['info'] = cs_ts3_parse($ts3_con, 'serverinfo');
$result['user'] = cs_ts3_parse($ts3_con, 'clientlist');

fclose($ts3_con);

# exit when user data is not available
if(empty($result['user']))
return false;

# format fetched data for later usage
$info = array();
$info['userlist'] = array();
Expand Down
2 changes: 1 addition & 1 deletion tinyts3/mods/tinyts3/info.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
$cs_lang = cs_translate('tinyts3');

$mod_info['name'] = $cs_lang['mod_name'];
$mod_info['version'] = '2011.3 v1.4';
$mod_info['version'] = '2011.3 v1.5';
$mod_info['released'] = '2013-03-19';
$mod_info['creator'] = 'ClanSphere';
$mod_info['team'] = 'ClanSphere';
Expand Down
5 changes: 3 additions & 2 deletions tinyts3/readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tinyts3 for clansphere 1.4
tinyts3 for clansphere 1.5
--------------------------

requirements:
Expand Down Expand Up @@ -30,4 +30,5 @@ changelog:
1.1 - fixed some problems with spaces plus minor code optimizations
1.2 - better timeout handling, improved userlist, option info text added
1.3 - bugfixed userlist and improved online users count
1.4 - improved handling of empty and defect user data
1.4 - improved handling of empty and defect user data
1.5 - new function handles server response to allow for arbitrary content length

0 comments on commit 88504cf

Please sign in to comment.