From f1c974b4cf47464821b93b3f2857590595faeae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Sun, 2 Oct 2016 09:11:02 -0500 Subject: [PATCH] Reply to tweets will always be quotes --- src/controller/buffersController.py | 16 ++++++---------- src/twitter/buffers/indibidual.py | 3 ++- src/twitter/buffers/stream.py | 4 ++-- src/twitter/compose.py | 3 +-- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/controller/buffersController.py b/src/controller/buffersController.py index d364c28c..e4828942 100644 --- a/src/controller/buffersController.py +++ b/src/controller/buffersController.py @@ -534,20 +534,16 @@ class baseBufferController(bufferController): self._retweet_with_comment(tweet, id) 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 != '': retweet.message.set_text(comment) if retweet.message.get_response() == widgetUtils.OK: 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) - else: - return self._retweet_with_comment(tweet, id, comment=comments) + text = text+" https://twitter.com/{0}/status/{1}".format(tweet["user"]["screen_name"], id) 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) else: diff --git a/src/twitter/buffers/indibidual.py b/src/twitter/buffers/indibidual.py index dcc66247..3b931b80 100644 --- a/src/twitter/buffers/indibidual.py +++ b/src/twitter/buffers/indibidual.py @@ -71,7 +71,8 @@ class timelinesStreamer(TwythonStreamer): if "text" in data and utils.is_allowed(data, self.session.settings["twitter"]["ignored_clients"]) == True: if data.has_key("extended_tweet"): 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) # except: # pass diff --git a/src/twitter/buffers/stream.py b/src/twitter/buffers/stream.py index 503c29ad..dd1b7a52 100644 --- a/src/twitter/buffers/stream.py +++ b/src/twitter/buffers/stream.py @@ -137,8 +137,8 @@ class streamer(TwythonStreamer): elif "text" in data and utils.is_allowed(data, self.session.settings["twitter"]["ignored_clients"]) == True: if data.has_key("extended_tweet"): data["full_text"] = data["extended_tweet"]["full_text"] - data["entities"] = data["extended_entities"] - log.error("Extended tweet") + data["entities"] = data["extended_tweet"]["entities"] +# log.error("Extended tweet") if data["user"]["id"] in self.muted_users: return self.check_mentions(data) self.check_send(data) diff --git a/src/twitter/compose.py b/src/twitter/compose.py index 53f94a1d..5dc285dd 100644 --- a/src/twitter/compose.py +++ b/src/twitter/compose.py @@ -40,12 +40,11 @@ def compose_tweet(tweet, db, relative_times): ts = tweet["created_at"] if tweet.has_key("message"): value = "message" - log.error(tweet["message"]) elif tweet.has_key("full_text"): value = "full_text" else: value = "text" - log.exception(tweet.keys()) +# log.exception(tweet.keys()) text = StripChars(tweet[value]) user = tweet["user"]["name"] source = re.sub(r"(?s)<.*?>", "", tweet["source"])