Beispiel #1
0
        // ------------------------------

        public static TwitterItem retweetItem(AccountTwitter account, TwitterItem item)
        {
            try
            {
                RetweetOptions options = new TweetSharp.RetweetOptions();
                if (item.RetweetedItem != null)
                {
                    options.Id = Convert.ToInt64(item.RetweetedItem.Id);
                }
                else
                {
                    options.Id = Convert.ToInt64(item.Id);
                }


                TwitterStatus retweet = account.twitterService.Retweet(options);

                if (retweet != null)
                {
                    item.isRetweetedByMe = true;
                }
                else
                {
                    System.Windows.MessageBox.Show("Retweet failed", "Unknown error");
                }
                return(item);
            }
            catch (Exception exp)
            {
                System.Windows.MessageBox.Show("Retweet failed", exp.Message);
                return(null);
            }
        }
		public virtual void Retweet(RetweetOptions options, Action<TwitterStatus, TwitterResponse> action)
		{
			var id = options.Id;
			var trim_user = options.TrimUser;
			
			WithHammock(WebMethod.Post, action, "statuses/retweet/{id}", FormatAsString, "?id=", id, "&trim_user=", trim_user);
		}
		public virtual IAsyncResult BeginRetweet(RetweetOptions options)
		{
			var id = options.Id;
			var trim_user = options.TrimUser;
				

			return BeginWithHammock<TwitterStatus>(WebMethod.Post, "statuses/retweet/{id}", FormatAsString, "?id=", id, "&trim_user=", trim_user);
		}
		public virtual Task<TwitterResponse<TwitterStatus>> RetweetAsync(RetweetOptions options)
		{
			var id = options.Id;
			var trim_user = options.TrimUser;
				
			
			return ExecuteRequest<TwitterStatus>(HttpMethod.Post, "statuses/retweet/{id}", FormatAsString, "?id=", id, "&trim_user=", trim_user);
		}
		public virtual Task<TwitterAsyncResult<TwitterStatus>> RetweetAsync(RetweetOptions options)
		{
			var id = options.Id;
			var trim_user = options.TrimUser;
			
			return WithHammockTask<TwitterStatus>(_client, WebMethod.Post, "statuses/retweet/{id}", FormatAsString, "?id=", id, "&trim_user=", trim_user);
		}
Beispiel #6
0
        /// <summary>
        /// Retweets a specified tweet
        /// </summary>
        private void Retweet(string command)
        {
            if (User.IsMissingArgs(command) == false) /* It's just an exception catching method, don't mind it */
            {
                if (command.Split(' ')[1].Length != 2)
                {
                    ScreenDraw.ShowMessage("Wrong syntax. Use /rt [id]");
                }
                else
                {
                    SendTweetOptions replyOpts = TweetIdentification.GetTweetID(command.Split(' ')[1]);
                    RetweetOptions retweetOpts = new RetweetOptions();

                    long tweetID = Convert.ToInt64(replyOpts.InReplyToStatusId);
                    retweetOpts.Id = tweetID;
                    InteractiveTweet tweet = new InteractiveTweet();

                    try
                    {
                        tweet = TweetIdentification.FindTweet(tweetID);
                    }
                    catch (KeyNotFoundException exceptionInfo)
                    {
                        ScreenDraw.ShowMessage(exceptionInfo.Message);
                        return;
                    }

                    if (tweet.IsDirectMessage)
                    {
                        ScreenDraw.ShowMessage("You can't retweet DMs, silly");
                        return;
                    }

                    User.Account.Retweet(retweetOpts);
                    if (User.Account.Response.Error == null)
                    {
                        ScreenDraw.ShowMessage("Retweeted");

                        ScreenDraw redraw = new ScreenDraw();
                        redraw.ShowTimeline();
                    }
                    else
                    {
                        ScreenDraw.ShowMessage(User.Account.Response.Error.Code + ": " + User.Account.Response.Error.Message);
                    }

                }
            }
        }
Beispiel #7
0
        public static void OfficialReTweet(ListViewItem item, ref TwitterModelClass tmc)
        {
            TwitterStatus status = (TwitterStatus)item.Tag;
            if( status.RetweetedStatus == null && TwitterControllerClass.isUserProtected(status.User))
            {
                SystemSounds.Hand.Play();
                return;
            }
            RetweetOptions options = new RetweetOptions();
            options.Id = status.Id;

            tmc.service.Retweet(options);
        }