Browse Source

support for user, groups and hashtags regexps

master
Julio Biason 15 years ago
parent
commit
e72faecf9c
  1. 15
      mitterlib/network/networkbase.py
  2. 6
      mitterlib/network/twitter.py

15
mitterlib/network/networkbase.py

@ -239,6 +239,21 @@ class NetworkData(object):
self.reply_prefix = ''
"""Prefix to be used in messages when replying to this message."""
self.user_regexp = None
"""Regular expression used to identify usernames in the message. If
the network doesn't support an easy way to identify usernames, it
should be set to None."""
self.group_regexp = None
"""Regular expression used to identify groups in the message. If the
network doesn't support groups or doesn't have an easy way to
identify groups, it should be set to None."""
self.tag_regexps = None
"""Regular expression used to identify tags (hashtags) in the
message. If the network doesn't support tags or doesn't have an easy
way to identify groups, it should be set no None."""
self.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

6
mitterlib/network/twitter.py

@ -171,6 +171,12 @@ class TwitterNetworkData(NetworkData):
# them if it becomes a problem.
self.message = _unhtml(data['text'])
# regular expression for users
self.user_regexp = r'@[a-zA-Z0-9_]'
# regular expression for hashtags
self.tag_regexp = r'#[a-zA-Z0-9_]'
return

Loading…
Cancel
Save