Skip to content

rakoo/imaptrope

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

imaptrope is cool.

This is a version of ximapd based on https://github.com/shugo/ximapd and adapted to work
with heliotrope, the fabulous mail store by William Morgan : 
https://github.com/wmorgan/heliotrope

It is an IMAP server, supposed to offer an interface to the
JSON-over-HTTP interface of Heliotrope.

INSTALL, SETUP AND THE BORING THINGS

Copy examples/imaptrope.conf to ~/.config/

USAGE

$ ruby -Ilib -I ../heliotrope/lib bin/imaptrope -s -a ~/Documents/tmpdir -d

If you want to test it without destructing everything, you should try
the tag "safe" and not further, because those implement destructive
(STORE, RENAME, DELETE, ...) IMAP functions.

WHAT WORKS FOR NOW

NOTE : When I say it works, I don't mean it's totally safe. Use at your
own risks.

[X] connection
[X] simple authentication
[ ] secure authentication (SSL)

[o] LIST Command
	; FLAGS for each mailbox are not yet spec'd
[X] STATUS Command
[X] EXAMINE Command
[X] SELECT Command

[ ] SEARCH Command
	[X] BODY
	[X] BCC
	[X] ANSWERED
	[X] RECENT
	[X] DRAFT
	[X] DELETED
	[X] UNREAD

[ ] FETCH
	[X] UID
	[X] FLAGS
	[X] INTERNALDATE
	[o] ENVELOPE
		; not sure about the format
	[X] BODY[HEADER]
	[X] BODY[HEADER.FIELDS(whatever whatever)]
	[X] RFC822.HEADER
	[o] BODYSTRUCTURE
		; not sure about the format
	[X] RFC822
	[X] BODY[]
	[X] BODY[TEXT]
	[X] RFC822.TEXT

[X] STORE
	; CAREFUL : This modifies your labels, so use with care. It works, but
	; who knows. Moreover, you MUST ALWAYS consider that <label> in
	; heliotrope translates as ~<label> in the IMAP interface

[o] RENAME
	; special treatment not taken into account if a mailbox has submailboxes

[o] DELETE
	; special treatment not taken into account if a mailbox has the
	; \Noselect flag or if it has submailboxes

[o] CREATE
	; a mailbox cannot be created, because they are just labels in
	; heliotrope. It will just add your mailbox name in a fakemailboxes
	; array, so that it thinks it really exists.

USING WITH OFFLINEIMAP

Caution : this will eat your mails ! Don't test it with important mails
for the moment !

Basically, when a client appends a mail or copies a mail between
mailboxes, it doesn't know what are its uids given by the server; the
client has to do itself some work to recaluclate them at each
connection. Thus, OfflineIMAP adds a 'X-OfflineIMAP' header to our mails
(yes, it modifies them) to recognize them. If we don't want this to
happen, we have to return the uid of the mails that OfflineIMAP (or any
IMAP client) when it acts on our mails; that is what UIDPLUS
provides. 
All this stuff to say, UIDPLUS is there to work with
OfflineIMAP (although it will work with any IMAP client).

If you want to try it, here is the .offlinimaprc I use : 


[general]
accounts = Heliotrope

[Account Heliotrope]
localrepository = imaptrope # the new name of ximapd :)
remoterepository = gmailremote

[Repository gmailremote]
type = IMAP
remotehost = imap.gmail.com
remoteuser = user
remotepass = pass
ssl = yes
realdelete = no
nametrans = lambda folder: 		re.sub('\[Gmail\]/Spam', '~spam',
    re.sub('\[Gmail\]/Drafts', '~draft', 
    re.sub('\[Gmail\]/Sent Mail', '~sent', 
    re.sub('\[Gmail\]/Starred', '\\Starred', 
    re.sub('\[Gmail\]/Trash', '~trash', 
    re.sub('\[Gmail\]/All Mail', 'All Mail',
		re.sub('(^[^(?:INBOX|\[|\])]*$)', lambda pat: '~' + pat.group(1).lower(), folder )))))))

[Repository imaptrope]
type = IMAP
remotehost = localhost
remoteport = 10142
# those two are specified in ~/.ximapd
remoteuser = myusername
remotepass = mypassword
ssl = no
nametrans = lambda folder: re.sub('(^\w*$)', r'~\1', folder.lower())


Some explanations : 

* nametrans : labels in ximapd (or imaptrope) MUST begin with a ~ 
* folderfilter : GMail special labels have an equivalent; special labels
  are translated to ~label

You can then use 

$ offlineimap -1

to sync your IMAP servers. Note that you MUST use the '-1' option, which
means "no multithreading" : imaptrope is not thread-safe, and will not
be. This also means that you can have only one client at a time
connected to imaptrope

REMEMBER : it is not functional yet ! Don't use it on your precious !

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages