vmail 1.6.9 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -124,16 +124,6 @@ You can also pass in search parameters after specifying the mailbox:
124
124
 
125
125
  vmail important from barackobama@whitehouse.gov
126
126
 
127
- On startup, Vmail loads 100 messages by default. You can increase or decrease
128
- this number by passing in a number after the mailbox name:
129
-
130
- vmail inbox 700 subject unix
131
-
132
- Passing in 0 as the number of messages returns all messages that match
133
- the query:
134
-
135
- vmail inbox 0 subject unix # => returns all matching messages
136
-
137
127
  ## Viewing messages
138
128
 
139
129
  The first screen Vmail shows you is a list of messages. You can view a message
@@ -161,13 +151,13 @@ You can use `<C-k>` or `,k` to show the previous message.
161
151
 
162
152
  Vmail loads a certain number messages at a time, starting with the most recent.
163
153
  If there are more messages that Vmail hasn't loaded, you'll see a line at the
164
- top of the list that looks something like this:
154
+ bottom of the list that looks something like this:
165
155
 
166
156
  > Load 100 more messages. 156 remaining.
167
157
 
168
158
  Put the cursor on this line and press ENTER to load more of these messages.
169
159
 
170
- Tip: To go straight to the top line and load more messages, type `gg<ENTER>`.
160
+ Tip: To go straight to the bottom line and load more messages, type `G<ENTER>`.
171
161
 
172
162
  Unread messages are marked with a `+` symbol.
173
163
 
@@ -307,7 +297,7 @@ The current version of Vmail can handle attachments to a certain extent.
307
297
  When you're viewing a message with attachments, you'll see something like this
308
298
  at the top of the message window:
309
299
 
310
- INBOX 2113 4 kb
300
+ 4 kb
311
301
  - image/png; name=canada.png
312
302
  - image/gif; name=arrow_right.gif
313
303
  ---------------------------------------
@@ -378,13 +368,12 @@ split window.
378
368
 
379
369
  Vmail can generate a message list by performing an IMAP search on the current mailbox.
380
370
  From the message list window, type `,s`. This will prompt you for a search query.
381
- The search query is an optional number specifying the number of messages to return,
382
- followed by a valid IMAP search query.
371
+ The search query should be a valid IMAP search query.
383
372
 
384
373
  Here are some example search queries.
385
374
 
386
375
  # the default
387
- 100 all
376
+ all
388
377
 
389
378
  # all messages from thematrix.com domain
390
379
  from thematrix.com
@@ -428,7 +417,7 @@ automated scripts.
428
417
  If you redirect Vmail's output from STDOUT to a file or a program, Vmail will
429
418
  output the message list resulting from a search query to a file.
430
419
 
431
- vmail inbox 100 from monit > message-list.txt
420
+ vmail inbox from monit > message-list.txt
432
421
 
433
422
  You can open this file in any text editor to make sure that the search
434
423
  query produced the expected result. Then you can perform the following
@@ -0,0 +1,37 @@
1
+ module Vmail
2
+ DIVIDER_WIDTH = 46
3
+ UNITS = [:b, :kb, :mb, :gb].freeze
4
+
5
+ module Helpers
6
+
7
+ def retry_if_needed
8
+ res = nil
9
+ 3.times do
10
+ res = yield
11
+ break if res
12
+ end
13
+ res
14
+ end
15
+
16
+ # borrowed from ActionView/Helpers
17
+ def number_to_human_size(number)
18
+ if number.to_i < 1024
19
+ "<1kb" # round up to 1kh
20
+ else
21
+ max_exp = UNITS.size - 1
22
+ exponent = (Math.log(number) / Math.log(1024)).to_i # Convert to base 1024
23
+ exponent = max_exp if exponent > max_exp # we need this to avoid overflow for the highest unit
24
+ number /= 1024 ** exponent
25
+ unit = UNITS[exponent]
26
+ "#{number}#{unit}"
27
+ end
28
+ end
29
+
30
+
31
+ def divider(str)
32
+ str * DIVIDER_WIDTH
33
+ end
34
+
35
+
36
+ end
37
+ end
data/lib/vmail/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vmail
2
- VERSION = '1.6.9'
2
+ VERSION = '1.7.0'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: vmail
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.6.9
5
+ version: 1.7.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Daniel Choi
@@ -85,6 +85,7 @@ files:
85
85
  - lib/vmail/contacts_extractor.rb
86
86
  - lib/vmail/database.rb
87
87
  - lib/vmail/flagging_and_moving.rb
88
+ - lib/vmail/helpers.rb
88
89
  - lib/vmail/imap_client.rb
89
90
  - lib/vmail/message_formatter.rb
90
91
  - lib/vmail/options.rb