2017-08-12 15:40:47 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @author clivern <hello@clivern.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Clivern\Imap\Core\Message;
|
|
|
|
|
|
|
|
use Clivern\Imap\Core\Connection;
|
|
|
|
|
|
|
|
/**
|
2017-08-15 15:18:41 +02:00
|
|
|
* Action Class
|
2017-08-12 15:40:47 +02:00
|
|
|
*
|
|
|
|
* @package Clivern\Imap\Core\Message
|
|
|
|
*/
|
2017-08-15 15:18:41 +02:00
|
|
|
class Action
|
2017-08-12 15:40:47 +02:00
|
|
|
{
|
|
|
|
|
2017-08-13 13:36:19 +02:00
|
|
|
/**
|
|
|
|
* @var Connection
|
|
|
|
*/
|
|
|
|
protected $connection;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var integer
|
|
|
|
*/
|
|
|
|
protected $message_number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var integer
|
|
|
|
*/
|
|
|
|
protected $message_uid;
|
|
|
|
|
2017-08-13 13:44:57 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class Constructor
|
|
|
|
*
|
|
|
|
* @param Connection $connection
|
|
|
|
*/
|
2017-08-13 13:36:19 +02:00
|
|
|
public function __construct(Connection $connection)
|
|
|
|
{
|
|
|
|
$this->connection = $connection;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Config Message
|
|
|
|
*
|
|
|
|
* @param integer $message_number
|
|
|
|
* @param integer $message_uid
|
2017-08-15 15:18:41 +02:00
|
|
|
* @return Action
|
2017-08-13 13:36:19 +02:00
|
|
|
*/
|
|
|
|
public function config($message_number, $message_uid)
|
|
|
|
{
|
|
|
|
$this->message_number = $message_number;
|
|
|
|
$this->message_uid = $message_uid;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
2017-09-02 15:33:59 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete Message
|
|
|
|
*
|
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public function delete()
|
|
|
|
{
|
|
|
|
return (boolean) imap_delete($this->connection->getStream(), $this->message_uid, \FT_UID);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Undelete Message
|
|
|
|
*
|
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public function undelete()
|
|
|
|
{
|
|
|
|
return (boolean) imap_undelete($this->connection->getStream(), $this->message_uid, \FT_UID);
|
|
|
|
}
|
2017-08-12 15:40:47 +02:00
|
|
|
}
|