Exemple #1
0
 public void AddStatus(MicroblogStatus status)
 {
     if (!statuses.ContainsKey(status.Created))
     {
         statuses.Add(status.Created, status);
     }
 }
Exemple #2
0
        public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modItems)
        {
            string status;
            MicroblogStatusReply reply;

            status = (items.First() as ITextItem).Text;
            if (modItems.Any())
            {
                status = BuildTweet(status, modItems);

                if (modItems.First() is FriendItem)
                {
                    reply = new MicroblogStatusReply(null, status);
                }
                else
                {
                    MicroblogStatus s = modItems.First() as MicroblogStatus;
                    reply = new MicroblogStatusReply(s.Id, status);
                }
            }
            else
            {
                reply = new MicroblogStatusReply(null, status);
            }

            Thread updateRunner = new Thread(new ParameterizedThreadStart(Microblog.UpdateStatus));

            updateRunner.IsBackground = true;
            updateRunner.Start(reply);

            return(null);
        }
Exemple #3
0
        public FriendItem(int id, string name, MicroblogStatus status)
        {
            statuses = new SortedList <DateTime, MicroblogStatus> ();

            Id          = id;
            this.name   = name;
            this.status = status.Status;
            this.photo  = Path.Combine(MicroblogClient.PhotoDirectory, "" + id);
            statuses.Add(status.Created, status);
        }
Exemple #4
0
        void UpdateContacts(object o)
        {
            FriendItem            newContact;
            MicroblogStatus       status;
            List <FriendItem>     newContacts;
            TwitterUserCollection friends;

            try {
                newContacts = new List <FriendItem> ();
                friends     = blog.User.Friends();
            } catch (TwitterizerException e) {
                Log.Error("{0} {1}", e.RequestData.ResponseException.Message, e.RequestData.ResponseException.StackTrace);
                Log <MicroblogClient> .Debug(GenericErrorMsg, "UpdateContacts", e.Message);

                return;
            }

            foreach (TwitterUser friend in friends)
            {
                if (friend.Status != null)
                {
                    status     = new MicroblogStatus(friend.Status.ID, friend.Status.Text, friend.ScreenName, friend.Status.Created);
                    newContact = new FriendItem(friend.ID, friend.ScreenName, status);
                }
                else
                {
                    newContact = new FriendItem(friend.ID, friend.ScreenName);
                }

                newContacts.Add(newContact);
            }

            Contacts = newContacts;
            Log <MicroblogClient> .Debug("Found {0} contacts", Contacts.Count());

            return;
        }