If you port it to web2py, then you don't need to wrap their handler,
unless I am misunderstanding.

All that has to built a web2py controller function that can receive
POST requests at:

/_ah/xmpp/message/chat/

The POST data is this:
    *  from, the address of the sender of the message
    * to, the address of the recipient as described by the sender (see
below)
    * body, the body of the message
    * stanza, the full XMPP message in its original XML form

The IMProperty does not need to used, and it can just be a string.

Once XMPP is enabled, Google will POST messages to web2py at /_ah/xmpp/
message/chat/.

Google's xmpp_handlers.CommandHandler is not needed for web2py, but
some of the XML parser could be reused.

Robin



On Sep 23, 4:11 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> I agree. Most of what the rest of the code does should be easy to port
> to web2py. But I need to understand how to wrap the handler so that I
> can be called from a controller function. We could make a wsgi_adaptor
> inside the controller but there has to be a better way.
>
> On Sep 23, 3:57 pm, Robin B <robi...@gmail.com> wrote:
>
> > Yes,
>
> > I believe the url  ('/_ah/xmpp/message/chat/') is significant
>
> > what about:
>
> > app='_ah'
> > controller='xmpp'
> > action='message'
>
> > then handle the rest as args and call other controller functions?
>
> > Robin
>
> > On Sep 23, 2:57 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > Then it should be possible to rewrite the entire example as a web2py
> > > application. Is there specific significance it the URL names ('/_ah/
> > > xmpp/message/chat/') used in the example? Because preserving those
> > > would require roots.
>
> > > Massimo
>
> > > On Sep 23, 2:25 pm, Robin B <robi...@gmail.com> wrote:
>
> > > > looks like a string property that validates as an instant messaging
> > > > handle.
>
> > > >http://ru.ly/Nb
>
> > > > class IM(object):
> > > >   """An instant messaging handle. Includes both an address and its
> > > > protocol.
> > > >   The protocol value is either a standard IM scheme or a URL
> > > > identifying the
> > > >   IM network for the protocol. Possible values include:
>
> > > >     Value                           Description
> > > >     sip                             SIP/SIMPLE
> > > >     unknown                         Unknown or unspecified
> > > >     xmpp                            XMPP/Jabber
> > > >    http://aim.com/               AIM
> > > >    http://icq.com/               ICQ
> > > >    http://talk.google.com/       Google Talk
> > > >    http://messenger.msn.com/     MSN Messenger
> > > >    http://messenger.yahoo.com/   Yahoo Messenger
> > > >    http://sametime.com/          Lotus Sametime
> > > >    http://gadu-gadu.pl/          Gadu-Gadu
>
> > > >   This is the gd:im element. In XML output, the address and protocol
> > > > are
> > > >   provided as the address and protocol attributes, respectively. See:
> > > >  http://code.google.com/apis/gdata/common-elements.html#gdIm
>
> > > >   Serializes to '<protocol> <address>'. Raises BadValueError if tag is
> > > > not a
> > > >   standard IM scheme or a URL.
> > > >   """
>
> > > > Robin
>
> > > > On Sep 23, 8:01 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > What's a IM field?
>
> > > > > On Sep 22, 10:13 pm, Robin B <robi...@gmail.com> wrote:
>
> > > > > > You can edit app.yaml to dispatch requests to those xmpp handlers
> > > > > > based on prefix (/_ah/*), and let web2py handle everything that's 
> > > > > > left
> > > > > > (/*)
>
> > > > > > Or you can rewrite those handlers as web2py controller/functions and
> > > > > > use routes.py to map the specific urls to app/controller/function
>
> > > > > > Robin
>
> > > > > > On Sep 22, 5:44 pm, murray3 <ch...@murraypost.net> wrote:
>
> > > > > > > I am interested in the way we can convert GAE sample web apps to
> > > > > > > web2py, in particular the xmpp tutorial 
> > > > > > > :http://code.google.com/appengine/articles/using_xmpp.html
>
> > > > > > > Seems straight forward to import the modules etc.
>
> > > > > > > How should the following be ported to web2py to handle the xmpp 
> > > > > > > stuff?
> > > > > > > def main():
> > > > > > >   app = webapp.WSGIApplication([
> > > > > > >       ('/', LatestHandler),
> > > > > > >       ('/_ah/xmpp/message/chat/', XmppHandler),
> > > > > > >       ], debug=True)
> > > > > > >   wsgiref.handlers.CGIHandler().run(app)
>
> > > > > > > the tutorial states the following:
>
> > > > > > > " There's one last thing we need to do to get this all working, of
> > > > > > > course - hook it up to the serving infrastructure so it can serve
> > > > > > > requests. Fortunately, a CommandHandler is a standard webapp
> > > > > > > RequestHandler subclass, so we can set it up as we would any other
> > > > > > > handler. Modify the lines where the application variable is 
> > > > > > > defined to
> > > > > > > read like this:
>
> > > > > > > application = webapp.WSGIApplication([
> > > > > > >     ('/_ah/xmpp/message/chat/', XmppHandler)], debug=True)
>
> > > > > > > The URL path here - /_ah/xmpp/message/chat - is a 'reserved' one 
> > > > > > > that
> > > > > > > all XMPP messages get sent to. "
>
> > > > > > > any pointers to get me started.
> > > > > > > regards
> > > > > > > chrism
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to