#NEWLINE# def auth_in_stage1( self , stanza ) : #NEWLINE# #INDENT# 'Handle the first stage (<iq type=\'get\'/>) of legacy ("plain" or\n        "digest") authentication.\n\n        [server only]' #NEWLINE# self . lock . acquire ( ) #NEWLINE# try : #NEWLINE# #INDENT# if ( ( 'plain' not in self . auth_methods ) and ( 'digest' not in self . auth_methods ) ) : #NEWLINE# #INDENT# iq = stanza . make_error_response ( 'not-allowed' ) #NEWLINE# self . send ( q ) #NEWLINE# return #NEWLINE# #UNINDENT# iq = stanza . make_result_response ( ) #NEWLINE# q = iq . new_query ( 'jabber:iq:auth' ) #NEWLINE# q . newChild ( None , 'username' , None ) #NEWLINE# q . newChild ( None , 'resource' , None ) #NEWLINE# if ( 'plain' in self . auth_methods ) : #NEWLINE# #INDENT# q . newChild ( None , 'password' , None ) #NEWLINE# #UNINDENT# if ( 'digest' in self . auth_methods ) : #NEWLINE# #INDENT# q . newChild ( None , 'digest' , None ) #NEWLINE# #UNINDENT# self . send ( iq ) #NEWLINE# iq . free ( ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# self . lock . release ( )