mailing list archives

meli community discussions

⚠️ if something does not work as intended when interracting with the mailing lists,
reach out Github mirror Gitea repo @epilys:matrix.org

E-mail headers
From: 李艾倫 <ayluen@i-freelancer.net>
To: imap-protocol@u.washington.edu
Date: Fri, 08 Jun 2018 12:34:51 -0000
Message-ID: 000001ce47e7$4c7bead0$e573c070$@i-freelancer.net permalink / raw / eml / mbox
Hi,

 

I'm currently working on implementing IMAP protocol on our mail server.
This is my first time implementing such a big project and I've so far coded
a majority of IMAP commands in the RFC, except the Search command.

I've been searching on the internet and studied postfix(RPN) algorithm for
weeks to see how to parse the search command correctly.

It seems Postfix would work until I encountered something like OR OR A B C D
==> (OR (OR A B) C) D

Could anyone point me a direction on how to implement the Search command
when there are multiple ORs?

Should I even consider using Postfix(RPN) algorithm to parse search command?

 

Thank you very much for any help or tips you could provide.

 

Helen


======================================
Powered by Rainbow Mail Server 6.0

?????????????????????????????????????????????????????????????????????????????????????
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. Please consider the environment before printing this email.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman13.u.washington.edu/pipermail/imap-protocol/attachments/20130503/c35878c7/attachment.html>
Reply
E-mail headers
From: tss@iki.fi
To: imap-protocol@localhost
Date: Fri, 08 Jun 2018 12:34:51 -0000
Message-ID: 5EC8241E-F964-43EE-85EA-0DCD76E021A4@iki.fi permalink / raw / eml / mbox
On 3.5.2013, at 13.16, ??? <ayluen@i-freelancer.net> wrote:

> I'm currently working on implementing IMAP protocol on our mail server.  This is my first time implementing such a big project and I've so far coded a majority of IMAP commands in the RFC, except the Search command.
> I've been searching on the internet and studied postfix(RPN) algorithm for weeks to see how to parse the search command correctly.
> It seems Postfix would work until I encountered something like OR OR A B C D ==> (OR (OR A B) C) D
> Could anyone point me a direction on how to implement the Search command when there are multiple ORs?
> Should I even consider using Postfix(RPN) algorithm to parse search command?

Did you notice that it's also possible to use parenthesis explicitly in the search query? I implemented it by parsing the search command to a tree structure and then iterating through the tree. There are quite a lot of optimizations you can then also do with the tree structure, like first trying to see if the search can even match the message sequence or UID, next checking for flags, then checking for slower ones. I'm not sure if there are any other reasonable ways to even implement it.

BTW. You should test your implementation's RFC compliancy with http://imapwiki.org/ImapTest
Reply
E-mail headers
From: ayluen@i-freelancer.net
To: imap-protocol@localhost
Date: Fri, 08 Jun 2018 12:34:51 -0000
Message-ID: 001901ce4a0d$3101b9b0$93052d10$@i-freelancer.net permalink / raw / eml / mbox
Yes, I've been testing my logic with different kinds of scenarios with/out
parenthesis and got stuck when there are many levels of sublists.  I have to
admit my background on data structure is not very solid.
That's why I was hoping to get some tips from the experts here. I will
proceed with your suggestion using the tree structure. Thank you for helping
me out~~

Regards,

Helen

-----Original Message-----
From: Timo Sirainen [mailto:tss@iki.fi] 
Sent: Friday, May 03, 2013 6:56 PM
To: ???
Cc: imap-protocol@u.washington.edu
Subject: Re: [Imap-protocol] Imap Search Command Parse Logic

On 3.5.2013, at 13.16, ??? <ayluen@i-freelancer.net> wrote:

> I'm currently working on implementing IMAP protocol on our mail server.
This is my first time implementing such a big project and I've so far coded
a majority of IMAP commands in the RFC, except the Search command.
> I've been searching on the internet and studied postfix(RPN) algorithm for
weeks to see how to parse the search command correctly.
> It seems Postfix would work until I encountered something like OR OR A 
> B C D ==> (OR (OR A B) C) D Could anyone point me a direction on how to
implement the Search command when there are multiple ORs?
> Should I even consider using Postfix(RPN) algorithm to parse search
command?

Did you notice that it's also possible to use parenthesis explicitly in the
search query? I implemented it by parsing the search command to a tree
structure and then iterating through the tree. There are quite a lot of
optimizations you can then also do with the tree structure, like first
trying to see if the search can even match the message sequence or UID, next
checking for flags, then checking for slower ones. I'm not sure if there are
any other reasonable ways to even implement it.

BTW. You should test your implementation's RFC compliancy with
http://imapwiki.org/ImapTest======================================
Powered by Rainbow Mail Server 6.0

?????????????????????????????????????????????????????????????????????????????????????
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. Please consider the environment before printing this email.
Reply