diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..bc5fc39 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +isync (0.8-1) unstable; urgency=low + + * Initial Release. + + -- Michael Elkins Wed, 16 Jan 2002 13:36:52 -0800 + diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..b41a368 --- /dev/null +++ b/debian/control @@ -0,0 +1,23 @@ +Source: isync +Section: unknown +Priority: optional +Maintainer: Michael Elkins +Build-Depends: debhelper (>> 3.0.0) +Standards-Version: 3.5.2 + +Package: isync +Architecture: any +Depends: ${shlibs:Depends} +Description: Synchronize a local maildir with a remote IMAP4 mailbox + A command line application which synchronizes a local maildir-style + mailbox with a remote IMAP4 mailbox, suitable for use in + IMAP-disconnected mode. Multiple copies of the remote IMAP4 mailbox + can be maintained, and all flags are synchronized. + . + Features: + * Fast mode for fetching new mail only + * Supports imaps: (port 993) TLS/SSL connections + * Supports STARTTLS (RFC2595) for confidentiality + * Supports NAMESPACE (RFC2342) + * Supports CRAM-MD5 (RFC2095) for authentication + diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..b7d6ec0 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,26 @@ +This package was debianized by Michael Elkins on +Wed, 16 Jan 2002 13:36:52 -0800. + +It was downloaded from http://www.sigpipe.org:8080/isync/ + +Upstream Author(s): Michael Elkins + +Copyright: + + * isync - IMAP4 to maildir mailbox synchronizer + * Copyright (C) 2000-2 Michael R. Elkins + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..e99fa50 --- /dev/null +++ b/debian/docs @@ -0,0 +1,4 @@ +NEWS +README +TODO +sample.isyncrc diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..7377d46 --- /dev/null +++ b/debian/rules @@ -0,0 +1,85 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# This is the debhelper compatability version to use. +export DH_COMPAT=3 + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + ./configure --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info + + touch configure-stamp + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #/usr/bin/docbook-to-man debian/isync.sgml > isync.1 + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + -$(MAKE) distclean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/isync. + $(MAKE) install prefix=$(CURDIR)/debian/isync + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot +# dh_installdebconf + dh_installdocs + dh_installexamples +# dh_installmenu +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installinit +# dh_installcron + dh_installman isync.1 +# dh_installinfo +# dh_undocumented + dh_installchangelogs ChangeLog + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_makeshlibs + dh_installdeb +# dh_perl + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/isync.1 b/isync.1 index f782d1f..945c819 100644 --- a/isync.1 +++ b/isync.1 @@ -323,6 +323,9 @@ It is currently impossible to unset the \\Flagged attribute of a message once it is set. It has to be manually unset everywhere since isync doesn't have enough information to know which was the last status of the message. +.P +The ndbm database created for each mailbox is not portable across different +architectures. It currently stores the UID in host byte order. .SH SEE ALSO mutt(1), maildir(5) .P diff --git a/maildir.c b/maildir.c index 2557612..01cebb4 100644 --- a/maildir.c +++ b/maildir.c @@ -281,7 +281,7 @@ maildir_open (const char *path, int flags) strfcpy (buf, p->file, sizeof (buf)); key.dptr = p->file; s = strchr (key.dptr, ':'); - key.dsize = s ? s - key.dptr : strlen (key.dptr); + key.dsize = s ? (size_t) (s - key.dptr) : strlen (key.dptr); key = dbm_fetch (m->db, key); if (key.dptr) { @@ -318,35 +318,35 @@ maildir_open (const char *path, int flags) int maildir_expunge (mailbox_t * mbox, int dead) { - message_t **cur = &mbox->msgs; - message_t *tmp; - char *s; - datum key; - char path[_POSIX_PATH_MAX]; + message_t **cur = &mbox->msgs; + message_t *tmp; + char *s; + datum key; + char path[_POSIX_PATH_MAX]; - while (*cur) + while (*cur) + { + if ((dead == 0 && (*cur)->flags & D_DELETED) || + (dead && (*cur)->dead)) { - if ((dead == 0 && (*cur)->flags & D_DELETED) || - (dead && (*cur)->dead)) - { - tmp = *cur; - snprintf (path, sizeof (path), "%s/%s/%s", - mbox->path, tmp->new ? "new" : "cur", tmp->file); - if (unlink (path)) - perror (path); - /* remove the message from the UID map */ - key.dptr = tmp->file; - s = strchr (key.dptr, ':'); - key.dsize = s ? s - key.dptr : strlen (key.dptr); - dbm_delete (mbox->db, key); - *cur = (*cur)->next; - free (tmp->file); - free (tmp); - } - else - cur = &(*cur)->next; + tmp = *cur; + snprintf (path, sizeof (path), "%s/%s/%s", + mbox->path, tmp->new ? "new" : "cur", tmp->file); + if (unlink (path)) + perror (path); + /* remove the message from the UID map */ + key.dptr = tmp->file; + s = strchr (key.dptr, ':'); + key.dsize = s ? (size_t) (s - key.dptr) : strlen (key.dptr); + dbm_delete (mbox->db, key); + *cur = (*cur)->next; + free (tmp->file); + free (tmp); } - return 0; + else + cur = &(*cur)->next; + } + return 0; } int @@ -371,12 +371,12 @@ maildir_update_maxuid (mailbox_t * mbox) len = write (fd, buf, strlen (buf)); if (len == (size_t) - 1) { - perror ("write"); - ret = -1; + perror ("write"); + ret = -1; } if (close (fd)) - ret = -1; + ret = -1; return ret; } diff --git a/sync.c b/sync.c index e421c9f..f0adde2 100644 --- a/sync.c +++ b/sync.c @@ -40,7 +40,8 @@ find_msg (message_t * list, unsigned int uid) return 0; } -static int set_uid (DBM *db, const char *f, unsigned int uid) +static int +set_uid (DBM * db, const char *f, unsigned int uid) { char *s; datum key, val; @@ -48,7 +49,7 @@ static int set_uid (DBM *db, const char *f, unsigned int uid) key.dptr = (void *) f; s = strchr (f, ':'); key.dsize = s ? (size_t) (s - key.dptr) : strlen (f); - val.dptr = (void*) &uid; + val.dptr = (void *) &uid; val.dsize = sizeof (uid); dbm_store (db, key, val, DBM_REPLACE); return 0; @@ -176,8 +177,9 @@ sync_mailbox (mailbox_t * mbox, imap_t * imap, int flags, if (imap_copy_message (imap, cur->uid, imap->box->copy_deleted_to)) { - fprintf (stderr, "ERROR: unable to copy deleted message to \"%s\"\n", - imap->box->copy_deleted_to); + fprintf (stderr, + "ERROR: unable to copy deleted message to \"%s\"\n", + imap->box->copy_deleted_to); return -1; } }