luggage 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/lib/luggage/mailbox.rb +19 -0
- data/lib/luggage/mailbox_array.rb +4 -15
- data/lib/luggage/message.rb +7 -0
- data/lib/luggage/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d26e7a17d30fe62e65aebba3677c9947be2129f0
|
4
|
+
data.tar.gz: 02e19e80be8b1fceee116f1b6b683c9d98ff2ac7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41fd1f37fe4d66a1e206e9dca496fcdc6b64cac0676dd71ae1d54d27cfd76046584374fcfbc0013fa6fdcc1514094928a71e7adf05c4b6e0361634524d8ba7fb
|
7
|
+
data.tar.gz: 46ddd62da10c99c667c00d17e8040bc1a0fac974d6399cf9ab0dbe85050456962158c4ce30d358c615766d98a8f92fd8a57407f0d539c080d00efb3057b9cc27
|
data/CHANGES.md
CHANGED
data/lib/luggage/mailbox.rb
CHANGED
@@ -4,6 +4,25 @@ module Luggage
|
|
4
4
|
|
5
5
|
attr_reader :connection, :name
|
6
6
|
|
7
|
+
def self.convert_mailbox_name(mailbox_name)
|
8
|
+
case mailbox_name
|
9
|
+
when :g_all
|
10
|
+
"[Gmail]/All Mail"
|
11
|
+
when :g_sent
|
12
|
+
"[Gmail]/Sent"
|
13
|
+
when :g_trash
|
14
|
+
"[Gmail]/Trash"
|
15
|
+
when :inbox, :spam, :sent, :trash
|
16
|
+
mailbox_name.to_s.upcase
|
17
|
+
when Symbol
|
18
|
+
mailbox_name.to_s
|
19
|
+
when String
|
20
|
+
mailbox_name
|
21
|
+
else
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
7
26
|
# This provides an interface to a remote Imap mailbox
|
8
27
|
#
|
9
28
|
# `connection` should be an authenticated Net::IMAP
|
@@ -7,21 +7,10 @@ module Luggage
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def [](*args, &block)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
mailbox(args.first.to_s.upcase, &block)
|
15
|
-
when :g_all
|
16
|
-
mailbox("[Gmail]/All Mail", &block)
|
17
|
-
when :g_sent
|
18
|
-
mailbox("[Gmail]/Sent", &block)
|
19
|
-
when :g_trash
|
20
|
-
mailbox("[Gmail]/Trash", &block)
|
21
|
-
when Symbol
|
22
|
-
mailbox(args.first, &block)
|
23
|
-
when nil
|
24
|
-
mailboxes
|
10
|
+
mailbox_name = Luggage::Mailbox.convert_mailbox_name(args.first)
|
11
|
+
|
12
|
+
if mailbox_name
|
13
|
+
mailbox(mailbox_name, &block)
|
25
14
|
else
|
26
15
|
super
|
27
16
|
end
|
data/lib/luggage/message.rb
CHANGED
@@ -75,6 +75,13 @@ module Luggage
|
|
75
75
|
connection.append(mailbox.name, raw_message, flags.map {|f| f.to_sym.upcase}, date)
|
76
76
|
end
|
77
77
|
|
78
|
+
# Uses IMAP's COPY command to copy the message into the named mailbox
|
79
|
+
#
|
80
|
+
def copy_to!(mailbox_name)
|
81
|
+
mailbox.select!
|
82
|
+
connection.uid_copy([uid], Luggage::Mailbox.convert_mailbox_name(mailbox_name))
|
83
|
+
end
|
84
|
+
|
78
85
|
# Add the 'Deleted' flag to this message on the remote server
|
79
86
|
#
|
80
87
|
def delete!
|
data/lib/luggage/version.rb
CHANGED