pony-express 0.6.5 → 0.6.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/ext/extconf.rb +4 -7
  3. data/ext/mimetic.cxx +13 -12
  4. metadata +18 -5
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.5
1
+ 0.6.6
data/ext/extconf.rb CHANGED
@@ -7,10 +7,7 @@ $CFLAGS = "-DHAVE_INTTYPES_H"
7
7
  Config::CONFIG['CC'] = 'g++'
8
8
  Config::CONFIG['CPP'] = 'g++'
9
9
 
10
- headers_mimetic = [ 'stdio.h', 'mimetic/mimetic.h' ]
11
- headers_pcrecpp = [ 'stdio.h', 'pcre++.h' ]
12
-
13
- if !have_library('mimetic', nil, headers_mimetic)
10
+ if !have_library('mimetic')
14
11
  puts <<-ERROR
15
12
 
16
13
  Cannot find mimetic headers or libraries.
@@ -20,11 +17,11 @@ if !have_library('mimetic', nil, headers_mimetic)
20
17
  exit 1
21
18
  end
22
19
 
23
- if !have_library('pcre++', nil, headers_pcrecpp)
20
+ if !have_library('pcrecpp')
24
21
  puts <<-ERROR
25
22
 
26
- Cannot find pcre++ headers or libraries.
27
- Try sudo apt-get install libpcre++-dev on debian flavors of linux.
23
+ Cannot find pcrecpp headers or libraries from pcre3.
24
+ Try sudo apt-get install libpcre3-dev on debian flavors of linux.
28
25
 
29
26
  ERROR
30
27
  exit 1
data/ext/mimetic.cxx CHANGED
@@ -7,8 +7,9 @@ extern "C" {
7
7
  #include <sstream>
8
8
  #include <exception>
9
9
  #include <algorithm>
10
- #include <pcre++.h>
10
+ #include <pcrecpp.h>
11
11
  #include <mimetic/mimetic.h>
12
+ #include <map>
12
13
 
13
14
  #define ID_CONST_GET rb_intern("const_get")
14
15
  #define CONST_GET(scope, constant) (rb_funcall(scope, ID_CONST_GET, 1, rb_str_new2(constant)))
@@ -23,7 +24,7 @@ static VALUE rb_UTF8, rb_ASCII;
23
24
 
24
25
  using namespace std;
25
26
  using namespace mimetic;
26
- using namespace pcrepp;
27
+ using namespace pcrecpp;
27
28
 
28
29
  map<string, string> MimeTypes;
29
30
 
@@ -49,8 +50,8 @@ string message_id(int n) {
49
50
  }
50
51
 
51
52
  string file_mime_type(string file) {
52
- Pcre regex("\\.");
53
- string extn = regex.split(file).back();
53
+ string extn;
54
+ RE("(?:.*)\\.([^\\.]+)$").FullMatch(file, &extn);
54
55
  transform(extn.begin(), extn.end(), extn.begin(), ::tolower);
55
56
  string mime = MimeTypes[extn];
56
57
  return mime.length() > 0 ? mime : "application/octet-stream";
@@ -79,12 +80,9 @@ bool mimetic_attach_file(MimeEntity *m, char* filename) {
79
80
  }
80
81
 
81
82
  string safe_rfc2047(string v) {
82
- Pcre re1("\\?");
83
- Pcre re2("_");
84
- Pcre re3(" ");
85
- v = re1.replace(v, "=3F");
86
- v = re2.replace(v, "=5F");
87
- v = re3.replace(v, "_");
83
+ RE("\\?").GlobalReplace("=3F", &v);
84
+ RE("_").GlobalReplace("=5F", &v);
85
+ RE(" ").GlobalReplace("_", &v);
88
86
  return v;
89
87
  }
90
88
 
@@ -109,16 +107,19 @@ string quoted_printable(VALUE str) {
109
107
  // Exposed API
110
108
 
111
109
  void rb_load_mime_types(VALUE self, VALUE filename) {
110
+ string piece;
112
111
  char buffer[4096];
113
112
  vector<string> data;
114
- Pcre regex("[\\r\\n\\t]+");
113
+ RE regex("(.+?)(?:[\\r\\n\\t]+|$)");
115
114
  ifstream file(RSTRING_PTR(filename), ios::in);
116
115
  if (file.is_open()) {
117
116
  while (!file.eof()) {
118
117
  file.getline(buffer, 4096);
119
- data = regex.split(buffer);
118
+ StringPiece input(buffer);
119
+ while (regex.Consume(&input, &piece)) data.push_back(piece);
120
120
  for (int i = 1; i < data.size(); i++)
121
121
  MimeTypes[data[i]] = data[0];
122
+ data.clear();
122
123
  }
123
124
  file.close();
124
125
  }
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pony-express
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ hash: 11
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 6
9
+ - 6
10
+ version: 0.6.6
5
11
  platform: ruby
6
12
  authors:
7
13
  - Bharanee Rathna
@@ -9,7 +15,7 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-06-08 00:00:00 +10:00
18
+ date: 2010-07-13 00:00:00 +10:00
13
19
  default_executable:
14
20
  dependencies: []
15
21
 
@@ -30,6 +36,7 @@ files:
30
36
  - lib/pony-express/test.rb
31
37
  - mime.types
32
38
  - README.rdoc
39
+ - ext/extconf.rb
33
40
  has_rdoc: true
34
41
  homepage: http://github.com/deepfryed/pony-express
35
42
  licenses: []
@@ -40,21 +47,27 @@ rdoc_options:
40
47
  require_paths:
41
48
  - lib
42
49
  required_ruby_version: !ruby/object:Gem::Requirement
50
+ none: false
43
51
  requirements:
44
52
  - - ">="
45
53
  - !ruby/object:Gem::Version
54
+ hash: 3
55
+ segments:
56
+ - 0
46
57
  version: "0"
47
- version:
48
58
  required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
49
60
  requirements:
50
61
  - - ">="
51
62
  - !ruby/object:Gem::Version
63
+ hash: 3
64
+ segments:
65
+ - 0
52
66
  version: "0"
53
- version:
54
67
  requirements: []
55
68
 
56
69
  rubyforge_project:
57
- rubygems_version: 1.3.5
70
+ rubygems_version: 1.3.7
58
71
  signing_key:
59
72
  specification_version: 3
60
73
  summary: A fast and lightweight mailer