Example #1
0
        protected override async Task DoReceive()
        {
            if (_listId == null)
            {
                // get description
                var list = (await ReceiveListDescription(_auth, _listInfo));
                await ListProxy.SetListDescription(list);

                _listId = list.Id;
            }
            // if list data is not found, abort receiving timeline.
            if (_listId == null)
            {
                return;
            }
            var id       = _listId.Value;
            var users    = (await ReceiveListMembers(_auth, id)).OrderBy(l => l).ToArray();
            var oldUsers = (await ListProxy.GetListMembers(id)).OrderBy(l => l).ToArray();

            if (users.SequenceEqual(oldUsers))
            {
                // not changed
                return;
            }
            // commit changes
            await ListProxy.SetListMembers(id, users);

            ListMemberChanged.SafeInvoke();
        }
Example #2
0
 public static void Initialize()
 {
     BehaviorLogger.Log("RM", "initializing...");
     _userReceiveManager       = new UserReceiveManager();
     _searchReceiveManager     = new SearchReceiveManager();
     _listReceiveManager       = new ListReceiveManager();
     _listMemberReceiveManager = new ListMemberReceiveManager();
     _listMemberReceiveManager.ListMemberChanged += li => ListMemberChanged.SafeInvoke(li);
     _streamTrackReceiveManager = new StreamTrackReceiveManager(_userReceiveManager);
     _userReceiveManager.ConnectionStateChanged += arg => UserStreamsConnectionStateChanged.SafeInvoke(arg);
     BehaviorLogger.Log("RM", "init.");
 }
Example #3
0
 public void StartReceive(TwitterAccount account, ListInfo info)
 {
     lock (this._listReceiverLocker)
     {
         if (this._listReceiverReferenceCount.ContainsKey(info))
         {
             this._listReceiverReferenceCount[info]++;
         }
         else
         {
             var lmr = new ListMemberReceiver(account, info);
             lmr.ListMemberChanged += () => ListMemberChanged.SafeInvoke(info);
             this._listReceiverReferenceCount.Add(info, 1);
             this._receiverDictionary.Add(info, lmr);
         }
     }
 }