This commit is contained in:
Nick Bebout 2011-03-12 02:43:46 +00:00
parent f70eeba700
commit bf303b97aa
5 changed files with 48 additions and 65 deletions

View file

@ -1,15 +1,20 @@
RCS file: RCS/imapsync,v
Working file: imapsync
head: 1.27
head: 1.28
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 27; selected revisions: 27
total revisions: 28; selected revisions: 28
description:
----------------------------
revision 1.28
date: 2003/08/24 01:55:25; author: gilles; state: Exp; lines: +8 -30
Set the flags using append_strings() instead of store()
Flags are well set since the first run now.
----------------------------
revision 1.27
date: 2003/08/23 14:40:57; author: gilles; state: Exp; lines: +4 -10
Removed unused code

4
README
View file

@ -1,7 +1,7 @@
NAME
imapsync - synchronize mailboxes between two imap servers.
$Revision: 1.27 $
$Revision: 1.28 $
INSTALL
Get imapsync at http://www.linux-france.org/prj/imapsync/dist/
@ -124,5 +124,5 @@ SIMILAR SOFTWARES
Feedback (good or bad) will be always welcome.
$Id: imapsync,v 1.27 2003/08/23 14:40:57 gilles Exp $
$Id: imapsync,v 1.28 2003/08/24 01:55:25 gilles Exp $

View file

@ -1 +1 @@
1.27
1.28

View file

@ -4,7 +4,7 @@
imapsync - synchronize mailboxes between two imap servers.
$Revision: 1.27 $
$Revision: 1.28 $
=head1 INSTALL
@ -144,7 +144,7 @@ Rate imapsync : http://freshmeat.net/projects/imapsync/
Feedback (good or bad) will be always welcome.
$Id: imapsync,v 1.27 2003/08/23 14:40:57 gilles Exp $
$Id: imapsync,v 1.28 2003/08/24 01:55:25 gilles Exp $
=cut
@ -167,12 +167,12 @@ my(
use vars qw ($opt_G); # missing code for this will be option.
$rcs = ' $Id: imapsync,v 1.27 2003/08/23 14:40:57 gilles Exp $ ';
$rcs = ' $Id: imapsync,v 1.28 2003/08/24 01:55:25 gilles Exp $ ';
$rcs =~ m/,v (\d+\.\d+)/;
$VERSION = ($1) ? $1 : "UNKNOWN";
$error=0;
my $banner = '$RCSfile: imapsync,v $ ' . '$Revision: 1.27 $ ' . '$Date: 2003/08/23 14:40:57 $ ' . "\n";
my $banner = '$RCSfile: imapsync,v $ ' . '$Revision: 1.28 $ ' . '$Date: 2003/08/24 01:55:25 $ ' . "\n";
get_options();
@ -359,14 +359,15 @@ FOLDER: foreach my $f_fold (@f_folders) {
my $f_msg = $f_hash{$m_id}{'m'};
$debug and print "key $m_id #$f_msg\n";
unless (exists($t_hash{$m_id})) {
print "Message NO msg #$f_msg [$m_id] in $t_fold\n";
print "NO msg #$f_msg [$m_id] in $t_fold\n";
# copy
print "Copying msg #$f_msg:$f_size to folder $t_fold\n";
unless ($dry) {
my $string = $from->message_string($f_msg);
#$opt_y and print $string;
my $flags_f = join(" ", @{$from->flags($f_msg)});
my $new_id;
unless($new_id = $to->append($t_fold,$string)){
print "flags from : [$flags_f]\n";
unless($new_id = $to->append_string($t_fold,$string, $flags_f)){
warn "Couldn't append msg #$f_msg to folder $t_fold",
$to->LastError, "\n";
$error++;
@ -375,30 +376,7 @@ FOLDER: foreach my $f_fold (@f_folders) {
# good
# $new_id is an id if the IMAP server has the
# UIDPLUS capability else just a ref
print "Copied msg id [$f_msg] to folder $t_fold msg id [$new_id]\n";
unless ($tohasuidplus) {
next MESS;
}
print "Setting flags (UIDPLUS welcome)\n";
my @flags_f = @{$from->flags($f_msg)};
$debugimap and print "Store flags [@flags_f]";
$to->store($new_id,
"+FLAGS (" . join(" ", @flags_f) . ")"
);
my @flags_t;
my $flags_t = $to->flags($new_id);
# a bug ?
if ($flags_t) {
@flags_t = @$flags_t;
print
"flags from : @flags_f\n",
"flags to : @flags_t\n";
}else{
print "To flags could not be retrieved\n"
}
}
}
next MESS;

View file

@ -1,8 +1,14 @@
#!/bin/sh
# $Id: tests.sh,v 1.4 2003/08/21 15:40:32 gilles Exp $
# $Id: tests.sh,v 1.6 2003/08/24 01:56:49 gilles Exp $
# $Log: tests.sh,v $
# Revision 1.6 2003/08/24 01:56:49 gilles
# Indented long lines
#
# Revision 1.5 2003/08/24 01:05:35 gilles
# Removed some variables
#
# Revision 1.4 2003/08/21 15:40:32 gilles
# Added a email in loulplume test
#
@ -51,40 +57,26 @@ run_tests() {
#### Variable definitions
prog=imapsync
host1=localhost
host2=localhost
passfile1=/var/tmp/secret1
passfile2=/var/tmp/secret2
user1=toto@est.belle
user2=titi@est.belle
dirtest=/tmp/${prog}/test
test_count=0
##### The tests functions
perl_syntax() {
perl -c ./${prog}
perl -c ./imapsync
}
no_args() {
./${prog}
}
cleaning_test_directory() {
test -d $dirtest && find $dirtest -type d| xargs chmod 700
rm -rf $dirtest
mkdir -p $dirtest
./imapsync
}
first_sync() {
./imapsync \
--host1 $host1 --user1 $user1 --passfile1 $passfile1 \
--host2 $host2 --user2 $user2 --passfile2 $passfile2
--host1 localhost --user1 toto@est.belle \
--passfile1 /var/tmp/secret1 \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret2
}
loulplume() {
@ -95,10 +87,12 @@ loulplume() {
cmd="echo $mess""| mail -s ""$mess"" tata"
echo $cmd
ssh gilles@loul $cmd
sleep 10
#sleep 10
./imapsync \
--host1 loul --user1 tata --passfile1 /var/tmp/secret.tata \
--host2 plume --user2 tata@est.belle --passfile2 /var/tmp/secret.tata
--host1 loul --user1 tata \
--passfile1 /var/tmp/secret.tata \
--host2 plume --user2 tata@est.belle \
--passfile2 /var/tmp/secret.tata
else
:
fi
@ -108,8 +102,10 @@ plumeloul() {
if test X`hostname` = X"plume"; then
echo3 Here is plume
./imapsync \
--host1 plume --user1 tata@est.belle --passfile1 /var/tmp/secret.tata \
--host2 loul --user2 tata --passfile2 /var/tmp/secret.tata
--host1 plume --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 loul --user2 tata \
--passfile2 /var/tmp/secret.tata
else
:
fi
@ -119,9 +115,11 @@ lp_folder() {
if test X`hostname` = X"plume"; then
echo3 Here is plume
./imapsync \
--host2 plume --user2 tata@est.belle --passfile2 /var/tmp/secret.tata \
--host2 plume --user2 tata@est.belle \
--passfile2 /var/tmp/secret.tata \
--folder INBOX.yop --folder INBOX.Trash \
--host1 loul --user1 tata --passfile1 /var/tmp/secret.tata
--host1 loul --user1 tata \
--passfile1 /var/tmp/secret.tata
else
:
fi
@ -131,9 +129,11 @@ pl_folder() {
if test X`hostname` = X"plume"; then
echo3 Here is plume
./imapsync \
--host1 plume --user1 tata@est.belle --passfile1 /var/tmp/secret.tata \
--host1 plume --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--folder INBOX.yop \
--host2 loul --user2 tata --passfile2 /var/tmp/secret.tata
--host2 loul --user2 tata \
--passfile2 /var/tmp/secret.tata
else
:
fi