Mercurial > pumpbridge
comparison src/sync.coffee @ 3:98a070c98982
add Twitter support
author | Mathias Gebbe <mgebbe@intevation.de> |
---|---|
date | Thu, 05 Jun 2014 18:02:25 +0200 |
parents | b73191efc65b |
children | f352c74a6a5b |
comparison
equal
deleted
inserted
replaced
2:e942a968cb52 | 3:98a070c98982 |
---|---|
1 # Copyright (C) 2014 by Intevation GmbH | 1 # Copyright (C) 2014 by Intevation GmbH |
2 # Author: Mathias Gebbe <mgebbe@intevation.de> | 2 # Author: Mathias Gebbe <mgebbe@intevation.de> |
3 # | 3 # |
4 # This file is Free Software under the Apache License, Version 2.0 | 4 # This file is Free Software under the Apache License, Version 2.0; |
5 # (the "License"); and comes with ABSOLUTELY NO WARRANTY! | 5 # and comes with NO WARRANTY! |
6 # You may not use this file except in compliance with the License. | 6 # See the documentation coming with pumpbridge for details. |
7 # See LICENSE for details. | |
8 | 7 |
9 _ = require("underscore") | 8 _ = require("underscore") |
10 async = require("async") | 9 async = require("async") |
11 Facebook = require("./facebook") | 10 Facebook = require("./facebook") |
12 Usermap = require("./usermap") | 11 Usermap = require("./usermap") |
13 Google = require("./google") | 12 Google = require("./google") |
13 Config = require ("./config") | |
14 config = Config.config | |
15 Twitter = require("./twitter")(config) | |
14 | 16 |
15 syncFromESN = () -> | 17 syncFromESN = () -> |
16 console.log 'syncFromESN' | 18 console.log 'syncFromESN' |
17 | 19 |
18 # STEP1: get all from usermap *network (3) "usermap:mgebbe@io.intevation.de_to_100002056487693@facebook" | 20 # STEP1: get all from usermap *network (3) "usermap:mgebbe@io.intevation.de_to_100002056487693@facebook" |
34 ), (err) -> | 36 ), (err) -> |
35 return | 37 return |
36 catch err | 38 catch err |
37 console.log 'Error!' | 39 console.log 'Error!' |
38 return | 40 return |
41 | |
42 # Twitter | |
43 try | |
44 Usermap.scan ((user) -> | |
45 if user.id.indexOf('twitter') isnt -1 | |
46 console.log "start sync for twitter user" | |
47 Twitter.sync(user) | |
48 return | |
49 ), (err) -> | |
50 return | |
51 catch err | |
52 console.log 'Error!' | |
53 return | |
54 | |
39 | 55 |
40 # Google | 56 # Google |
41 try | 57 try |
42 Usermap.scan ((user) -> | 58 Usermap.scan ((user) -> |
43 if user.id.indexOf('google') isnt -1 | 59 if user.id.indexOf('google') isnt -1 |