postfix_status_line 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/postfix_status_line_core.c +41 -23
- data/lib/postfix_status_line/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e0228c71c5531a6bc5859266242b3c31e6e6479
|
4
|
+
data.tar.gz: cc24c357e37e617b4e50bad0d7480584391f99db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2010e03c30750c4cf8234b6c35bf6f04bc9617f10621c3cf8544cdf993abb49cc2088b008c68130fb238b8187b0343463093a4464636485ad842b7ad9bf4c2b
|
7
|
+
data.tar.gz: b7a7a09bb7c84721ea0bc7d9c5d81881f965b586b3d3dfb64641422695a50bbbd488c41707d4bc11de0cf2f71a6d63b18fbbdad56495e073b50e68f2eb3448dd
|
@@ -104,6 +104,40 @@ static void mask_email(char *str) {
|
|
104
104
|
}
|
105
105
|
}
|
106
106
|
|
107
|
+
static void put_domain(char *value, VALUE hash) {
|
108
|
+
char *domain = strchr(value, '@');
|
109
|
+
|
110
|
+
if (domain == NULL) {
|
111
|
+
return;
|
112
|
+
}
|
113
|
+
|
114
|
+
domain++;
|
115
|
+
|
116
|
+
char *bracket = strchr(domain, '>');
|
117
|
+
VALUE v_value;
|
118
|
+
|
119
|
+
if (bracket == NULL) {
|
120
|
+
v_value = rb_str_new2(domain);
|
121
|
+
} else {
|
122
|
+
size_t len = bracket - domain;
|
123
|
+
v_value = rb_str_new(domain, len);
|
124
|
+
}
|
125
|
+
|
126
|
+
rb_hash_aset(hash, rb_str_new2("domain"), v_value);
|
127
|
+
}
|
128
|
+
|
129
|
+
static void put_status(char *value, VALUE hash) {
|
130
|
+
char *reason = strchr(value, ' ');
|
131
|
+
|
132
|
+
if (reason != NULL) {
|
133
|
+
*reason = '\0';
|
134
|
+
reason++;
|
135
|
+
rb_hash_aset(hash, rb_str_new2("reason"), rb_str_new2(reason));
|
136
|
+
}
|
137
|
+
|
138
|
+
rb_hash_aset(hash, rb_str_new2("status"), rb_str_new2(value));
|
139
|
+
}
|
140
|
+
|
107
141
|
static void put_attr(char *str, VALUE hash) {
|
108
142
|
char *value = strchr(str, '=');
|
109
143
|
|
@@ -115,35 +149,19 @@ static void put_attr(char *str, VALUE hash) {
|
|
115
149
|
value++;
|
116
150
|
|
117
151
|
VALUE v_key = rb_str_new2(str);
|
118
|
-
VALUE v_value;
|
119
152
|
|
120
153
|
if (strcmp(str, "delay") == 0) {
|
121
|
-
v_value = rb_float_new(atof(value));
|
154
|
+
VALUE v_value = rb_float_new(atof(value));
|
155
|
+
rb_hash_aset(hash, v_key, v_value);
|
156
|
+
} else if (strcmp(str, "status") == 0) {
|
157
|
+
put_status(value, hash);
|
122
158
|
} else {
|
123
|
-
v_value = rb_str_new2(value);
|
159
|
+
VALUE v_value = rb_str_new2(value);
|
160
|
+
rb_hash_aset(hash, v_key, v_value);
|
124
161
|
}
|
125
162
|
|
126
|
-
rb_hash_aset(hash, v_key, v_value);
|
127
|
-
|
128
163
|
if (strcmp(str, "to") == 0) {
|
129
|
-
|
130
|
-
|
131
|
-
if (domain == NULL) {
|
132
|
-
return;
|
133
|
-
}
|
134
|
-
|
135
|
-
domain++;
|
136
|
-
|
137
|
-
char *bracket = strchr(domain, '>');
|
138
|
-
|
139
|
-
if (bracket == NULL) {
|
140
|
-
v_value = rb_str_new2(domain);
|
141
|
-
} else {
|
142
|
-
size_t len = bracket - domain;
|
143
|
-
v_value = rb_str_new(domain, len);
|
144
|
-
}
|
145
|
-
|
146
|
-
rb_hash_aset(hash, rb_str_new2("domain"), v_value);
|
164
|
+
put_domain(value, hash);
|
147
165
|
}
|
148
166
|
}
|
149
167
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postfix_status_line
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|