'Parse Messages directed to the IRS Module
- logging new incidents
- responses to deployment requests'

def parse_ireport(self, message):

    message_body = message.body
    if (not message_body):
        return None
    (lat, lon, code, text) = current.msg.parse_opengeosms(message_body)
    if (code == 'SI'):
        reply = self._create_ireport(lat, lon, text)
    else:
        words = message_body.split('    ')
        text = ''
        reponse = ''
        report_id = None
        comments = False
        for word in words:
            if (('SI#' in word) and (not ireport)):
                report = word.split('#')[1]
                report_id = int(report)
            elif ((soundex(word) == soundex('Yes')) and report_id and (not comments)):
                response = True
                comments = True
            elif ((soundex(word) == soundex('No')) and report_id and (not comments)):
                response = False
                comments = True
            elif comments:
                text += (word + '    ')
        if report_id:
            reply = self._respond_drequest(message, report_id, response, text)
        else:
            reply = None
    return reply
