Browse Source

Store and display the owner of the parent message in a reply. Closes #174

master
Julio Biason 15 years ago
parent
commit
1e5026773f
  1. 31
      mitterlib/network/networkbase.py
  2. 1
      mitterlib/network/twitter.py
  3. 14
      mitterlib/ui/ui_pygtk.py

31
mitterlib/network/networkbase.py

@ -107,31 +107,36 @@ class MessageTooLongWarning(NetworkWarning):
class NetworkData(object):
"""Provides an uniform way to access information about posts. The
following fields should appear:
following fields should appear[*]_ [*]_:
**id**
The message identification.
The message identification. *Optional*
**name**
The name to be displayed as author of the message.
The name to be displayed as author of the message. *Required*
**username**
The message author username in the network.
The message author username in the network. *Required*
**avatar**
URL to the author avatar.
URL to the author avatar. *Optional*
**message**
The message.
The message. *Required*
**message_time**
Message timestamp (as a datetime object). Defaults to None.
Message timestamp (as a datetime object). Defaults to None. *Optional*
**favourite**
Boolean indicating if the message was marked as "favourite" or not.
*Optional*
**parent**
The parent of this message, in case of a reply.
The parent of this message, in case of a reply. *Optional*
**parent_owner**
Username of the owner of the parent message (in other words, "in reply
to".) *Optional*
**reposted_by**
Username friend of the current user that reposted that message. Some
@ -139,12 +144,17 @@ class NetworkData(object):
in this case, returns the original message with the original user
in a "retweeted_status" structure.) In this case, the network layer
will must return the original user in *name*, *username* and *avatar*,
while the friend username will be moved to *reposted_by*.
while the friend username will be moved to *reposted_by*. *Optional*
**network**
The network id source of the message. Network classes don't need to
worry about this field themselves; :class:`Networks` will set it when
merging information from all networks.
merging information from all networks. *Networks should **NEVER** fill
this field*
.. [*] Not all fields need to be filled if that would require more than
one network call.
.. [*] Most networks need to be ready for some fields to not be filled.
"""
def __init__(self):
@ -156,6 +166,7 @@ class NetworkData(object):
self.message_time = None
self.favourite = False
self.parent = ''
self.parent_owner = ''
self.reposted_by = ''
self.network = ''

1
mitterlib/network/twitter.py

@ -179,6 +179,7 @@ class TwitterNetworkData(NetworkData):
if 'in_reply_to_status_id' in data and data['in_reply_to_status_id']:
self.parent = int(data['in_reply_to_status_id'])
self.parent_owner = data['in_reply_to_screen_name']
if 'retweeted_status' in data:
self.reposted_by = self.username

14
mitterlib/ui/ui_pygtk.py

@ -604,14 +604,18 @@ class Interface(object):
else:
favourite = '☆'
info = []
if data.reposted_by:
reposted_message = ' &#8212; <i>reposted by %s</i>' % (
data.reposted_by)
else:
reposted_message = ''
info.append(' &#8212; <i>reposted by %s</i>' % (data.reposted_by))
if data.parent_owner:
info.append(' &#8212; <i>in reply to %s</i>' %
(data.parent_owner))
info_message = ''.join(info)
markup = MESSAGE_FORMAT % (favourite, full_name, username,
reposted_message, read_status, message, time)
info_message, read_status, message, time)
cell.set_property('markup', markup)

Loading…
Cancel
Save