示例#1
0
 def post(self):
     user  = self.request.get('user')
     phone = self.request.get('phone')
     sender= handle_unicode(self.request.get('sender')) #sender's name
     sms   = handle_unicode(self.request.get('sms'))
     if user:
         user_address = '*****@*****.**' % (user)
         #Store the most recent sender
         incoming = Incoming(key_name=user_address)
         incoming.last_sender = phone   
         incoming.put()    
         # Send the received SMS to GTalk
         chat_message_sent = False
         if xmpp.get_presence(user_address):
             msg = "%s : %s" % (sender,sms)
             status_code = xmpp.send_message(user_address, msg)
             chat_message_sent = (status_code != xmpp.NO_ERROR)
         logging.debug(chat_message_sent) 
示例#2
0
 def post(self):
     user = self.request.get('user')
     phone = self.request.get('phone')
     sender = handle_unicode(self.request.get('sender'))  #sender's name
     sms = handle_unicode(self.request.get('sms'))
     if user:
         user_address = '*****@*****.**' % (user)
         #Store the most recent sender
         incoming = Incoming(key_name=user_address)
         incoming.last_sender = phone
         incoming.put()
         # Send the received SMS to GTalk
         chat_message_sent = False
         if xmpp.get_presence(user_address):
             msg = "%s : %s" % (sender, sms)
             status_code = xmpp.send_message(user_address, msg)
             chat_message_sent = (status_code != xmpp.NO_ERROR)
         logging.debug(chat_message_sent)
示例#3
0
 def text_message(self, message):
     #Get sender's email
     idx = message.sender.index('/')
     email = message.sender[0:idx]
     #Get the latest sender's phone number
     incoming = Incoming.get_by_key_name(email)
     sender = incoming.last_sender  #sender's phone number - number
     sms = handle_unicode(message.arg)
     data = {"data.sms": sms, "data.phone_number": sender}
     sendToPhone(self, data, email)
示例#4
0
 def text_message(self, message):
     #Get sender's email
     idx   = message.sender.index('/')
     email = message.sender[0:idx]
     #Get the latest sender's phone number
     incoming = Incoming.get_by_key_name(email)
     sender   = incoming.last_sender #sender's phone number - number
     sms      = handle_unicode(message.arg)
     data = {"data.sms" : sms,
             "data.phone_number" : sender}
     sendToPhone(self, data, email)