* @revision 05 * @license http://creativecommons.org/licenses/by-sa/3.0/de/ Creative Commons Attribution-Share Alike 3.0 Germany * @homepage http://oss.tiggerswelt.net/xmpp * @copyright Copyright © 2009 tiggersWelt.net */ // Load the XMPP-Class require("tiggerXMPP/client.php"); // Load some XMPP-Extensions require("extensions/xep0030.php"); require("extensions/xep0092.php"); // Class-Implementation class Client extends tiggerXMPP_Client { // {{{ receiveMessage /** * Handle incoming message * * @param string $From The XMPP-User who sent this message * @param string $Subject Subject of the message * @param string $Body Contents of this message * @param enum $Type (optional) Type of this message usually "chat" or "message" * @param string $ID (optional) Identifier assigned by client * @param string $Thread (optional) Thread-ID assigned by client * @param string $To (optional) Receiver of this message (most useful when implementing components) * * @access protected * @return void */ protected function receiveMessage ($From, $Subject, $Body, $Type = self::MESSAGE_NORMAL, $ID = null, $To = null, $Thread = null) { // Send an auto-reply here $this->sendMessage ( $From, "Hallo " . $XMPP->getJID (true, true, false, $From), $Type ); } // }}} } // Create an XMPP-Client for our domain $XMPP = new Client ("tiggerswelt.net", "jabber.tiggerswelt.net"); // Set Debug-Level a bit higher $XMPP->setDebug (tiggerXMPP_Stream::DEBUG_NOTICE); // Load extemsopms $XEP0030 = new XEP_0030 ($XMPP); $XEP0092 = new XEP_0092 ($XMPP); // Perform authentication if (!$XMPP->authenticate ("UserID", "Password", "xmpp")) die ("Authentication failed\n"); // Go online $XMPP->setPresence (); // Enter a loop $XMPP->read (); // Alternative loop-Implementation: while (true) { if ($Tag = $XMPP->readBlock ()) { # Do something here if not handled by Callbacks yet # ... actually we do not care ;) } # Do something else here // Save some CPU-Cycles usleep(125); } ?>