# Path: data_model.py
# class PhoneLog(db.Model):
#   phone       = db.StringProperty()
#   to          = db.StringProperty(multiline=True)
#   date        = db.DateTimeProperty(auto_now_add=True)
#   body        = db.StringProperty(multiline=True,indexed=False)
#   smsID       = db.StringProperty(indexed=False)
#   outboundSMS = db.StringProperty(multiline=True,indexed=False)


import logging
import urllib
import webapp2
import config
from google.appengine.api import memcache
from data_model import PhoneLog



class MainHandler(webapp2.RequestHandler):

  def post(self):
      # this handler should never get called
      logging.error("The MainHandler should never get called... %s" % self.request)
      self.error(204)

  def get(self):
      self.post()

## end MainHandler()

class EventLoggingHandler(webapp2.RequestHandler):
    def post(self):
      # normalize the XMPP requests
      if self.request.get('from').find('@'):
          caller = self.request.get('from').split('/')[0]
      else:
      	  caller = self.request.get('from')
      # log this event...
      logging.debug('logging caller: %s' % caller)

# Path: data_model.py
# class PhoneLog(db.Model):
#   phone       = db.StringProperty()
#   to          = db.StringProperty(multiline=True)
#   date        = db.DateTimeProperty(auto_now_add=True)
#   body        = db.StringProperty(multiline=True,indexed=False)
#   smsID       = db.StringProperty(indexed=False)
#   outboundSMS = db.StringProperty(multiline=True,indexed=False)


# Path: main.py
import logging
import urllib
import webapp2
import config
from google.appengine.api import memcache
from data_model import PhoneLog




class MainHandler(webapp2.RequestHandler):

  def post(self):
      # this handler should never get called
      logging.error("The MainHandler should never get called... %s" % self.request)
      self.error(204)

  def get(self):
      self.post()

## end MainHandler()

class EventLoggingHandler(webapp2.RequestHandler):
    def post(self):
      # normalize the XMPP requests
      if self.request.get('from').find('@'):
          caller = self.request.get('from').split('/')[0]
      else:
      	  caller = self.request.get('from')
      # log this event...
      logging.debug('logging caller: %s' % caller)

      log = PhoneLog()