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

User Defined Flags

Open fancarpedia opened this issue 4 years ago • 4 comments

Most of servers support user defined flags which are reported in response: OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft NonJunk Junk \*)

Message method setFlag support's only slashed flags, because before any Flag prepend "\". $flag = "\\".trim(is_array($flag) ? implode(" \\", $flag) : $flag); As you see in this code, current version in setFlag('Seen') store flag \Seen therefore setFlag("Junk") ends with error:

There is also possibility to get user defined flags "NonJunk" or "Junk" set on message on server, because response of getFlags() is empty server, event when message response << 3 FETCH (FLAGS (\Flagged NonJunk))

Describe the solution you'd like Allow to work with full set of Flags, common with "\" and also user defined. Maybe to add support to getRawFlags, setRawFlag to not break backward compatibility where getFlags, setFlag, etc. which replace "\" from flag.

fancarpedia avatar Mar 29 '21 16:03 fancarpedia

Just a side-note as quotes from 2.3.2. Flags Message Attribute chapter of RFC3501 IMAP 4rev1:

A system flag is a flag name that is pre-defined in this specification. All system flags begin with "\".

A keyword is defined by the server implementation. Keywords do not begin with "\". Servers MAY permit the client to define new keywords in the mailbox

Depending on the RFC, it is absolutely normal use case, if non-backslash-prefixed flags (keywords) exist on server.

zssarkany avatar Mar 30 '21 15:03 zssarkany

Yeah, that's correct, but library working only with system flash with "\" as first charater and used in internally without it. And this is case to solve.

fancarpedia avatar Mar 31 '21 16:03 fancarpedia

Hi @stanolacko , many thanks for your report and suggestion. If you would like to implement and push a variable flag prefix, feel welcome to do so :)

Best regards,

Webklex avatar Jun 18 '21 09:06 Webklex

Ok. Thanks to suggestion :D

fancarpedia avatar Jun 18 '21 14:06 fancarpedia