Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 31 lines (24 sloc) 0.864 kb
8f8d854 @smn adding statics and ensuring the service doesnt get spammed from senders ...
authored
1 from google.appengine.ext import db
b9531d8 @smn splitting stuff
authored
2 from google.appengine.ext.webapp import xmpp_handlers
59d6317 @smn switching to http instead of xmpp
authored
3 from models import Message
8f8d854 @smn adding statics and ensuring the service doesnt get spammed from senders ...
authored
4 import logging
5
6 """
7 Sample json received via XMPP:
8
9 {
10 "nickname": "sdehaan",
11 "server": "irc.freenode.net",
12 "channel": "#vumi",
13 "message_type": "message",
14 "message_content": "testing app engine",
15 "timestamp": "2011-05-16T08:17:53.749184"
16 }
17
18 """
b9531d8 @smn splitting stuff
authored
19
20 class XmppHandler(xmpp_handlers.CommandHandler):
21 def text_message(self, message=None):
8f8d854 @smn adding statics and ensuring the service doesnt get spammed from senders ...
authored
22 im_from = db.IM("xmpp", message.sender)
23
24 # only accept from XMPP messages from our domain
59d6317 @smn switching to http instead of xmpp
authored
25 if '@praekeltfoundation.org' not in im_from.address:
ce0c9d6 @smn upping the logging
authored
26 logging.info("Rejecting %s from %s" % (message.body, im_from.address))
8f8d854 @smn adding statics and ensuring the service doesnt get spammed from senders ...
authored
27 return
28
59d6317 @smn switching to http instead of xmpp
authored
29 msg = Message.log(message.body)
30 logging.info('Wrote %s %s' % ("Message", msg.key()))
Something went wrong with that request. Please try again.