Discussion:
[imapfilter-devel] Problem with has_flag() on Exchange 2010 IMAP server
Bernd Kuemmerlen
2011-01-12 12:49:06 UTC
Permalink
Hello all,

I have some issues with flags on an Exchange 2010 IMAP server.

I am trying to get all messages with a specific flag, and according to
the documentation this should work like this:

results = account2.Test:has_flag('\\Flagged')

This results in the following debug output
----------------------------------------------------------
100C SELECT "Test"

getting response (4):

* 3 EXISTS
* 0 RECENT
* FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
* OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft
$MDNSent)] Perman
ent flags
* OK [UIDVALIDITY 1267] UIDVALIDITY value
* OK [UIDNEXT 23] The next unique identifier value
100C OK [READ-WRITE] SELECT completed.

sending command (4):

100D UID SEARCH ALL KEYWORD "\Flagged"

getting response (4):

100D BAD Command Argument Error. 11
----------------------------------------------------------

Of the three messages in the mailbox, one has \Flagged set, which I can
confirm with

results = account2.Test:has_flag('\\Flagged')
for _, mesg in ipairs(results) do
mbox, uid = unpack(mesg)
flags = mbox[uid]:fetch_flags()
for k,v in pairs(flags) do print(k,v) end
end

Does anyone have an idea why has_flag() fails?

Getting all messages and filtering afterwards for the flag is what I'd
like to prevent...

Any ideas?

Thanks in advance,
Bernd
Lefteris Chatzimparmpas
2011-01-13 18:18:28 UTC
Permalink
Hello,

Can you try like this?

results = account2.Test:is_flagged()
Post by Bernd Kuemmerlen
Hello all,
I have some issues with flags on an Exchange 2010 IMAP server.
I am trying to get all messages with a specific flag, and according to
results = account2.Test:has_flag('\\Flagged')
This results in the following debug output
----------------------------------------------------------
100C SELECT "Test"
* 3 EXISTS
* 0 RECENT
* FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
* OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft
$MDNSent)] Perman
ent flags
* OK [UIDVALIDITY 1267] UIDVALIDITY value
* OK [UIDNEXT 23] The next unique identifier value
100C OK [READ-WRITE] SELECT completed.
100D UID SEARCH ALL KEYWORD "\Flagged"
100D BAD Command Argument Error. 11
----------------------------------------------------------
Of the three messages in the mailbox, one has \Flagged set, which I can
confirm with
results = account2.Test:has_flag('\\Flagged')
for _, mesg in ipairs(results) do
mbox, uid = unpack(mesg)
flags = mbox[uid]:fetch_flags()
for k,v in pairs(flags) do print(k,v) end
end
Does anyone have an idea why has_flag() fails?
Getting all messages and filtering afterwards for the flag is what I'd
like to prevent...
Any ideas?
Thanks in advance,
Bernd
_______________________________________________
Imapfilter-devel mailing list
Imapfilter-devel at lists.hellug.gr
http://lists.hellug.gr/mailman/listinfo/imapfilter-devel
Bernd Kuemmerlen
2011-01-14 09:15:58 UTC
Permalink
Post by Lefteris Chatzimparmpas
Hello,
Can you try like this?
results = account2.Test:is_flagged()
This seems to work:

C (4): 100C SELECT "Test"
S (4): 100C OK [READ-WRITE] SELECT completed.
C (4): 100D UID SEARCH ALL FLAGGED
S (4): 100D OK SEARCH completed.
table: 0x451510
C (4): 100E UID FETCH 20 FLAGS
S (4): 100E OK FETCH completed.
UID: 20 Text: table: 0x451760
1 \Seen
2 \Flagged
C (4): 100F LOGOUT
S (4): 100F OK LOGOUT completed.

Thanks a lot, I will use is_flagged() instead of has_flag() for now.

Cheers,
Bernd

Loading...