Example #1
0
        private void GetStatusReplied(TwitterStatus status)
        {
            if (status.InReplyToStatusId != null)
            {
                Interlocked.Increment(ref pendingCalls);
                service.GetTweet(new GetTweetOptions {
                    Id = (long)status.InReplyToStatusId
                }, (result, response) =>
                {
                    if (result == null || response.StatusCode != HttpStatusCode.OK)
                    {
                        RaiseCallback(new List <TwitterStatus>(), response); // report the error
                        TryFinish();
                        return;
                    }

                    okResponse = response;
                    if (!searchCache.Contains(result))
                    {
                        searchCache.Add(result);
                    }

                    RaiseCallback(new List <TwitterStatus> {
                        status, result
                    }, response);

                    GetConversationForStatus(result);

                    TryFinish();
                });
            }
        }
Example #2
0
        private void ReceiveUsers(TwitterCursorList <TwitterUser> users, TwitterResponse response)
        {
            if (response.StatusCode == HttpStatusCode.NotFound)
            {
                MessageService.ShowError(Resources.CouldntFindUser);
                GoBack();
                return;
            }
            else if (response.StatusCode != HttpStatusCode.OK || users == null)
            {
                MessageService.ShowError(Resources.ErrorMessage);
                GoBack();
                return;
            }

            foreach (var usr in users)
            {
                if (!list.Contains(usr))
                {
                    list.Add(usr);
                }
            }

            if (users.NextCursor != null && users.NextCursor != 0)
            {
                if (whatUserList == "followers")
                {
                    ServiceDispatcher.GetCurrentService().ListFollowers(new ListFollowersOptions {
                        ScreenName = user
                    }, ReceiveUsers);
                }
                else if (whatUserList == "following")
                {
                    ServiceDispatcher.GetCurrentService().ListFriends(new ListFriendsOptions {
                        ScreenName = user
                    }, ReceiveUsers);
                }
            }
            else
            {
                IsLoading = false;
            }
        }
Example #3
0
        private void GetRepliesFor(TwitterStatus status)
        {
            if (processedStatuses.Contains(status))
            {
                return;
            }

            processedStatuses.Add(status); // There's a possibility that a status can be processed two times... but it's not significant nor a real problem.

            if (AreResultsCached(status.AuthorName, status.Id))
            {
                RetrieveRepliesFromCache(status);
                TryFinish();
            }
            else
            {
                Interlocked.Increment(ref pendingCalls);
                service.Search(new SearchOptions {
                    Q = "to:" + status.AuthorName, SinceId = status.Id, Count = 100
                },
                               (result, response) => SearchCallback(result, response, status));
            }
        }