]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Meteor/meteorupdater.js
de01d430a1220fa7830148ead1a8d9c3ef874d3e
[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                var screen_name;
12
13                Meteor.callbacks["process"] = function(data) {
14                     var d = JSON.parse(data);
15                     screen_name = d['user']['screen_name'];
16
17                     if (timeline == 'public' ||
18                         $('address .url')[0].href+screen_name+'/all' == window.location.href ||
19                         $('address .url')[0].href+screen_name == window.location.href) {
20                         RealtimeUpdate.receive(d);
21                     }
22                };
23
24                Meteor.host = server;
25                Meteor.port = port;
26                Meteor.joinChannel(timeline, 0);
27                Meteor.connect();
28           }
29      }
30 }();
31