]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Meteor/meteorupdater.js
91d12cde9c2696b546b2eeb37cec21ef09ef6ca6
[quix0rs-gnu-social.git] / plugins / Meteor / meteorupdater.js
1 // Update the local timeline from a Meteor server
2 // XXX: If @a is subscribed to @b, @a should get @b's notices in @a's Personal timeline.
3 //      Do Replies timeline.
4
5 var MeteorUpdater = function()
6 {
7     return {
8
9         init: function(server, port, timeline)
10         {
11             Meteor.callbacks["process"] = function(data) {
12                 var d = JSON.parse(data);
13
14                 var user_url = $('address .url')[0].href+d['user']['screen_name'];
15
16                 var wlh = window.location.href;
17
18                 if (wlh.indexOf('?') > 0) {
19                    wlh = wlh.slice(0, wlh.indexOf('?'))
20                 }
21
22                 if (timeline == 'public' ||
23                     user_url+'/all' == wlh ||
24                     user_url == wlh) {
25
26                     RealtimeUpdate.receive(d);
27                 }
28             };
29
30             Meteor.host = server;
31             Meteor.port = port;
32             Meteor.joinChannel(timeline, 0);
33             Meteor.connect();
34         }
35     }
36 }();
37