@@ -0,0 +1,2202 @@
+# -*- coding: utf-8 -*-%0A%0A# -*- coding: utf-8 -*-%0A%0A# Copyright 2014 matrix.org%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A#     http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS,%0A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A# See the License for the specific language governing permissions and%0A# limitations under the License.%0A%0Afrom twisted.web.resource import Resource%0A%0Afrom sydent.http.servlets import jsonwrap, require_args%0Afrom sydent.db.valsession import ThreePidValSessionStore%0Afrom sydent.validators import SessionExpiredException, IncorrectClientSecretException, InvalidSessionIdException,%5C%0A    SessionNotValidatedException%0A%0Aclass GetValidated3pidServlet(Resource):%0A    isLeaf = True%0A%0A    def __init__(self, syd):%0A        self.sydent = syd%0A%0A    @jsonwrap%0A    def render_GET(self, request):%0A        err = require_args(request, ('sid', 'clientSecret'))%0A        if err:%0A            return err%0A%0A        sid = request.args%5B'sid'%5D%5B0%5D%0A        clientSecret = request.args%5B'clientSecret'%5D%5B0%5D%0A%0A        valSessionStore = ThreePidValSessionStore(self.sydent)%0A%0A        noMatchError = %7B'errcode': 'M_NO_VALID_SESSION',%0A                        'error': %22No valid session was found matching that sid and client secret%22%7D%0A%0A        try:%0A            s = valSessionStore.getValidatedSession(sid, clientSecret)%0A        except IncorrectClientSecretException:%0A            return noMatchError%0A        except SessionExpiredException:%0A            return %7B'errcode': 'M_SESSION_EXPIRED',%0A                    'error': %22This validation session has expired: call requestToken again%22%7D%0A        except InvalidSessionIdException:%0A            return noMatchError%0A        except SessionNotValidatedException:%0A            return %7B'errcode': 'M_SESSION_NOT_VALIDATED',%0A                    'error': %22This validation session has not yet been completed%22%7D%0A%0A        return %7B 'medium': s.medium, 'address': s.address, 'validatedAt': s.mtime %7D

Add the file for the new servlet