'Execute all the rule\'s actions against the item.'

def perform_actions(self, item, data):

    for (key, target) in self.targets.iteritems():
        target_item = self.get_target_item(item, data, key)
        target.perform_actions(target_item, data)
    if self.comment:
        comment = self.build_message(self.comment, item, data, disclaimer=True)
        if isinstance(item, Comment):
            link = data['link']
            parent_comment = item
        else:
            link = item
            parent_comment = None
        (new_comment, inbox_rel) = Comment._new(ACCOUNT, link, parent_comment, comment, None)
        new_comment.distinguished = 'yes'
        new_comment.sendreplies = False
        new_comment._commit()
        if (isinstance(item, Link) and (not inbox_rel)):
            inbox_rel = Inbox._add(data['author'], new_comment, 'selfreply')
        queries.new_comment(new_comment, inbox_rel)
        if self.comment_stickied:
            try:
                link.set_sticky_comment(new_comment, set_by=ACCOUNT)
            except RedditError:
                pass
        g.stats.simple_event('automoderator.comment')
    if self.modmail:
        message = self.build_message(self.modmail, item, data, permalink=True)
        subject = replace_placeholders(self.modmail_subject, data, self.matches)
        subject = subject[:100]
        (new_message, inbox_rel) = Message._new(ACCOUNT, data['subreddit'], subject, message, None)
        new_message.distinguished = 'yes'
        new_message._commit()
        queries.new_message(new_message, inbox_rel)
        g.stats.simple_event('automoderator.modmail')
    if (self.message and (not data['author']._deleted)):
        message = self.build_message(self.message, item, data, disclaimer=True, permalink=True)
        subject = replace_placeholders(self.message_subject, data, self.matches)
        subject = subject[:100]
        (new_message, inbox_rel) = Message._new(ACCOUNT, data['author'], subject, message, None)
        queries.new_message(new_message, inbox_rel)
        g.stats.simple_event('automoderator.message')
    PerformedRulesByThing.mark_performed(item, self)
