<?php

require_once 'Horde/Notification/Listener/status.php';

/**
 * The Notification_Listener_status_imp:: class extends the
 * Notification_Listener_status:: class to display the messages for
 * IMP's special message types 'imp.forward' and 'imp.reply'.
 *
 * $Horde: imp/lib/Notification/Listener/status.php,v 1.7.10.2 2005/07/03 03:42:46 selsky Exp $
 *
 * @author  Chuck Hagenbuch <chuck@horde.org>
 * @since   IMP 4.0
 * @package Horde_Notification
 */
class Notification_Listener_status_imp extends Notification_Listener_status {

    /**
     * Constructor
     */
    function Notification_Listener_status_imp()
    {
        parent::Notification_Listener_status();
        $this->_handles['imp.reply'] = true;
        $this->_handles['imp.forward'] = true;
        $this->_handles['imp.redirect'] = true;
    }

    /**
     * Outputs one message if it's an IMP message or calls the parent
     * method otherwise.
     *
     * @param array $message  One message hash from the stack.
     */
    function getMessage($message)
    {
        $event = $this->getEvent($message);
        switch ($message['type']) {
        case 'imp.reply':
            return '<p class="notice">' . Horde::img('reply.png') . '&nbsp;&nbsp;' . $event->getMessage() . '</p>';

        case 'imp.forward':
        case 'imp.redirect':
            return '<p class="notice">' . Horde::img('forward.png') . '&nbsp;&nbsp;' . $event->getMessage() . '</p>';
        }

        return parent::getMessage($message);
    }

}
