pony-express 0.6.8 → 0.7.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.
- data/README.rdoc +2 -2
- data/VERSION +1 -1
- data/ext/mimetic.cxx +25 -2
- metadata +5 -5
data/README.rdoc
CHANGED
@@ -6,7 +6,7 @@ historical perspective read http://en.wikipedia.org/wiki/Pony_Express.
|
|
6
6
|
== Installation
|
7
7
|
|
8
8
|
sudo apt-get install libmimetic-dev
|
9
|
-
sudo apt-get install
|
9
|
+
sudo apt-get install libpcre3-dev
|
10
10
|
sudo gem install pony-express
|
11
11
|
|
12
12
|
=== Dependencies
|
@@ -15,7 +15,7 @@ historical perspective read http://en.wikipedia.org/wiki/Pony_Express.
|
|
15
15
|
* rubygems >= 1.3.5
|
16
16
|
* ruby development libraries (debian: ruby1.9.1-dev)
|
17
17
|
* mimetic >= 0.9.6 development libraries (debian: libmimetic-dev)
|
18
|
-
*
|
18
|
+
* pcre3 development libraries (debian: libpcre3-dev)
|
19
19
|
|
20
20
|
== Usage
|
21
21
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.7.0
|
data/ext/mimetic.cxx
CHANGED
@@ -150,6 +150,7 @@ VALUE rb_mimetic_build(VALUE self, VALUE options) {
|
|
150
150
|
VALUE cc = rb_hash_aref(options, ID2SYM(rb_intern("cc")));
|
151
151
|
VALUE bcc = rb_hash_aref(options, ID2SYM(rb_intern("bcc")));
|
152
152
|
VALUE files = rb_hash_aref(options, ID2SYM(rb_intern("attachments")));
|
153
|
+
VALUE headers = rb_hash_aref(options, ID2SYM(rb_intern("headers")));
|
153
154
|
|
154
155
|
if (mid != Qnil && TYPE(mid) != T_STRING)
|
155
156
|
rb_raise(rb_eArgError, "Mimetic.build expects :message_id to be a string");
|
@@ -163,6 +164,9 @@ VALUE rb_mimetic_build(VALUE self, VALUE options) {
|
|
163
164
|
if (files != Qnil && TYPE(files) != T_ARRAY)
|
164
165
|
rb_raise(rb_eArgError, "Mimetic.build expects :attachments to be an array");
|
165
166
|
|
167
|
+
if (headers != Qnil && TYPE(headers) != T_ARRAY)
|
168
|
+
rb_raise(rb_eArgError, "Mimetic.build expects :headers to be an array");
|
169
|
+
|
166
170
|
VALUE errors = Qnil;
|
167
171
|
MimeEntity *message = NULL;
|
168
172
|
MimeEntity *html_part = NULL;
|
@@ -171,6 +175,7 @@ VALUE rb_mimetic_build(VALUE self, VALUE options) {
|
|
171
175
|
|
172
176
|
try {
|
173
177
|
message = new MimeEntity;
|
178
|
+
|
174
179
|
if (html != Qnil && text != Qnil) {
|
175
180
|
delete message;
|
176
181
|
message = new MultipartAlternative;
|
@@ -217,16 +222,34 @@ VALUE rb_mimetic_build(VALUE self, VALUE options) {
|
|
217
222
|
if (cc != Qnil) message->header().cc(CSTRING(cc));
|
218
223
|
if (bcc != Qnil) message->header().bcc(CSTRING(bcc));
|
219
224
|
|
225
|
+
if (headers != Qnil) {
|
226
|
+
for (long i = 0; i < RARRAY_LEN(headers); i++) {
|
227
|
+
VALUE header = rb_ary_entry(headers, i);
|
228
|
+
if (TYPE(header) != T_HASH)
|
229
|
+
throw "Mimetic.build header should be a hash with :name and :value";
|
230
|
+
string name = CSTRING(rb_hash_aref(header, ID2SYM(rb_intern("name"))));
|
231
|
+
string value = CSTRING(rb_hash_aref(header, ID2SYM(rb_intern("value"))));
|
232
|
+
if (name.length() && value.length()) {
|
233
|
+
Field f(name, value);
|
234
|
+
message->header().field("") = f;
|
235
|
+
}
|
236
|
+
}
|
237
|
+
}
|
238
|
+
|
220
239
|
output << *message << endl;
|
221
240
|
delete message;
|
222
241
|
return rb_str_new2(output.str().c_str());
|
223
242
|
}
|
224
243
|
catch(exception &e) {
|
225
|
-
if (message
|
244
|
+
if (message) delete message;
|
226
245
|
errors = rb_str_new2(e.what());
|
227
246
|
}
|
247
|
+
catch(string &e) {
|
248
|
+
if (message) delete message;
|
249
|
+
errors = rb_str_new2(e.c_str());
|
250
|
+
}
|
228
251
|
catch (...) {
|
229
|
-
if (message
|
252
|
+
if (message) delete message;
|
230
253
|
errors = rb_str_new2("Unknown Error");
|
231
254
|
}
|
232
255
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pony-express
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 7
|
9
|
+
- 0
|
10
|
+
version: 0.7.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bharanee Rathna
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-15 00:00:00 +11:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|