thsmi / sieve

Sieve Script Editor
GNU Affero General Public License v3.0
757 stars 58 forks source link

Sieve filter from file #43

Open XtremeNova opened 9 years ago

XtremeNova commented 9 years ago

I've been using this addon for years, with great pleasure!

But now we moved on to a new server (Synology), which still uses Sieve as a filter, just not accessible via the normal ports. I found the sieve script as a file on my home drive. Is it possible to use a file for this addon, instead of the daemon access?

yeupou commented 2 years ago

Same use case, I have access to sieve filter as a file (that is replicated on several servers), that would be interesting to be able to edit it.

I thought it would be possible with the sieve-0.6.1-linux-x64.AppImage but I cannot create a local conf or edit the file.

Regards,

thsmi commented 2 years ago

Well the answer is somehow yes and no. Depends upon your use case.

The applications is made of four parts.

The Plain Text sieve Editor, heavily depends on the ManageSieve Protocol. Because all syntax checks are performed by the server. Loading a local file would mean no syntax check and thus the application would be not different than using a plaintext editor like nano, vim, ...

The Graphical Sieve editor is a pure HTML5 application and has no dependencies to the ManageSieve Protocol and implements his own parser. It can run directly off a static webserver You can find a demo running on github pages here:

https://thsmi.github.io/sieve-demo/libSieve/SieveGui.html?debug

But there are two limitations:

It may sound as it would be possible to use the parser from the GUI in the plaintext editor. But the parser is heavy weight and slow because it need to be bidirectional. It basically reads the script, converts it into objects which can be easily manipulated via the GUI and upon saving it serializes the objects back into a sieve script. For a graphical editor this is acceptable, the script is typically loaded only once and then you work with the in memory objects. But when doing a simple syntax check in a plain text editor the situation is vice versa. You normally want to have a lightweight and fast unidirectional implementation. Because each time you change characters in the script you need to re-parse the script...

This is why the answer is yes and no. If you exclusively use the graphical sieve editor, then the answer is yes, just run it in your browser. In case you are also using the plain text editor then the answer is no, and it is unlikely to land anytime in the near future because it would be a major rewrite of the parser.

yeupou commented 2 years ago

Interesting, I'll check the option of using the graphical sieve editor.