<?PHP

  /**
   * twMUC
   * -----
   * A Multi-User-Chat (MUC) Implementation by tiggersWelt.net
   * Most of this work is based on tiggerXMPP.                                                       
   * 
   * @package twMUC
   * @author Bernd Holzmueller <bernd@tiggerswelt.net>
   * @license http://creativecommons.org/licenses/by-sa/3.0/de/ Creative Commons Attribution-Share Alike 3.0 Germany
   * @homepage http://oss.tiggerswelt.net/twMuc  
   * @copyright Copyright &copy; 2010 tiggersWelt.net       
   **/
  
  /**
   * MUC SERVER
   * ----------
   * This is actually a copy of examples/component/component.php from the tiggerXMPP-Distribution
   * and is used to setup and start a MUC-Component. There is no big configuration-file, just read
   * through this file and modify the values to fit your needs.
   * 
   * To start the component, just run this file.
   **/
  
  // Override include-path
  set_include_path ('../' . PATH_SEPARATOR . '../xmpp/' . PATH_SEPARATOR . get_include_path ());
  
  // Load our MUC-Handler
  require_once ('handler.php');
  
  // Load additional XEPs
  require_once ('tiggerXMPP/xep/0030.php');
  require_once ('tiggerXMPP/xep/0092.php');
  
  // Create a new Component
  $XMPP = new twMUC_Handler (
    'your.muc.domain',
    '127.0.0.1',
    5347
  );
  
  // Register XEPs
  $XEP0030 = new tiggerXMPP_XEP_0030 ($XMPP);
  $XEP0092 = new tiggerXMPP_XEP_0092 ($XMPP);
  
  // Authenticate with server
  $XMPP->authenticate ('your_password')
    or die ('Authentication with server failed. :-(' . "\n");
  
  // Setup XEP 0030
  $XEP0030->registerIdentity ('tiggerXMPP MUC Component', 'conference', 'text', 'muc.tiggersystems.info');
  $XEP0030->registerIdentityFunction (array ($XMPP, 'discoRoomInfo'));
  $XEP0030->registerItemFunction (array ($XMPP, 'discoRooms'));
  
  // Setup XEP 0092
  $XEP0092->setVersion (
    'tiggerXMPP MUC Component',
    '0.01 Alpha',
    'Some Linux, maybe'
  );
  
  error_reporting (E_ALL);
  
  // Enter a loop
  while (true) {
    $XMPP->readBlock (false);
    
    usleep (1000);
  }

?>