def send_buffer(self, senders, subject, receivers, editor_result): """ This function is called by the line editor when its work is complete. """ # If we're not quitting, we're not doing anything. if not editor_result['quitting']: self.caller.msg('Saving a draft is not yet supported. Use :wq to send the message, or :q! to abort.') return False # If you're typing out a really long mail, you may have annoyed someone in the interim. body = editor_result['buffer'] receivers = check_ignores(self.caller, receivers) if not receivers: self.caller.msg('No valid recipients found!') return False sent, status = send_message(senders, subject, body, receivers, send_email=True) return self.benediction(sent, status)
def main_handler(self): """ Handles arguments if there are no switches. Intended to do the 'most obvious' action for different arguments. """ MESSAGE = 0 READ = 2 if not self.rhs and not self.lhs: self.list_mail() return if self.lhs and not self.rhs: try: choice = int(self.lhs) except ValueError: self.caller.msg("'%s' is not a mail message number. Did you mean to send a message to '%s'? If so, try: mail %s=Your message here." % \ (self.lhs, self.lhs, self.lhs)) return try: # Display numbers are offset. message = self.caller.db.mail[choice - 1] self.display_mail(message[MESSAGE]) message[READ] = True return except (TypeError, IndexError): self.caller.msg( 'No such message number. To check your mail, type: mail') return if self.rhs and not self.lhs: self.caller.msg('You must specify someone to send mail to.') return receivers = validate_targets(self.caller, self.lhslist, local_only=False) if not receivers: self.caller.msg('No valid targets found!') return senders = [self.caller] subject = '( Quickmail )' body = self.rhs sent, status = send_message(senders, subject, body, receivers, send_email=True) self.benediction(sent, status)
def send_buffer(self, senders, subject, receivers, editor_result): """ This function is called by the line editor when its work is complete. """ # If we're not quitting, we're not doing anything. if not editor_result['quitting']: self.caller.msg( 'Saving a draft is not yet supported. Use :wq to send the message, or :q! to abort.' ) return False # If you're typing out a really long mail, you may have annoyed someone in the interim. body = editor_result['buffer'] receivers = check_ignores(self.caller, receivers) if not receivers: caller.msg('No valid recipients found!') return False sent, status = send_message(senders, subject, body, receivers, send_email=True) return self.benediction(sent, status)
def main_handler(self): """ Handles arguments if there are no switches. Intended to do the 'most obvious' action for different arguments. """ MESSAGE = 0 READ = 2 if not self.rhs and not self.lhs: self.list_mail() return if self.lhs and not self.rhs: try: choice = int(self.lhs) except ValueError: self.caller.msg("'%s' is not a mail message number. Did you mean to send a message to '%s'? If so, try: mail %s=Your message here." % \ (self.lhs, self.lhs, self.lhs)) return try: # Display numbers are offset. message = self.caller.db.mail[choice - 1] self.display_mail(message[MESSAGE]) message[READ] = True return except (TypeError, IndexError): self.caller.msg('No such message number. To check your mail, type: mail') return if self.rhs and not self.lhs: self.caller.msg('You must specify someone to send mail to.') return receivers = validate_targets(self.caller, self.lhslist, local_only=False) if not receivers: self.caller.msg('No valid targets found!') return senders = [self.caller] subject = '( Quickmail )' body = self.rhs sent, status = send_message(senders, subject, body, receivers, send_email=True) self.benediction(sent, status)