Mercurial > pumpbridge
diff src/google.coffee @ 7:2123f355ab68
go back interval or 15 min, delete credentials, layout
author | Mathias Gebbe <mgebbe@intevation.de> |
---|---|
date | Wed, 11 Jun 2014 02:32:53 +0200 |
parents | f352c74a6a5b |
children | ccf1d9e741bd |
line wrap: on
line diff
--- a/src/google.coffee Sat Jun 07 10:22:12 2014 +0200 +++ b/src/google.coffee Wed Jun 11 02:32:53 2014 +0200 @@ -21,6 +21,7 @@ config = Config.config bridgeid = config.bridgeid +interval = config.interval API_KEY = config.gpAPI_KEY CLIENTID = config.gpCLIENTID CLIENTSECRET = config.gpCLIENTSECRET @@ -32,6 +33,8 @@ return if not (user?) me = user.user_pumpio id = user.user_ESN.substr(0,user.user_ESN.indexOf('@')) + if not (interval?) + interval = 15 * 60 * 1000 # 900 000 ms (15min) async.waterfall [ (callback) -> @@ -53,7 +56,12 @@ FromESN.search {uid: post.id + "@google_to_" + me, recipientUser: me}, callback (result, callback) -> return if result.length isnt 0 - Sync.postParser post, null, 'google', callback + ti = new Date().getTime() - interval + ts = Date.parse(post.published) + if (ts >= ti) + Sync.postParser post, null, 'google', callback + else + return (parsed, callback) -> Pump.postUser bridgeid, me, parsed, callback (pumppost, callback) ->