mirror of
https://github.com/MailHops/mailhops-node.git
synced 2025-05-15 19:30:13 -07:00
Fixed date logic
This commit is contained in:
parent
6ee6c3d673
commit
df6ad59b69
@ -1,11 +1,11 @@
|
|||||||
# MailHops API node
|
# MailHops API node
|
||||||
[www.MailHops.com](http://www.mailhops.com)
|
[www.MailHops.com](http://www.mailhops.com)
|
||||||
|
|
||||||
|
<img src="https://www.mailhops.com/images/logos/logo.png" alt="MailHops logo" title="MailHops" align="right" />
|
||||||
|
|
||||||
[](https://travis-ci.org/avantassel/mailhops-node)
|
[](https://travis-ci.org/avantassel/mailhops-node)
|
||||||
[](https://www.npmjs.com/package/mailhops)
|
[](https://www.npmjs.com/package/mailhops)
|
||||||
|
|
||||||
<img src="https://www.mailhops.com/images/logos/logo.png" alt="MailHops logo" title="MailHops" align="right" />
|
|
||||||
|
|
||||||
A nodejs module for interacting with the MailHops API.
|
A nodejs module for interacting with the MailHops API.
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
@ -32,7 +32,7 @@ var mailhops = new MailHops({
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
MailHops objects can also be configured via the `.configure(options)` method. Here is an exmaple:
|
MailHops objects can also be configured via the `.configure(options)` method. Here is an example:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var MailHops = require("mailhops");
|
var MailHops = require("mailhops");
|
||||||
|
10
lib/api.js
10
lib/api.js
@ -107,7 +107,10 @@ module.exports = {
|
|||||||
_.each(headers,function(line){
|
_.each(headers,function(line){
|
||||||
|
|
||||||
//if the header line begins with Received, X-Received or X-Originating-IP then push that to our array
|
//if the header line begins with Received, X-Received or X-Originating-IP then push that to our array
|
||||||
if(line.indexOf('Received:')===0 || line.indexOf('X-Received:')===0){
|
if(line.indexOf('Date:')===0){
|
||||||
|
firstDate = line.substring(line.indexOf('Date:')+5).trim();
|
||||||
|
}
|
||||||
|
else if(line.indexOf('Received:')===0 || line.indexOf('X-Received:')===0){
|
||||||
if(rline != ''){
|
if(rline != ''){
|
||||||
receivedHeaders.push(rline);
|
receivedHeaders.push(rline);
|
||||||
rline = '';
|
rline = '';
|
||||||
@ -129,9 +132,10 @@ module.exports = {
|
|||||||
|
|
||||||
// first and last dates are used to calculate time_traveled Traveled
|
// first and last dates are used to calculate time_traveled Traveled
|
||||||
if(rline.indexOf(';')!==-1){
|
if(rline.indexOf(';')!==-1){
|
||||||
|
if(!firstDate)
|
||||||
|
firstDate = rline.substring(rline.indexOf(';')+1).trim();
|
||||||
if(!lastDate)
|
if(!lastDate)
|
||||||
lastDate = rline.substring(rline.indexOf(';')+1).trim();
|
lastDate = rline.substring(rline.indexOf(';')+1).trim();
|
||||||
firstDate = rline.substring(rline.indexOf(';')+1).trim();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rline = '';
|
rline = '';
|
||||||
@ -152,7 +156,7 @@ module.exports = {
|
|||||||
try {
|
try {
|
||||||
firstDate = new Date(firstDate);
|
firstDate = new Date(firstDate);
|
||||||
lastDate = new Date(lastDate);
|
lastDate = new Date(lastDate);
|
||||||
this.time_traveled = parseInt(lastDate-firstDate);
|
this.time_traveled = lastDate - firstDate;
|
||||||
} catch(e){
|
} catch(e){
|
||||||
this.time_traveled = null;
|
this.time_traveled = null;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ Received: from 198.21.5.108.o2.delivery2.klaviyomail.com (o2.delivery2.klaviyoma
|
|||||||
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
|
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
|
||||||
(No client certificate requested)
|
(No client certificate requested)
|
||||||
by homiemail-mx32.g.dreamhost.com (Postfix) with ESMTPS id 4BE0510190916
|
by homiemail-mx32.g.dreamhost.com (Postfix) with ESMTPS id 4BE0510190916
|
||||||
for <andrew@mailhops.com>; Thu, 3 Sep 2014 16:38:38 -0700 (PDT)
|
for <andrew@mailhops.com>; Thu, 3 Sep 2014 16:38:48 -0700 (PDT)
|
||||||
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed;
|
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed;
|
||||||
d=delivery.klaviyomail.com;
|
d=delivery.klaviyomail.com;
|
||||||
h=content-type:mime-version:from:to:subject; s=smtpapi;
|
h=content-type:mime-version:from:to:subject; s=smtpapi;
|
||||||
@ -31,14 +31,14 @@ Received: from muon.isy.liu.se (130.236.48.25) by edge01.net.lu.se
|
|||||||
Received: from ip227-36.wireless.lu.se (ip227-36.wireless.lu.se
|
Received: from ip227-36.wireless.lu.se (ip227-36.wireless.lu.se
|
||||||
[130.235.227.36]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No
|
[130.235.227.36]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No
|
||||||
client certificate requested) by muon.isy.liu.se (Postfix) with ESMTPSA id
|
client certificate requested) by muon.isy.liu.se (Postfix) with ESMTPSA id
|
||||||
D4B3D802; Thu, 4 Sep 2014 1:38:28 +0200 (MEST)
|
D4B3D802; Thu, 3 Sep 2014 16:38:38 -0700 (PDT)
|
||||||
Content-Type: multipart/alternative;
|
Content-Type: multipart/alternative;
|
||||||
boundary="===============2767014682564602329=="
|
boundary="===============2767014682564602329=="
|
||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
From: ProgrammableWeb Today <editor@programmableweb.com>
|
From: ProgrammableWeb Today <editor@programmableweb.com>
|
||||||
To: Andrew Van Tassel <andrew@mailhops.com>
|
To: Andrew Van Tassel <andrew@mailhops.com>
|
||||||
Subject: Is It Time to Move On from .NET?
|
Subject: Is It Time to Move On from .NET?
|
||||||
Date: Thu, 4 Sep 2014 1:38:28 GMT
|
Date: Thu, 3 Sep 2014 16:38:38 -0700 (PDT)
|
||||||
X-Kmail-Relay: [gmh6f2.krelaymail.com]:587
|
X-Kmail-Relay: [gmh6f2.krelaymail.com]:587
|
||||||
Message-Id: <20150615173758.E2343271B8@queue-worker-166.servers.clovesoftware.com>
|
Message-Id: <20150615173758.E2343271B8@queue-worker-166.servers.clovesoftware.com>
|
||||||
X-SG-EID: z/7dFXGDBkx/fUP8kk8C2xB01JCsbu4AgSgValkgiTccFIBxI9L4Y1qe6fbe+Uf2YVSIXGTcm+Mu+n
|
X-SG-EID: z/7dFXGDBkx/fUP8kk8C2xB01JCsbu4AgSgValkgiTccFIBxI9L4Y1qe6fbe+Uf2YVSIXGTcm+Mu+n
|
||||||
|
Loading…
x
Reference in New Issue
Block a user