Reply to tweets will always be quotes

This commit is contained in:
Manuel Cortez 2016-10-02 09:11:02 -05:00
parent a9f9cb7969
commit f1c974b4cf
4 changed files with 11 additions and 15 deletions

View File

@ -534,20 +534,16 @@ class baseBufferController(bufferController):
self._retweet_with_comment(tweet, id) self._retweet_with_comment(tweet, id)
def _retweet_with_comment(self, tweet, id, comment=''): def _retweet_with_comment(self, tweet, id, comment=''):
retweet = messages.tweet(self.session, _(u"Retweet"), _(u"Add your comment to the tweet"), u"“@%s: %s" % (tweet["user"]["screen_name"], tweet["full_text"]), max=116, messageType="retweet", twishort_enabled=self.session.settings["mysc"]["twishort_enabled"]) if tweet.has_key("full_text"):
comments = tweet["full_text"]
else:
comments = tweet["text"]
retweet = messages.tweet(self.session, _(u"Quote"), _(u"Add your comment to the tweet"), u"“@%s: %s" % (tweet["user"]["screen_name"], comments), max=116, messageType="retweet", twishort_enabled=self.session.settings["mysc"]["twishort_enabled"])
if comment != '': if comment != '':
retweet.message.set_text(comment) retweet.message.set_text(comment)
if retweet.message.get_response() == widgetUtils.OK: if retweet.message.get_response() == widgetUtils.OK:
text = retweet.message.get_text() text = retweet.message.get_text()
comments=text
if len(text+ u"“@%s: %s" % (tweet["user"]["screen_name"], tweet["full_text"])) < 140:
text = text+u"“@%s: %s" % (tweet["user"]["screen_name"], tweet["full_text"])
else:
answer = commonMessageDialogs.retweet_as_link(self.buffer)
if answer == widgetUtils.YES:
text = text+" https://twitter.com/{0}/status/{1}".format(tweet["user"]["screen_name"], id) text = text+" https://twitter.com/{0}/status/{1}".format(tweet["user"]["screen_name"], id)
else:
return self._retweet_with_comment(tweet, id, comment=comments)
if retweet.image == None: if retweet.image == None:
call_threaded(self.session.api_call, call_name="update_status", _sound="retweet_send.ogg", status=text, in_reply_to_status_id=id) call_threaded(self.session.api_call, call_name="update_status", _sound="retweet_send.ogg", status=text, in_reply_to_status_id=id)
else: else:

View File

@ -71,7 +71,8 @@ class timelinesStreamer(TwythonStreamer):
if "text" in data and utils.is_allowed(data, self.session.settings["twitter"]["ignored_clients"]) == True: if "text" in data and utils.is_allowed(data, self.session.settings["twitter"]["ignored_clients"]) == True:
if data.has_key("extended_tweet"): if data.has_key("extended_tweet"):
data["full_text"] = data["extended_tweet"]["full_text"] data["full_text"] = data["extended_tweet"]["full_text"]
data["entities"] = data["extended_entities"] data["entities"] = data["extended_tweet"]["entities"]
# log.error(data["extended_entities"])
self.check_tls(data) self.check_tls(data)
# except: # except:
# pass # pass

View File

@ -137,8 +137,8 @@ class streamer(TwythonStreamer):
elif "text" in data and utils.is_allowed(data, self.session.settings["twitter"]["ignored_clients"]) == True: elif "text" in data and utils.is_allowed(data, self.session.settings["twitter"]["ignored_clients"]) == True:
if data.has_key("extended_tweet"): if data.has_key("extended_tweet"):
data["full_text"] = data["extended_tweet"]["full_text"] data["full_text"] = data["extended_tweet"]["full_text"]
data["entities"] = data["extended_entities"] data["entities"] = data["extended_tweet"]["entities"]
log.error("Extended tweet") # log.error("Extended tweet")
if data["user"]["id"] in self.muted_users: return if data["user"]["id"] in self.muted_users: return
self.check_mentions(data) self.check_mentions(data)
self.check_send(data) self.check_send(data)

View File

@ -40,12 +40,11 @@ def compose_tweet(tweet, db, relative_times):
ts = tweet["created_at"] ts = tweet["created_at"]
if tweet.has_key("message"): if tweet.has_key("message"):
value = "message" value = "message"
log.error(tweet["message"])
elif tweet.has_key("full_text"): elif tweet.has_key("full_text"):
value = "full_text" value = "full_text"
else: else:
value = "text" value = "text"
log.exception(tweet.keys()) # log.exception(tweet.keys())
text = StripChars(tweet[value]) text = StripChars(tweet[value])
user = tweet["user"]["name"] user = tweet["user"]["name"]
source = re.sub(r"(?s)<.*?>", "", tweet["source"]) source = re.sub(r"(?s)<.*?>", "", tweet["source"])