mirror of
https://github.com/MailHops/mailhops-node.git
synced 2025-05-15 19:30:13 -07:00
Added start/end hop methods
Fixed getIPsFromMailParser
This commit is contained in:
parent
99505c4066
commit
1723b319fb
@ -1,6 +1,15 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## 2.0.2 - 2016-12-09
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Get Start Hop method
|
||||||
|
- Get End Hop method
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- getIPsFromMailParser when only one received header that is a string.
|
||||||
|
|
||||||
## 2.0.1 - 2016-12-08
|
## 2.0.1 - 2016-12-08
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
20
lib/api.js
20
lib/api.js
@ -112,6 +112,8 @@ module.exports = {
|
|||||||
|
|
||||||
if(typeof parsedmail.headers.received == 'undefined')
|
if(typeof parsedmail.headers.received == 'undefined')
|
||||||
return ips;
|
return ips;
|
||||||
|
else if(typeof parsedmail.headers.received == 'string')
|
||||||
|
parsedmail.headers.received = [parsedmail.headers.received];
|
||||||
|
|
||||||
_.each(parsedmail.headers.received,function(line){
|
_.each(parsedmail.headers.received,function(line){
|
||||||
var received_ips = line.match(regexAllIp);
|
var received_ips = line.match(regexAllIp);
|
||||||
@ -231,5 +233,23 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return receivedHeaders;
|
return receivedHeaders;
|
||||||
|
},
|
||||||
|
|
||||||
|
getStartHop: function(routeResponse){
|
||||||
|
var route = _.filter(hops.route, function(h){
|
||||||
|
return ((!!h.lat && !!h.lng) || h.coords);
|
||||||
|
});
|
||||||
|
if(route.length)
|
||||||
|
return route[0];
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
|
||||||
|
getEndHop: function(routeResponse){
|
||||||
|
var route = _.filter(hops.route, function(h){
|
||||||
|
return ((!!h.lat && !!h.lng) || h.coords);
|
||||||
|
});
|
||||||
|
if(route.length)
|
||||||
|
return route[route.length-1];
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user