Warning, file /pim/trojita/tests/imap-folder-sync/1.sh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #!/bin/bash 0002 0003 echo "Warning: this will nuke your Dovecot's INBOX!" 0004 echo "Press Ctrl-C IMMEDIATELLY if you don't want to proceed." 0005 echo 0006 echo "Press Enter to continue AND LOOSE ALL DATA." 0007 read 0008 0009 send_mail() { 0010 echo -e "From: jkt@flaska.net\r\n"\ 0011 "To: jkt@flaska.net\r\n"\ 0012 "Subject: $1\r\n"\ 0013 "Date: dneska\r\n\r\nblesmrt 333 666\r\n"| /usr/libexec/dovecot/deliver -e 0014 0015 sleep 0.1s 0016 } 0017 0018 delete_sequence() { 0019 ( 0020 echo -e "1 SELECT INBOX\r\n2 STORE $1 +FLAGS (\\deleted)\r\n"\ 0021 "3 EXPUNGE\r\n4 LOGOUT\r\n"; sleep 1) | /usr/libexec/dovecot/imap >/dev/null 0022 echo 0023 } 0024 0025 send_mail A 0026 send_mail B 0027 send_mail C 0028 0029 echo "Mailbox contents: A B C"; read 0030 0031 send_mail D 0032 0033 echo "Mailbox contents: A B C D"; read 0034 0035 delete_sequence "2" 0036 0037 echo "Mailbox contents: A C D"; read 0038 0039 delete_sequence "3" 0040 0041 echo "Mailbox contents: A C"; read 0042 0043 delete_sequence "1" 0044 0045 echo "Mailbox contents: C"; read 0046 0047 delete_sequence "1:*" 0048 0049 echo "Mailbox is empty now"; read 0050 0051 send_mail A 0052 send_mail B 0053 send_mail C 0054 send_mail D 0055 0056 echo "Mailbox contents: A B C D"; read 0057 0058 delete_sequence "2:3" 0059 0060 echo "Mailbox contents: A D"; read 0061 0062 send_mail E 0063 send_mail F 0064 send_mail G 0065 0066 echo "Mailbox contents: A D E F G"; read 0067 0068 delete_sequence "2,4" 0069 0070 echo "Mailbox contents: A E G"; read 0071 0072 delete_sequence "1,3" 0073 0074 echo "Mailbox contents: E"; read 0075 0076 delete_sequence "1:*" 0077 0078 send_mail A 0079 send_mail B 0080 send_mail C 0081 send_mail D 0082 send_mail E 0083 send_mail F 0084 send_mail G 0085 0086 delete_sequence "1:3,5:6" 0087 0088 echo "Mailbox contents: D G"; read 0089 0090 delete_sequence "1:*" 0091 0092 echo "Mailbox is empty now and that's all :)"; read 0093 0094