Ejemplo n.º 1
0
        public void Render()
        {
            if (Status != null)
            {
                Cursor.Current = Cursors.WaitCursor;

                PockeTwit.Library.status stat = Status;

                //if (Status.retweeted_status != null)
                //{
                //    //why won't this work? does retweeted_status need to
                //    //be saved in the db?
                //    stat = Status.retweeted_status;
                //}

                //if it's a new retweet, make an API call to get orginal tweet
                //so we can show all 140 chars of the tweet
                if (Status.TypeofMessage == PockeTwit.Library.StatusTypes.Retweet)
                {
                    foreach (Yedda.Twitter.Account a in ClientSettings.AccountsList)
                    {
                        if (a.Equals(Status.Account))
                        {
                            Yedda.Twitter.Account NewAccount = new Yedda.Twitter.Account
                            {
                                ServerURL = a.ServerURL,
                                UserName = a.UserName,
                                Password = a.Password,
                                Enabled = a.Enabled,
                                OAuth_token = a.OAuth_token,
                                OAuth_token_secret = a.OAuth_token_secret
                            };
                            Conn = Yedda.Servers.CreateConnection(NewAccount);

                            //Get the tweet again from Twitter
                            stat = PockeTwit.Library.status.DeserializeSingle(Conn.ShowSingleStatus(stat.id), Conn.AccountInfo);

                            //Set the tweet to the original tweet
                            stat = stat.retweeted_status;
                            break;
                        }
                    }
                }

                avatarBox.Image = PockeTwit.ThrottledArtGrabber.GetArt(stat.user.profile_image_url);
                lblUserName.Text = stat.user.screen_name;
                lblTime.Text = stat.TimeStamp;
                if (string.IsNullOrEmpty(stat.source))
                {
                    lblSource.Text = "";
                }
                else
                {

                    lblSource.Text = "from " + StripHTML(System.Web.HttpUtility.HtmlDecode(stat.source));
                }
                string fullText;
                if (ShortText.IsShortTextURL(stat.text))
                {
                    string[] splitup = stat.text.Split(new[] { ' ' });
                    fullText = ShortText.GetFullText(splitup[splitup.Length - 1]);
                }
                else
                {
                    fullText = stat.text;
                }
                if (ClientSettings.AutoTranslate)
                {
                    fullText = GoogleTranslate.GetTranslation(fullText);
                }
                lblText.Text = System.Web.HttpUtility.HtmlDecode(fullText).Replace("&", "&&");
                Cursor.Current = Cursors.Default;
            }
        }
Ejemplo n.º 2
0
        public static User FromId(string ID, Yedda.Twitter.Account Account)
        {
            Yedda.Twitter t = new Yedda.Twitter();
            t.AccountInfo = Account;
            string Response = null;
            try
            {
                Response = t.Show(ID, Yedda.Twitter.OutputFormatType.XML);
            }
            catch
            {
                User toReturn = new User();
                toReturn.screen_name = "PockeTwitUnknownUser";
                return toReturn;
            }

            try
            {
                XmlSerializer s = new XmlSerializer(typeof(User));
                if (string.IsNullOrEmpty(Response))
                {
                    User toReturn = new User();
                    toReturn.screen_name = "PockeTwitUnknownUser";
                    return toReturn;
                }
                using (System.IO.StringReader r = new System.IO.StringReader(Response))
                {
                    return (User)s.Deserialize(r);
                }
            }
            catch
            {
                User toReturn = new User();
                toReturn.screen_name = "PockeTwitUnknownUser";
                return toReturn;
            }
        }
Ejemplo n.º 3
0
 private void menuItem2_Click(object sender, EventArgs e)
 {
     if (cmbServers.SelectedItem == null)
     {
         return;
     }
     if (string.IsNullOrEmpty(txtUserName.Text)) { return; }
     Cursor.Current = Cursors.WaitCursor;
     Application.DoEvents();
     lblError.Visible = false;
     _AccountInfo.UserName = txtUserName.Text;
     _AccountInfo.Password = txtPassword.Text;
     _AccountInfo.ServerURL = Yedda.Servers.ServerList[(string)cmbServers.SelectedItem];
     //_AccountInfo.Enabled = (_AccountInfo.ServerURL.ServerType != Yedda.Twitter.TwitterServer.pingfm && _AccountInfo.ServerURL.ServerType != Yedda.Twitter.TwitterServer.brightkite);
     _AccountInfo.Enabled = true;
     _AccountInfo.IsDefault = chkDefault.Checked;
     Yedda.Twitter T = new Yedda.Twitter();
     T.AccountInfo = _AccountInfo;
     Cursor.Current = Cursors.Default;
     
     if (!T.Verify())
     {
         lblError.Text = "Invalid credentials.";
         lblError.Visible = true;
         return;
     }
     this.DialogResult = DialogResult.OK;
 }
Ejemplo n.º 4
0
 private void linkLabel1_Click(object sender, EventArgs e)
 {
     Yedda.Twitter Twitter = new Yedda.Twitter();
     using (PostUpdate s = new PostUpdate(false))
     {
         s.StatusText = "@PockeTwitDev ";
         s.ShowDialog();
         s.Hide();
         string UpdateText = s.StatusText;
         if (s.DialogResult == DialogResult.OK)
         {
             Cursor.Current = Cursors.WaitCursor;
             Twitter.AccountInfo = s.AccountToSet;
             Twitter.Update(UpdateText, Yedda.Twitter.OutputFormatType.XML);
             Cursor.Current = Cursors.Default;
         }
         this.Show();
         s.Close();
     }
 }
Ejemplo n.º 5
0
        private void ResetDictionaries()
        {
            FollowingDictionary.Clear();
            TwitterConnections.Clear();
            foreach (Yedda.Twitter.Account a in ClientSettings.AccountsList)
            {
                Yedda.Twitter TwitterConn = new Yedda.Twitter();
                TwitterConn.AccountInfo.ServerURL = a.ServerURL;
                TwitterConn.AccountInfo.UserName = a.UserName;
                TwitterConn.AccountInfo.Password = a.Password;
                TwitterConn.AccountInfo.Enabled = a.Enabled;
                TwitterConnections.Add(TwitterConn);
                Following f = new Following(TwitterConn);
                FollowingDictionary.Add(TwitterConn, f);
            }
            SetConnectedMenus();
            Manager = new TimelineManagement();
            Manager.Progress += new TimelineManagement.delProgress(Manager_Progress);
            Manager.CompleteLoaded += new TimelineManagement.delComplete(Manager_CompleteLoaded);
            Manager.Startup(TwitterConnections);
            Manager.FriendsUpdated += new TimelineManagement.delFriendsUpdated(Manager_FriendsUpdated);
            Manager.MessagesUpdated += new TimelineManagement.delMessagesUpdated(Manager_MessagesUpdated);

            foreach (Following f in FollowingDictionary.Values)
            {
                f.LoadFromTwitter();
            }
        }