def START(message, list_name=None, host=None, bad_list=None): if bad_list: if '-' in bad_list: # probably put a '.' in it, try to find a similar list similar_lists = mailinglist.similar_named_lists(bad_list.replace('-','.')) else: similar_lists = mailinglist.similar_named_lists(bad_list) help = view.respond(locals(), "mail/bad_list_name.msg", From="noreply@%(host)s", To=message['from'], Subject="That's not a valid list name.") relay.deliver(help) return START elif list_name in INVALID_LISTS or message['from'].endswith(host): logging.debug("LOOP MESSAGE to %r from %r.", message['to'], message['from']) return START elif mailinglist.find_list(list_name): action = "subscribe to" CONFIRM.send(relay, list_name, message, 'mail/confirmation.msg', locals()) return CONFIRMING_SUBSCRIBE else: similar_lists = mailinglist.similar_named_lists(list_name) CONFIRM.send(relay, list_name, message, 'mail/create_confirmation.msg', locals()) return CONFIRMING_SUBSCRIBE
def START(message, list_name=None, host=None, bad_list=None): if bad_list: if '-' in bad_list: # probably put a '.' in it, try to find a similar list similar_lists = mailinglist.similar_named_lists( bad_list.replace('-', '.')) else: similar_lists = mailinglist.similar_named_lists(bad_list) help = view.respond(locals(), "mail/bad_list_name.msg", From="noreply@%(host)s", To=message['from'], Subject="That's not a valid list name.") relay.deliver(help) return START elif list_name in INVALID_LISTS or message['from'].endswith(host): logging.debug("LOOP MESSAGE to %r from %r.", message['to'], message['from']) return START elif mailinglist.find_list(list_name): action = "subscribe to" CONFIRM.send(relay, list_name, message, 'mail/confirmation.msg', locals()) return CONFIRMING_SUBSCRIBE else: similar_lists = mailinglist.similar_named_lists(list_name) CONFIRM.send(relay, list_name, message, 'mail/create_confirmation.msg', locals()) return CONFIRMING_SUBSCRIBE
def START(message, user_id=None, host=None): if user_id: market_anon = addressing.mapping(message['from'], 'marketroid', host) reply = filter.cleanse_incoming(message, user_id, host, market_anon) relay.deliver(reply) return DEMARKETING else: CONFIRM.send(relay, "start", message, "mail/start_confirm.msg", locals()) return CONFIRMING
def POSTING(message, list_name=None, action=None, host=None): if action == 'unsubscribe': action = "unsubscribe from" CONFIRM.send(relay, list_name, message, 'mail/confirmation.msg', locals()) return CONFIRMING_UNSUBSCRIBE else: mailinglist.post_message(relay, message, list_name, host) # archive makes sure it gets cleaned up before archival final_msg = mailinglist.craft_response(message, list_name, list_name + '@' + host) archive.enqueue(list_name, final_msg) return POSTING
def POSTING(message, group_name=None, action=None, topic=None, host=None): #group_name = group_name.lower() if group_name else None #action = action.lower() if action else None host = host.lower() if host else None if topic == 'unsubscribe': topic = "unsubscribe from" CONFIRM.send(relay, group_name, message, 'mail/confirmation.msg', locals()) return CONFIRMING_UNSUBSCRIBE else: mailinglist.post_message(relay, message, group_name, host) # archive makes sure it gets cleaned up before archival final_msg = mailinglist.craft_response(message, group_name, group_name + '@' + host) archive.enqueue(group_name, final_msg) # TODO: Save message in DB? # TODO: if topic: Link message to topic, attach message attachments to topic return POSTING
def START(message, group_name=None, topic=None, host=None, bad_list=None): #group_name = group_name.lower() if group_name else None #bad_list = bad_list.lower() if bad_list else None host = host.lower() if host else None logging.debug("Group name: "+group_name) if bad_list: help = view.respond(locals(), "mail/bad_list_name.msg", From="noreply@%(host)s", To=message['from'], Subject="That's not a valid list name.") relay.deliver(help) return START elif group_name in INVALID_LISTS or message.route_from.endswith(host): logging.debug("LOOP MESSAGE to %r from %r.", message['to'], message.route_from) return START group = mailinglist.find_group(group_name) if group: action = "subscribe to" activity = group.find_topic(topic) if topic else None # TODO: put activity and topic in message template CONFIRM.send(relay, group_name, message, 'mail/confirmation.msg', locals()) return CONFIRMING_SUBSCRIBE else: similar_groups = mailinglist.similar_named_groups(group_name) CONFIRM.send(relay, group_name, message, 'mail/create_confirmation.msg', locals()) return CONFIRMING_SUBSCRIBE
def BOUNCING(message, host=None): CONFIRM.send(relay, 'unbounce', message, 'mail/unbounce_confirm.msg', locals()) return CONFIRMING_UNBOUNCE
def BOUNCING(message, host=None): CONFIRM.send(relay, "unbounce", message, "mail/unbounce_confirm.msg", locals()) return CONFIRMING_UNBOUNCE
def START(message, post_name=None, host=None): message['X-Post-Name'] = post_name CONFIRM.send(relay, "post", message, "mail/confirm.msg", locals()) return CONFIRMING
def START(message, user_id=None, post_name=None, host=None, domain=None): comment.attach_headers(message, user_id, post_name, domain) CONFIRM.send(relay, "comment", message, "mail/comment_confirm.msg", locals()) return CONFIRMING