def new_link(link):
 sr = Subreddit._byID(link.sr_id)
 author = Account._byID(link.author_id)
 results = [get_links(sr, 'new', 'all')]
 results.append(get_submitted(author, 'new', 'all'))
 for domain in utils.UrlParser(link.url).domain_permutations():
  results.append(get_domain_links(domain, 'new', 'all'))
 with CachedQueryMutator() as m:
  if link._spam:
   m.insert(get_spam_links(sr), [link])
  if (not (sr.exclude_banned_modqueue and author._spam)):
   m.insert(get_unmoderated_links(sr), [link])
 add_queries(results, insert_items=link)
 amqp.add_item('new_link', link._fullname)

def new_link ( link ) : sr = Subreddit . _byID ( link . sr_id ) author = Account . _byID ( link . author_id ) results = [ get_links ( sr , 'new' , 'all' ) ] results . append ( get_submitted ( author , 'new' , 'all' ) ) for domain in utils . UrlParser ( link . url ) . domain_permutations ( ) : results . append ( get_domain_links ( domain , 'new' , 'all' ) ) with CachedQueryMutator ( ) as m : if link . _spam : m . insert ( get_spam_links ( sr ) , [ link ] ) if ( not ( sr . exclude_banned_modqueue and author . _spam ) ) : m . insert ( get_unmoderated_links ( sr ) , [ link ] ) add_queries ( results , insert_items = link ) amqp . add_item ( 'new_link' , link . _fullname )
called on the submission and deletion of links .