Browse Source

Reweet command

master
Julio Biason 15 years ago
parent
commit
46bb00498a
  1. 9
      mitterlib/ui/helpers/console_utils.py
  2. 7
      mitterlib/ui/ui_cmd.py
  3. 6
      mitterlib/ui/ui_zork.py

9
mitterlib/ui/helpers/console_utils.py

@ -187,3 +187,12 @@ def print_thread(thread_list, connection):
print_messages(message, connection, show_numbers=False, indent=pos)
pos += 1
return
def make_retweet(message):
"""Creates the text for a reweet."""
if not message.message.lower().startswith('rt @'):
new_message = 'RT @%s: %s' % (message.username, message.message)
else:
# if it is a retweet already, keep the original information
new_message = message.message
return new_message

7
mitterlib/ui/ui_cmd.py

@ -93,12 +93,7 @@ class Interface(cmd.Cmd):
return
original_message = self._messages[pos-1]
if not original_message.message.lower().startswith('rt @'):
new_message = 'RT @%s: %s' % (original_message.username,
original_message.message)
else:
# if it is a retweet already, keep the original information
new_message = original_message.message
new_message = console_utils.make_retweet(original_message)
return self.do_update(new_message)
def do_r(self, line):

6
mitterlib/ui/ui_zork.py

@ -141,6 +141,12 @@ class Interface(cmd.Cmd):
thread = console_utils.fetch_thread(message, self._connection)
console_utils.print_thread(thread, self._connection)
def do_retweet(self, line):
"""Resends the original message to your followers."""
original_message = self._messages[self._cursor]
new_message = console_utils.make_retweet(original_message)
return self.do_say(new_message)
def do_exit(self, line):
"""Quit the application."""
_log.debug('Exiting application')

Loading…
Cancel
Save