Index: teamspeak.info
===================================================================
RCS file: /cvs/drupal/contributions/modules/teamspeak/Attic/teamspeak.info,v
retrieving revision 1.1.4.2
diff -a -u -b -r1.1.4.2 teamspeak.info
--- teamspeak.info	22 Feb 2007 20:09:06 -0000	1.1.4.2
+++ teamspeak.info	31 May 2008 23:54:45 -0000
@@ -1,2 +1,3 @@
 name = TeamSpeak 
 description = Adds TeamSpeak blocks to your site. 
+core = 6.x 
Index: teamspeak.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/teamspeak/Attic/teamspeak.module,v
retrieving revision 1.1.6.4
diff -a -u -b -r1.1.6.4 teamspeak.module
--- teamspeak.module	17 Mar 2008 17:39:27 -0000	1.1.6.4
+++ teamspeak.module	31 May 2008 23:54:46 -0000
@@ -9,52 +9,55 @@
 /**
  * Implementation of hook_menu().
  */
-function teamspeak_menu($may_cache) {
+function teamspeak_menu() {
   $items = array();
 
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/settings/teamspeak',
-      'title' => t('TeamSpeak'),
-      'description' => t('Configure TeamSpeak blocks.'),
-      'callback' => 'teamspeak_list',
-    );
-    $items[] = array(
-      'path' => 'admin/settings/teamspeak/list',
-      'title' => t('list'),
+  $items['admin/settings/teamspeak'] = array(
+    'title' => 'TeamSpeak',
+    'description' => 'Configure TeamSpeak blocks.',
+    'page callback' => 'teamspeak_list',
+    'access callback' => 'user_access',
+    'access arguments' => array('administer teamspeak'),
+  );
+  $items['admin/settings/teamspeak/list'] = array(
+    'title' => 'list',
       'type' => MENU_DEFAULT_LOCAL_TASK,
-      'callback' => 'teamspeak_list',
-      'access' => user_access('administer teamspeak'),
+    'page callback' => 'teamspeak_list',
       'weight' => -10,
+    'access callback' => 'user_access',
+    'access arguments' => array('administer teamspeak'),
     );
-    $items[] = array(
-      'path' => 'admin/settings/teamspeak/add',
-      'title' => t('add block'),
+  $items['admin/settings/teamspeak/add'] = array(
+    'title' => 'add block',
       'type' => MENU_LOCAL_TASK,
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('teamspeak_edit'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('teamspeak_edit'),
+    'access callback' => 'user_access',
+    'access arguments' => array('administer teamspeak'),
     );
-    $items[] = array(
-      'path' => 'admin/settings/teamspeak/edit',
-      'title' => t('edit block'),
+  $items['admin/settings/teamspeak/edit'] = array(
+    'title' => 'edit block',
       'type' => MENU_CALLBACK,
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('teamspeak_edit'),
-    );
-    $items[] = array(
-      'path' => 'admin/settings/teamspeak/delete',
-      'title' => t('delete block'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('teamspeak_delete_block'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('teamspeak_edit'),
+    'access callback' => 'user_access',
+    'access arguments' => array('administer teamspeak'),
+  );
+  $items['admin/settings/teamspeak/delete'] = array(
+    'title' => 'delete block',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('teamspeak_delete_block'),
       'type' => MENU_CALLBACK,
+    'access callback' => 'user_access',
+    'access arguments' => array('administer teamspeak'),
     );
-    $items[] = array(
-      'path' => 'admin/settings/teamspeak/flush',
-      'title' => t('flush cache'),
+  $items['admin/settings/teamspeak/flush'] = array(
+    'title' => 'flush cache',
       'type' => MENU_CALLBACK,
-      'callback' => 'teamspeak_flush',
+    'page callback' => 'teamspeak_flush',
+    'access callback' => 'user_access',
+    'access arguments' => array('administer teamspeak'),
     );
-  }
 
   return $items;
 }
@@ -97,6 +100,7 @@
   }
 
   $output = theme('table', $header, $rows);
+  
   return $output;
 }
 
@@ -139,8 +143,8 @@
  * form_id = teamspeak_delete
  * confirm delete, and delete block.
  */
-function teamspeak_delete_block_submit($form_id,$form_values) {
- if ($form_values['confirm']) {
+function teamspeak_delete_block_submit($form, &$form_state) {
+ if ($form_state['values']['confirm']) {
     $blocks = variable_get('teamspeak_blocks',array());
 
     # delete block data.
@@ -152,7 +156,7 @@
     	'teamspeak', arg(4));
     drupal_set_message(t('block deleted.'));
   }
-  drupal_goto('admin/settings/teamspeak');
+  $form_state['redirect'] = 'admin/settings/teamspeak';
 }
 
 /**
@@ -299,17 +303,17 @@
  * implementation of form validate()
  * form_id = teamspeak_edit
  */
-function teamspeak_edit_validate($form_id, $form_values) {
+function teamspeak_edit_validate($form, &$form_state) {
   $ids = array('port','query','timeout',
     'channel_max','player_max','cache'
   );
   foreach ($ids as $id) {
-    if (!is_numeric($form_values[$id])) {
+    if (!is_numeric($form_state['values'][$id])) {
       form_set_error($id,t('Field must be a numeric.'));
     }
   }
   // cache minimum value
-  if ($form_values['cache'] < 60) {
+  if ($form_state['values']['cache'] < 60) {
     form_set_error('cache',t('Cache Timeout cannot be less than 60 seconds.'));
   }
 
@@ -320,22 +324,22 @@
  * form_id = teamspeak_edit
  * save changes/create block.
  */
-function teamspeak_edit_submit($form_id, $form_values) {
+function teamspeak_edit_submit($form, &$form_state) {
 
   $blocks = variable_get('teamspeak_blocks',array());
 
-  if (isset($form_values['bid'])) {
+  if (isset($form_state['values']['bid'])) {
     // save block.
-    $blocks[$form_values['bid']] = $form_values;
-    cache_clear_all($form_values['key'], 'cache_page');
+    $blocks[$form_state['values']['bid']] = $form_state['values'];
+    cache_clear_all($form_state['values']['key'], 'cache_page');
     drupal_set_message(t('block saved.'));
   } else {
     // add a block.
-    $blocks[] = $form_values;
+    $blocks[] = $form_state['values'];
     drupal_set_message(t('block created.'));
   }
   variable_set('teamspeak_blocks',$blocks);
-  drupal_goto('admin/settings/teamspeak');
+  $form_state['redirect'] = 'admin/settings/teamspeak';
 }
 
 /**
@@ -380,7 +384,7 @@
       // cache it.
       $key = $ts_block['key'];
       $expires = time() + $ts_block['cache'];
-      cache_set($key,'cache',$html,$expires,NULL);
+      cache_set($key, 'cache' , $html , $expires, NULL);
     } else {
       // extra check for systems w/o caching turned on.
       $html = $cache->data;
@@ -408,7 +412,6 @@
 }
 
 function _teamspeak_format($block, $data) {
-
   // sort channels by id.
   foreach ((array) $data['raw']['cl'] as $arr) {
     $arr['name'] = trim($arr['name'],' "');
@@ -459,7 +462,6 @@
     $data['parents']['-1'] = (array) $ids;
   }
 
-
   // Format the output.
   $path = drupal_get_path('module','teamspeak');
   $chan_txt = ('<li class="ts_channel"><img class="ts_icon" src="'
@@ -593,25 +595,23 @@
   $arr = array();
   stream_set_timeout($sock, 3);
 
-  $raw = '';
+  $lines = array();
   while ($line = fgets($sock,8196)) {
-    $raw .= $line;
     if ($line == "OK\r\n") {
       break;
     }
-  }
 
-  //Removes: \nOK\r\n
-  $raw = substr($raw,0,strlen($raw) - 5);
+    $line = explode("\t", rtrim($line));
+    array_map('trim', $line);
 
-  $arr = preg_split('/\n/',$raw);
-  $arr = array_map('rtrim',$arr);
+    $lines[] = $line;
+  }
 
-  $headers = preg_split('/\t/',array_shift($arr));
+  $headers = array_shift($lines);
 
-  foreach ($arr as $tmp) {
-    $tmp = preg_split('/\t/',$tmp);
-    $out[] = _teamspeak_array_combine($headers,$tmp);
+  $out = array();
+  foreach ($lines as $line) {
+    $out[] = _teamspeak_array_combine($headers,$line);
   }
   return $out;
 }
