Skip to content

Commit

Permalink
fix: STORE for iCloud and other strict IMAP servers
Browse files Browse the repository at this point in the history
Apple's iCloud IMAP server (and possibly others, although I haven't tested it) want brackets around any
FLAG command params as shown in the examples of [RFC3501](https://datatracker.ietf.org/doc/html/rfc3501#section-6.4.6])
If the brackets aren't added, the command fails with BAD Parse Error
To fix this, wrap the params of a STORE command in a Horde_Imap_Client_Data_Format_List
Otherwise, the \Delete FLAG, \Seen FLAG and possibly all other PERMFLAGs aren't added, even if the
STORE command doesn't return a BAD response.

Signed-off-by: Anna Larch <[email protected]>
  • Loading branch information
miaulalala authored and ralflang committed Mar 28, 2024
1 parent 20e7352 commit 4183358
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Horde/Imap/Client/Socket.php
Original file line number Diff line number Diff line change
Expand Up @@ -3632,14 +3632,14 @@ protected function _storeCmd($options)
if (!empty($options['replace'])) {
$cmds[] = array(
'FLAGS' . ($silent ? '.SILENT' : ''),
$options['replace']
new Horde_Imap_Client_Data_Format_List($options['replace'])
);
} else {
foreach (array('add' => '+', 'remove' => '-') as $k => $v) {
if (!empty($options[$k])) {
$cmds[] = array(
$v . 'FLAGS' . ($silent ? '.SILENT' : ''),
$options[$k]
new Horde_Imap_Client_Data_Format_List($options[$k])
);
}
}
Expand Down

0 comments on commit 4183358

Please sign in to comment.