Hello everyone, I am playing around with heliotrope, and I've managed to writo a ruby script to sync changes you made there in your IMAP mailbox. It is primarily intended to be used with GMail, but nothing prevents it from working with others. Basically, this is how it works : - when you make a change in heliotrope, it is written in an external file - the script reads the file line by line and applies back any changes At the moment, I've only logged messages and state changes. When you send a mail with GMail, it is automatically added in GMail "Sent" mail, so I thought heliotrope could automagically thread it, but I haven't tested yet. The changes in thu imap folder happen like this : - search for a thread with the "subject" we are interested in - label/unlabel each message in the thread - change state of each message as written in the log file Many problems : - first and foremost, the link between a thread in heliotrope and the same in GMail is done through a basic IMAP search on the entire "subject" string. I don't know about how the threading happens in heliotrope, but I hope both are the same - the ruby Net::IMAP library doesn't want to send non-ascii characters ( or I'm too dumb to see how to). So I decided to do it the hard way : remove any word (blocks of chars separated by spaces) that contains any non-ascii characters. Well, I,ve just removed one character for the moment, because I had an error when trying to match a UTF-8 string with a Unicode regexp. - "states" should be message-centered, as explained in the comments, yet I don't know how to link messages in heliotrope and messages in GMail. And I don't think searching through the whole body of the messages in GMail would be very fast. So, I changed the state of all the messages in the thread. After all, when I have an "Unseen" message in a thread, seeing the whole thread looks interesting; same for "Starred". - I've heard the ruby IMAP lib is buggy; what is it exactly ? All in all, the most important part of the process is just the writing of the logfile. (One of) My main problem with switching to heliotrope entirely is the fact that it doesn't sync with anything else. So now, if I have a log of everything I've done, I can at least do the same changes by hand. And the script is to be run apart from everything else, because I don't think it's part of heliotrope job to sync with other mailserver. In fact, this script is more of a "fiddle around to learn ruby" script, so please don't care about the code quality =] Cya, -- Matthieu RAKOTOJAONA
Attachment:
patch
Description: Binary data
_______________________________________________ Sup-devel mailing list Sup-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-devel