switch ($event[0]) {
     case 'message':
         print "---------------------------------------------------------------------------------\n";
         print "Message from: {$pl['from']}\n";
         if ($pl['subject']) {
             print "Subject: {$pl['subject']}\n";
         }
         print $pl['body'] . "\n";
         print "---------------------------------------------------------------------------------\n";
         $conn->message($pl['from'], $body = "Thanks for sending me \"{$pl['body']}\".", $type = $pl['type']);
         $cmd = explode(' ', $pl['body']);
         if ($cmd[0] == 'quit') {
             $conn->disconnect();
         }
         if ($cmd[0] == 'break') {
             $conn->send("</end>");
         }
         if ($cmd[0] == 'vcard') {
             if (!$cmd[1]) {
                 $cmd[1] = $conn->user . '@' . $conn->server;
             }
             // take a note which user requested which vcard
             $vcard_request[$pl['from']] = $cmd[1];
             // request the vcard
             $conn->getVCard($cmd[1]);
         }
         break;
     case 'presence':
         print "Presence: {$pl['from']} [{$pl['show']}] {$pl['status']}\n";
         break;
     case 'session_start':
     echo str_repeat('-', 80);
     echo "Message from: {$from}";
     if (isset($subject)) {
         echo "Subject: {$subject}";
     }
     echo $body;
     echo str_repeat('-', 80);
     $cmd = explode(' ', $body);
     $body = "Mi no entender! '{$body}'";
     $conn->message($from, $body, $type);
     if (isset($cmd[0])) {
         if ($cmd[0] == 'quit') {
             $conn->disconnect();
         }
         if ($cmd[0] == 'break') {
             $conn->send('</end>');
         }
         if ($cmd[0] == 'vcard') {
             if (!isset($cmd[1])) {
                 $cmd[1] = $conn->user;
             }
             // Take a note which user requested which vcard
             $vcard_request[$from] = $cmd[1];
             // Request the vcard
             $conn->getVCard($cmd[1]);
         }
     }
     break;
 case 'presence':
     echo "Presence: {$from} [{$show}] {$status}\n";
     break;