* @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"); // Callback-Implementation function gotMessage ($ID, $Message, &$Continue, &$XMPP) { $XMPP->sendMessage ($Message->From, "Hallo " . $XMPP->getJID(true, true, false, $Message->From), $Message->Type); } // Create an XMPP-Client for our domain $XMPP = new tiggerXMPP_Client ("tiggerswelt.net", "jabber.tiggerswelt.net"); // Set Debug-Level a bit higher $XMPP->setDebug (tiggerXMPP_Stream::DEBUG_NOTICE); // Register our callbacks $XMPP->registerCallback (tiggerXMPP_Stream::CALLBACK_MESSAGE_INCOMMING, "gotMessage"); // 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); } ?>