|
|
@ -172,16 +172,19 @@ class Networks(object): |
|
|
|
|
|
|
|
|
|
|
|
def reply_prefix(self, message): |
|
|
|
def reply_prefix(self, message): |
|
|
|
"""Return the prefix to be used in the reply for that message.""" |
|
|
|
"""Return the prefix to be used in the reply for that message.""" |
|
|
|
|
|
|
|
assert(isinstance(message, NetworkData)) |
|
|
|
return self.networks[message.network].reply_prefix(message) |
|
|
|
return self.networks[message.network].reply_prefix(message) |
|
|
|
|
|
|
|
|
|
|
|
def repost(self, message): |
|
|
|
def repost(self, message): |
|
|
|
"""Repost a message in the user's timeline. The network used is |
|
|
|
"""Repost a message in the user's timeline. The network used is |
|
|
|
the same in the message.""" |
|
|
|
the same in the message.""" |
|
|
|
|
|
|
|
assert(isinstance(message, NetworkData)) |
|
|
|
self.networks[message.network].repost(message) |
|
|
|
self.networks[message.network].repost(message) |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
def favourite(self, message): |
|
|
|
def favourite(self, message): |
|
|
|
"""Change the favourite status of the message.""" |
|
|
|
"""Change the favourite status of the message.""" |
|
|
|
|
|
|
|
assert(isinstance(message, NetworkData)) |
|
|
|
self.networks[message.network].favourite(message) |
|
|
|
self.networks[message.network].favourite(message) |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
@ -208,6 +211,7 @@ class Networks(object): |
|
|
|
|
|
|
|
|
|
|
|
def link(self, message): |
|
|
|
def link(self, message): |
|
|
|
"""Returns a link directly to the message.""" |
|
|
|
"""Returns a link directly to the message.""" |
|
|
|
|
|
|
|
assert(isinstance(message, NetworkData)) |
|
|
|
return self.networks[message.network].link(message) |
|
|
|
return self.networks[message.network].link(message) |
|
|
|
|
|
|
|
|
|
|
|
def replies(self, network=None): |
|
|
|
def replies(self, network=None): |
|
|
@ -231,21 +235,23 @@ class Networks(object): |
|
|
|
|
|
|
|
|
|
|
|
def can_delete(self, message): |
|
|
|
def can_delete(self, message): |
|
|
|
"""Return True if the message can be deleted; False otherwise.""" |
|
|
|
"""Return True if the message can be deleted; False otherwise.""" |
|
|
|
|
|
|
|
assert(isinstance(message, NetworkData)) |
|
|
|
return self.networks[message.network].can_delete(message) |
|
|
|
return self.networks[message.network].can_delete(message) |
|
|
|
|
|
|
|
|
|
|
|
def can_reply(self, message): |
|
|
|
def can_reply(self, message): |
|
|
|
"""Return True if the message can be replied; False otherwise.""" |
|
|
|
"""Return True if the message can be replied; False otherwise.""" |
|
|
|
|
|
|
|
assert(isinstance(message, NetworkData)) |
|
|
|
return self.networks[message.network].can_reply(message) |
|
|
|
return self.networks[message.network].can_reply(message) |
|
|
|
|
|
|
|
|
|
|
|
def can_repost(self, message): |
|
|
|
def can_repost(self, message): |
|
|
|
"""Return True if the message can be resposted; False otherwise.""" |
|
|
|
"""Return True if the message can be resposted; False otherwise.""" |
|
|
|
|
|
|
|
assert(isinstance(message, NetworkData)) |
|
|
|
return self.networks[message.network].can_repost(message) |
|
|
|
return self.networks[message.network].can_repost(message) |
|
|
|
|
|
|
|
|
|
|
|
def can_favourite(self, message): |
|
|
|
def can_favourite(self, message): |
|
|
|
"""Return True if the message can be favourited/unfavourited; False |
|
|
|
"""Return True if the message can be favourited/unfavourited; False |
|
|
|
otherwise.""" |
|
|
|
otherwise.""" |
|
|
|
|
|
|
|
assert(isinstance(message, NetworkData)) |
|
|
|
return self.networks[message.network].can_favourite(message) |
|
|
|
return self.networks[message.network].can_favourite(message) |
|
|
|
|
|
|
|
|
|
|
|
# TODO: Function to return a regexp for usernames |
|
|
|
# TODO: Function to return a regexp for usernames |
|
|
|
# TODO: Function to return a pre-message for replies (how to handle |
|
|
|
|
|
|
|
# dynamic content, like usernames?) |
|
|
|
|
|
|
|