mbox 0.0.4.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 859fbda7cb1da1406e82bbdc288645f7e0d70099
4
+ data.tar.gz: a70c82adf18e597546eda0baa2a6bdb1c4bf15d3
5
+ SHA512:
6
+ metadata.gz: 3872b5220cd81d8e3dd02b30d305d0e47502b163b640982cfb3453b6a38167a7c3e0c98ff3e6420dd0396a8e64023e6e3687735ee13cfb5cf82b554bbc10ad90
7
+ data.tar.gz: 09a9f8de95dc2de2dfbb1906d9b3a8496228494a23e53ee4772485dac9b05addf64e64a5f91d94cfb1f5f19afbddc693a04c7e1e63782874207ade3364bd9b26
@@ -57,18 +57,21 @@ class Connection < EventMachine::Protocols::LineAndTextProtocol
57
57
 
58
58
  if command == 'unread'
59
59
  send_response boxes.select {|box|
60
- if !$unread[box] || $unread[box].last_check < [File.ctime(box.path), File.mtime(box.path)].max
60
+ path = box.path
61
+ last = [File.ctime(path), File.mtime(path)].max
62
+
63
+ if !$unread[path] || ($unread[path].last_check < last && last < Time.now)
61
64
  unless $unread[:checking]
62
65
  $unread[:checking] = true
63
66
 
64
67
  EM.defer {
65
- $unread[box] = Struct.new(:status, :last_check).new(box.has_unread?, Time.new)
68
+ $unread[path] = Struct.new(:status, :last_check).new(box.has_unread?, Time.new)
66
69
  $unread[:checking] = false
67
70
  }
68
71
  end
69
72
  end
70
73
 
71
- $unread[box].status rescue false
74
+ $unread[path].status rescue false
72
75
  }.map(&:name)
73
76
  end
74
77
  end
@@ -26,7 +26,11 @@ class File
26
26
 
27
27
  def initialize (headers, content)
28
28
  if headers[:content_type] && headers[:content_type].charset
29
- content.force_encoding headers[:content_type].charset
29
+ begin
30
+ content.force_encoding headers[:content_type].charset
31
+ rescue
32
+ content.force_encoding 'BINARY'
33
+ end
30
34
  end
31
35
 
32
36
  if headers[:content_transfer_encoding] == 'base64'
@@ -28,15 +28,15 @@ class ContentType
28
28
  stuff = text.gsub(/\n\r/, '').split(/\s*;\s*/)
29
29
  type = stuff.shift
30
30
 
31
- ContentType.new(Hash[stuff.map {|stuff|
32
- stuff = stuff.strip.split(/=/)
33
- stuff[0] = stuff[0].to_sym
31
+ ContentType.new(Hash[stuff.map {|s|
32
+ s = s.strip.split('=', 2)
33
+ s[0] = s[0].to_sym
34
34
 
35
- if stuff[1][0] == '"' && stuff[1][stuff[1].length-1] == '"'
36
- stuff[1] = stuff[1][1, stuff[1].length-2]
35
+ if s[1][0] == '"' && s[1][s[1].length-1] == '"'
36
+ s[1] = s[1][1, s[1].length-2]
37
37
  end
38
38
 
39
- stuff
39
+ s
40
40
  }].merge(mime: type))
41
41
  end
42
42
 
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.6
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - meh.
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-08-28 00:00:00.000000000 Z
11
+ date: 2013-07-20 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: call-me
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  description: A simple library to read mbox files.
@@ -35,39 +32,38 @@ executables:
35
32
  extensions: []
36
33
  extra_rdoc_files: []
37
34
  files:
38
- - lib/mbox.rb
39
35
  - lib/mbox/mbox.rb
40
36
  - lib/mbox/mail.rb
41
37
  - lib/mbox/mail/headers.rb
42
38
  - lib/mbox/mail/metadata.rb
43
- - lib/mbox/mail/file.rb
44
39
  - lib/mbox/mail/content.rb
45
- - lib/mbox/mail/headers/status.rb
46
40
  - lib/mbox/mail/headers/content_type.rb
41
+ - lib/mbox/mail/headers/status.rb
42
+ - lib/mbox/mail/file.rb
43
+ - lib/mbox.rb
47
44
  - bin/mbox-do
48
45
  - bin/mbox-daemon
49
46
  homepage: http://github.com/meh/ruby-mbox
50
47
  licenses: []
48
+ metadata: {}
51
49
  post_install_message:
52
50
  rdoc_options: []
53
51
  require_paths:
54
52
  - lib
55
53
  required_ruby_version: !ruby/object:Gem::Requirement
56
- none: false
57
54
  requirements:
58
- - - ! '>='
55
+ - - '>='
59
56
  - !ruby/object:Gem::Version
60
57
  version: '0'
61
58
  required_rubygems_version: !ruby/object:Gem::Requirement
62
- none: false
63
59
  requirements:
64
- - - ! '>='
60
+ - - '>='
65
61
  - !ruby/object:Gem::Version
66
62
  version: '0'
67
63
  requirements: []
68
64
  rubyforge_project:
69
- rubygems_version: 1.8.24
65
+ rubygems_version: 2.0.3
70
66
  signing_key:
71
- specification_version: 3
67
+ specification_version: 4
72
68
  summary: A simple library to read mbox files.
73
69
  test_files: []