From 9f5b78fb522145172419bb69b5f4c3dfa970079c Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Thu, 26 May 2011 15:06:49 +0800 Subject: [PATCH] =?utf8?q?=E6=B7=BB=E5=8A=A0=E9=94=99=E8=AF=AF=E6=97=A5?= =?utf8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- chatmain.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/chatmain.py b/chatmain.py index 7350915..130d7c2 100755 --- a/chatmain.py +++ b/chatmain.py @@ -50,9 +50,17 @@ class XMPPAvail(webapp.RequestHandler): status = self.request.get('status') show = self.request.get('show') logging.debug(u'%s ηš„ηŠΆζ€: %s (%s)' % (jid, status, show)) - show = lilytalk.STATUS_CODE[show] - xmpp.send_presence(self.request.get('from'), - status=lilytalk.notice) + try: + show = lilytalk.STATUS_CODE[show] + except KeyError: + logging.error('%s has sent an incorrect show code %s' % (jid, show)) + return + try: + xmpp.send_presence(self.request.get('from'), + status=lilytalk.notice) + except xmpp.Error: + logging.error('Error while sending presence to %s' % jid) + return u = lilytalk.get_user_by_jid(jid) if u is not None: modified = False -- 2.11.4.GIT