#NEWLINE# def getaddress( self ) : #NEWLINE# #INDENT# 'Parse the next address.' #NEWLINE# self . commentlist = [ ] #NEWLINE# self . gotonext ( ) #NEWLINE# oldpos = self . pos #NEWLINE# oldcl = self . commentlist #NEWLINE# plist = self . getphraselist ( ) #NEWLINE# self . gotonext ( ) #NEWLINE# returnlist = [ ] #NEWLINE# if ( self . pos >= len ( self . field ) ) : #NEWLINE# #INDENT# if plist : #NEWLINE# #INDENT# returnlist = [ ( SPACE . join ( self . commentlist ) , plist [ 0 ] ) ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . field [ self . pos ] in '.@' ) : #NEWLINE# #INDENT# self . pos = oldpos #NEWLINE# self . commentlist = oldcl #NEWLINE# addrspec = self . getaddrspec ( ) #NEWLINE# returnlist = [ ( SPACE . join ( self . commentlist ) , addrspec ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . field [ self . pos ] == ':' ) : #NEWLINE# #INDENT# returnlist = [ ] #NEWLINE# fieldlen = len ( self . field ) #NEWLINE# self . pos += 1 #NEWLINE# while ( self . pos < len ( self . field ) ) : #NEWLINE# #INDENT# self . gotonext ( ) #NEWLINE# if ( ( self . pos < fieldlen ) and ( self . field [ self . pos ] == ';' ) ) : #NEWLINE# #INDENT# self . pos += 1 #NEWLINE# break #NEWLINE# #UNINDENT# returnlist = ( returnlist + self . getaddress ( ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . field [ self . pos ] == '<' ) : #NEWLINE# #INDENT# routeaddr = self . getrouteaddr ( ) #NEWLINE# if self . commentlist : #NEWLINE# #INDENT# returnlist = [ ( ( ( ( SPACE . join ( plist ) + ' (' ) + ' ' . join ( self . commentlist ) ) + ')' ) , routeaddr ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# returnlist = [ ( SPACE . join ( plist ) , routeaddr ) ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if plist : #NEWLINE# #INDENT# returnlist = [ ( SPACE . join ( self . commentlist ) , plist [ 0 ] ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . field [ self . pos ] in self . specials ) : #NEWLINE# #INDENT# self . pos += 1 #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# self . gotonext ( ) #NEWLINE# if ( ( self . pos < len ( self . field ) ) and ( self . field [ self . pos ] == ',' ) ) : #NEWLINE# #INDENT# self . pos += 1 #NEWLINE# #UNINDENT# return returnlist