# adapt this file to your needs and move it to
# $HOME/.mailsync
#
# This is my first try at a commented configuration
# file. If you have some other pertinent examples
# f.ex. for special configurations or for a mailserver
# that needs some tweaks then please mail them to me.
#
# Tomas Pospisek <tpo_deb@sourcepole.ch>
#
# see also:
# [1] /usr/share/doc/mailsync/README
# [2] /usr/share/doc/libc-client-ssl2001/naming.txt.gz
# [3] rfc2060

######################################################
#               Store declarations
######################################################

#
# Get all mail from the "example.org" IMAPS (IMAP over SSL)
# server for the user "tpo" (IMAP is the default transport).
#
# WARNING: I STONGLY advice against not validating the SSL
#          certificate. Depending on your setup, a
#          man-in-the-middle attack can be very easy to
#          produce and YOU WILL NOT NOTICE.
#
#          Better get the SSL Certificate from the IMAP
#          server you are connecting to and install it
#          locally.
#
#          Here are some pointers on how to do it:
#          http://www.madboa.com/geek/pine-ssl/
#          http://tirian.magd.ox.ac.uk/~nick/openssl-certs/email.shtml
# 
# Get all the mailboxes that start with "INBOX." but do
# not recurse into subfolders. Before comparing mailboxes
# strip off "INBOX." form their name. When authentificating
# use "secret" as password.
#
# for the exact semantics of the server line see [2]
#
# (Can anybody lighten me up on what "ref" is?)
#
store cyrus-store {
	server	{example.org/user=tpo/ssl}
	ref	{example.org}
	pat	INBOX.%
	prefix  INBOX.
	passwd secret
}

#
# Same as above, but do not validate the SSL certificate.
#
# WARNING: I STONGLY advice against not validating the SSL
#          certificate. Depending on your setup, a
#          man-in-the-middle attack can be very easy to
#          produce and YOU WILL NOT NOTICE.
#
#          Better get the SSL Certificate from the IMAP
#          server you are connecting to and install it
#          locally.
#
#          Here are some pointers on how to do it:
#          http://www.madboa.com/geek/pine-ssl/
#          http://tirian.magd.ox.ac.uk/~nick/openssl-certs/email.shtml
# 
store cyrus-store-enable-man-in-the-middle {
	server	{example.org/user=tpo/ssl/novalidate-cert}
	ref	{example.org}
	pat	INBOX.%
	prefix  INBOX.
	passwd secret
}

#
# same as before but recurse into subfolders and do
# validate the SSL certificate
#
store other-cyrus-store {
	server	{example.org/user=tpo/ssl}
	ref	{example.org}
	pat	INBOX.*
	prefix  INBOX.
}

#
# *only* the inbox on a cyrus IMAP server
#
# no prefix! INBOX will be understood as such
# by mailsync!
#
store cyrus-inbox {
	server	{example.org/user=tpo}
	ref	{example.org}
	pat	INBOX
}

#
# courier INBOX over IMAP only
#
store courier-inbox {
	server	{example.org/user=tpo/imap/norsh}
	ref	{example.org}
	pat	INBOX
}

#
# all IMAP folders on courier INBOX over IMAP only
#
# (thanks to Holger Krull)
#
store courier-inbox-2 {
	server	{example.org/user=tpo/imap/norsh}
	ref	{example.org}
	pat	*
}

#
# "My Draft Folder" on a courier IMAP server
#
# this will ask you for the username and
# password since it's not given here
#
store courier-inbox {
	server	{example.org}
	ref	{example.org}
	pat	INBOX.My\ Draft\ Folder
}
#
# typical netscape or uw store
#
# only the contents of the folder sync will be
# transferred
#
store netscape-or-uw-store {
	server  {imap.cs.unc.edu/user=culver}
	ref     {imap.cs.unc.edu}
	pat     copy/%
	prefix  copy/
}

#
# accessing an MH inbox over ssh
#
# c-client will try to exec the following to
# get to the mails:
#
#       ssh example.org exec /etc/rimapd
#
# That means that you need to point /etc/imapd
# to s.th. sensible on the remote machine - i.e.:
#
# ln -s /usr/sbin/imapd /etc/rimapd
#
# See the c-client FAQ for more information
#
store mh-over-ssh-inbox {
        server {example.org/user=me/secure}
        ref {example.org}
        pat #mh/inbox
}

#
# local mail on a unix box contained
# in $HOME/Mail/localcopy
#
store local-directory-Mail {
	pat     Mail/localcopy/%
	prefix  Mail/
}

#
# local inbox in mh format
#
# Michale Krelin wrote:
# I use `mark +inbox all -sequence beforesync' before mailsyncing and
# `mark +inbox notbeforesync -add -sequence unseen` after.
#
store hacker {
        pat \#mh/inbox
        prefix \#mh/inbox
}

#
# local mail on a unix box contained
# in $HOME/mail/
#          ^^^^
#
store local-directory-mail {
	pat	mail/%
	prefix  mail/
}

#
# local mail in the INBOX
# that can be /var/mail/USERNAME or in other
# standard inbox places
#
store local-inbox {
	pat	INBOX
}

#
# one specific folder in the $HOME/mail
# directory
#
store local-oliver {
	pat	mail/oliver
	prefix  mail/
}

######################################################
#               Channel declarations
######################################################

#
# Let's synchronize our local inbox with the cyrus inbox. The
# synchronization info is kept on the remote cyrus server and
# "secret" is used for authentication. When synchronizing
# mailsync will gladly skip all messages bigger than 80k
#
channel inbox-local-cyrus  local-inbox cyrus-inbox {
	msinfo	{example.org/user=tpo}INBOX.mailsync
	passwd  secret
	sizelimit 81920
}

#
# synchronize the mail contained on a netscape or uw
# imap server in the folder copy with our local mailfolder
# "$HOME/Mail/localcopy". Keep the synchronization info locally
# in "Mail/synchronization-info"
# 
#
channel dir-local mail local {
	msinfo	Mail/synchronization-info
}
