def process_incoming(self, subject, body, sender, to):
        to = to[0].split('.')
        participant = util.modified_b64decode(to[0])
        wave_id = util.modified_b64decode(to[1])
        wavelet_id = util.modified_b64decode(to[2])
        blip_id = util.modified_b64decode(to[3])

        q = model.ParticipantPreferences.all()
        q.filter('participant =', participant)
        q.filter('email =', sender)
        if not q.get():
            error = 'Invalid email %s not registered to %s' % (sender,
                                                               participant)
            logging.info(error)
            mail.send_mail('Notifiy <%s>' % constants.ROBOT_EMAIL, sender,
                           subject,
                           templates.ERROR_BODY % (subject, error, body))
            return

        logging.debug(
            'incoming email from %s [participant=%s, wave_id=%s, ' +
            'wavelet_id=%s, blip_id=%s]: %s', sender, participant, wave_id,
            wavelet_id, blip_id, body)

        util.reply_wavelet(wave_id, wavelet_id, blip_id, participant,
                           util.process_body(body))
    def reply(self):
        participant = self.request.get('participant')
        wave_id = self.request.get('wave_id')
        wavelet_id = self.request.get('wavelet_id')
        blip_id = self.request.get('blip_id')
        message = self.request.get('message')

        logging.debug('incoming reply from phone [participant=%s, wave_id=%s,' +
                      'wavelet_id=%s, blip_id=%s]: %s', participant, wave_id,
                      wavelet_id, blip_id, message)

        util.reply_wavelet(wave_id, wavelet_id, blip_id, participant, message)
    def reply(self):
        participant = self.request.get('participant')
        wave_id = self.request.get('wave_id')
        wavelet_id = self.request.get('wavelet_id')
        blip_id = self.request.get('blip_id')
        message = self.request.get('message')

        logging.debug(
            'incoming reply from phone [participant=%s, wave_id=%s,' +
            'wavelet_id=%s, blip_id=%s]: %s', participant, wave_id, wavelet_id,
            blip_id, message)

        util.reply_wavelet(wave_id, wavelet_id, blip_id, participant, message)
    def process_incoming(self, subject, body, sender, to):
        to = to[0].split('.')
        participant = util.modified_b64decode(to[0])
        wave_id = util.modified_b64decode(to[1])
        wavelet_id = util.modified_b64decode(to[2])
        blip_id = util.modified_b64decode(to[3])

        q = model.ParticipantPreferences.all()
        q.filter('participant =', participant)
        q.filter('email =', sender)
        if not q.get():
            error = 'Invalid email %s not registered to %s' % (sender, participant)
            logging.info(error)
            mail.send_mail('Notifiy <%s>' % constants.ROBOT_EMAIL, sender,
                           subject, templates.ERROR_BODY % (subject, error, body))
            return

        logging.debug('incoming email from %s [participant=%s, wave_id=%s, ' +
                      'wavelet_id=%s, blip_id=%s]: %s', sender, participant,
                      wave_id, wavelet_id, blip_id, body)

        util.reply_wavelet(wave_id, wavelet_id, blip_id, participant,
                           util.process_body(body))