php-imap-client icon indicating copy to clipboard operation
php-imap-client copied to clipboard

Need a setFlag method

Open abdullahseba opened this issue 8 years ago • 6 comments

Hi Is the a method that sets flags? If not could it be added? Thanks.

abdullahseba avatar May 24 '17 09:05 abdullahseba

Hello! This is currently not added! I will begin working on it!

mattparksjr avatar May 24 '17 11:05 mattparksjr

http://php.net/manual/en/function.imap-setflag-full.php

abdullahseba avatar May 31 '17 19:05 abdullahseba

looks like it handles all flags.

abdullahseba avatar May 31 '17 19:05 abdullahseba

in ImapClient.php add:

     /**
     * Set flag message
     *
     * @param int $ids or string like 1,2,3,4,5 or string like 1:5
     * @return bool
     */
    public function setFlagMessage($ids, $flags)
    {
        // We need better docs for this
        return imap_setflag_full($this->imap, $ids, $flags, ST_UID);
    }

    /**
     * Unset flag message
     *
     * @param int $ids or string like 1,2,3,4,5 or string like 1:5
     * @return bool
     */
    public function unsetFlagMessage($ids, $flags)
    {
        // We need better docs for this
        return imap_clearflag_full($this->imap, $ids, $flags, ST_UID);
    }

and use:

$imap->setFlagMessage(message_uid, message_flag);

$imap->unsetFlagMessage(message_uid, message_flag);

default setUnseenMessage() not work since there is no additional option ST_UID. http://php.net/manual/ru/function.imap-clearflag-full.php

reimax avatar Nov 07 '17 08:11 reimax

Hello. I would be happy to add this code but in order to properly give you credit, I need you to submit a pull request. Would you mind that?

mattparksjr avatar Nov 07 '17 18:11 mattparksjr

Yes, I'll try. copy the code, this will be enough?

done

reimax avatar Nov 08 '17 05:11 reimax