// ready $log->info("[{$section}] Ready to process messages"); break; case 'end_stream': $log->debug("[{$section}] User closed our XMPP session"); break; } } unset($payloads); /* Poll for new incoming messages. Not all gateways need this function, but it allows the support of gateways which need regular polling for new messages. */ if ($newmessage_array = $gateway->message_poll()) { foreach ($newmessage_array as $newmessage) { // conduct some sanity checking here incase the gateway // was badly written if ($newmessage["body"] && $newmessage["phone"]) { if (!msg_send($msg_queue, $msg_mylistener, $newmessage)) { $log->warning("[{$section}] Unable to add new message from poll into queue"); } } else { $log->warning("[{$section}] An invalid message was provided from the gateway and could not be added to the message queue"); } } } /* Check the message queues for actions for this fork to complete.