postfix_status_line 0.1.5 → 0.1.6
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/README.md +1 -1
- data/ext/postfix_status_line_core.c +3 -20
- data/lib/postfix_status_line/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: c74111143a620177a8d42e331fb6db8bec991624
|
4
|
+
data.tar.gz: e670baf832cc96497443b113de38211cb72c3b22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83090fc2af2f238d61de9eb71f428d6266dfdd518aeeecddcb0e10a8bae60c5a9f365672e610bcafcb9bcc0a747d29c69ac7bec72b73f88a5f2f0520b30c1b96
|
7
|
+
data.tar.gz: 6354c6cad36dcfb88e06e4d5eb8b2c84e82ce93becbf937557530983672d970c036675789e69eba473f4d28dd69fb82487ddb7f93d599d19d55c095d15b546c6
|
data/README.md
CHANGED
@@ -38,7 +38,7 @@ PostfixStatusLine.parse(status_line)
|
|
38
38
|
# "relay" => "gateway-f1.isp.att.net[204.127.217.16]:25",
|
39
39
|
# "status" => "sent",
|
40
40
|
# "status_detail" => "(250 ok ; id=20120227140036M0700qer4ne)",
|
41
|
-
# "time" =>
|
41
|
+
# "time" => "Feb 8 09:02:37",
|
42
42
|
# "to" => "<*******@bellsouth.net>",
|
43
43
|
# "domain" => "bellsouth.net"
|
44
44
|
# }
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#include "postfix_status_line_core.h"
|
2
2
|
|
3
|
-
static char *split(char **orig_str, char *delim, size_t delim_len) {
|
3
|
+
static char *split(char **orig_str, const char *delim, size_t delim_len) {
|
4
4
|
char *str = *orig_str;
|
5
|
-
char *ptr = strstr(str, delim);
|
5
|
+
char *ptr = strstr((const char *) str, delim);
|
6
6
|
|
7
7
|
if (ptr == NULL) {
|
8
8
|
return NULL;
|
@@ -187,23 +187,6 @@ static void split_line2(char *str, int mask, VALUE hash) {
|
|
187
187
|
}
|
188
188
|
}
|
189
189
|
|
190
|
-
static void put_time(char *str, VALUE hash) {
|
191
|
-
time_t now = time(NULL);
|
192
|
-
struct tm *t = localtime(&now);
|
193
|
-
|
194
|
-
if (strptime(str, "%b %d %H:%M:%S", t) == NULL) {
|
195
|
-
return;
|
196
|
-
}
|
197
|
-
|
198
|
-
time_t epoch = mktime(t);
|
199
|
-
|
200
|
-
if (epoch == -1) {
|
201
|
-
return;
|
202
|
-
}
|
203
|
-
|
204
|
-
rb_hash_aset(hash, rb_str_new2("time"), LONG2NUM(epoch));
|
205
|
-
}
|
206
|
-
|
207
190
|
static VALUE rb_postfix_status_line_parse(VALUE self, VALUE v_str, VALUE v_mask) {
|
208
191
|
Check_Type(v_str, T_STRING);
|
209
192
|
|
@@ -232,7 +215,7 @@ static VALUE rb_postfix_status_line_parse(VALUE self, VALUE v_str, VALUE v_mask)
|
|
232
215
|
}
|
233
216
|
|
234
217
|
VALUE hash = rb_hash_new();
|
235
|
-
|
218
|
+
rb_hash_aset(hash, rb_str_new2("time"), rb_str_new2(tm));
|
236
219
|
rb_hash_aset(hash, rb_str_new2("hostname"), rb_str_new2(hostname));
|
237
220
|
rb_hash_aset(hash, rb_str_new2("process"), rb_str_new2(process));
|
238
221
|
rb_hash_aset(hash, rb_str_new2("queue_id"), rb_str_new2(queue_id));
|