%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/share/hplip/fax/__pycache__/
Upload File :
Create Path :
Current File : //usr/share/hplip/fax/__pycache__/fax.cpython-312.pyc

�

=	f���J�ddlZddlZddlZddlZddlZddlZddl�ddl�ddlm	Z	ddl
mZmZm
Z
ddlmZddlmZddlmZmZmZ	dd	lmZ	ddlZddlZej8de�dZdZdZ d
Z!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/d
Z0dZ1dZ2Gd�de	�Z3Gd�de4�Z5Gd�d ejl�Z7ddde8d!fd"�Z9dZ:dZ;d#Z<d$Z=d%Z>d&Z?d'Z@d(ZAd)ZBd*ZCd+ZDd,ZCd-ZEd.ZFd/ZGGd0�d1ej��ZIy#e$rY��wxYw#e$rej5d
�Y��wxYw)2�N)�*)�
LDIFParser)�device�utils�vcard)�cups)�BytesIO)�
to_bytes_utf8�to_long�
to_unicode�)�
coverpagesz!dbus is required for PC send fax.�ignore��������	�
���
���c��eZdZd�Zd�Zy)�
FaxLDIFParserc�>�tj||�||_y�N)r�__init__�db)�self�inputr$s   �/usr/share/hplip/fax/fax.pyr#zFaxLDIFParser.__init__�s�����D�%�(����c
�T�|r�	|dd}	|dd}	|dd}	|d	d}	|dd}g}	|d}|jtd��|D�	cgc]}	|	s�|	��	}
}	|rRtj	d|�d|�ddj|
��d|���|jj||||||
|�yyy#t$r	|dd}n#t$rd}YnwxYwY��wxYw#t$r	|dd}n#t$rd}YnwxYwY��wxYw#t$r|dz|z}Y��wxYw#t$r8	|d
d}n*#t$r	|dd}n#t$rd}YnwxYwYnwxYwY��?wxYw#t$r	|d
d}n#t$rd}YnwxYwY��awxYw#t$rY��iwxYwcc}	w)N�	givenNamer�	firstname��sn�lastname�cn� �facsimiletelephonenumber�fax�	workphone�title�
department�ou�All�
Import: name=�, fax=z, group(s)=�,z, notes=)�KeyError�appendr�log�debug�joinr$�set)r%�dn�entryr+r.�nicknamer2r4�grps�g�groupss           r'�handlezFaxLDIFParser.handle�s'��
�
#�!�+�.�q�1�	�
"� ��;�q�>��
6� ��;�q�>��	
"��6�7��:��
��g��q�)���D�
��T�{��
�K�K�
�5�)�*�!%�+�A��a�+�F�+���	�	�x�Y\�^a�^f�^f�gm�^n�pr�s�t������H�e�Y��#�v�r�R��c���
#�#� %�k� 2�1� 5�I���#� "�I�#��
#���
"�"�$�Z�0��3�H���"�!�H�"��
"���
6�$�s�?�X�5��
6��
�
"�"���,�q�/�C���"�"�#�K�0��3���#�"�!��"��"��
"���
��!�,�/��2�E�����E���
���
��
��,s&�B:�C$�D�D&�E*�F�F%�F%�:	C!�C
�C!�
C�C!�C�C!� C!�$	D�.C7�6D�7D�D�D�D�
D�D#�"D#�&	E'�0D9�8E'�9	E �E�E �E�E �E�E �E'�E � E'�&E'�*	F�4E=�<F�=F�F�
F�F�F�	F"�!F"N)�__name__�
__module__�__qualname__r#rG�r(r'r r �s
���4Sr(r c��eZdZd�Zd�Zd�ZeZd�Zd�ZeZ	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�FaxAddressBookc�2�i|_|j�yr")�_data�load�r%s r'r#zFaxAddressBook.__init__�s����
�	
�	�	�r(c��d|_tjdk7r�tjjtjd�|_tjj
|j�rAt|jd�}tj|�|_
|j�y|j�yy)Nz	/dev/nullz
fab.pickle�rb)
�_fab�prop�user_dir�os�pathr?�exists�open�picklerPrO�close�save�r%�pickle_files  r'rPzFaxAddressBook.load�s����	��=�=�D� ������T�]�]�L�A�D�I��w�w�~�~�d�i�i�(�!�$�)�)�T�2�{�"�K�K��4�t�z�� � �"��y�y�{�!r(c�
�|D�cgc]
}t|���}	}t|�t|�t|�t|�t|�t|�|	d�|jt|�<|j�ycc}w)N)�namer4r+r.r2�notesrF)rrOr])
r%rar4r+r.r2rFrb�srDs
          r'r@zFaxAddressBook.set�sr��
(.�.�!�
�1�
�.��.�1;�D�1A�-7��->�1;�I�1F�0:�8�0D�+5�c�?�-7��->�.2�
(4��
�
�:�d�#�$�	
�	�	���/s�Bc�Z�||jt|�|<|j�yr")rOrr])r%ra�key�values    r'�
set_key_valuezFaxAddressBook.set_key_values#��,1��
�
�:�d�#�$�S�)��	�	�r(c�:�|jj|d�Sr")rO�get�r%ras  r'rizFaxAddressBook.gets���z�z�~�~�d�D�)�)r(c�2�	|j|	|j|y#t$r\|j|j�|j|<||j|d<|j|=|j�YywxYw#t$rYywxYw)Nra)rOr;�copyr])r%�old_name�new_names   r'�renamezFaxAddressBook.rename
s���	��J�J�x� �
��
�
�8�$���
�'+�z�z�(�';�'@�'@�'B��
�
�8�$�/7��
�
�8�$�V�,��J�J�x�(��	�	��	
���	��	�s!�B
�"�A"B�B�
	B�Bc��g}t|jj��D]%\}}|dD]}||vs�|j|���'|S�NrF��listrO�itemsr<)r%�
all_groups�e�vrEs     r'�get_all_groupszFaxAddressBook.get_all_groupss]���
�����)�)�+�,�	)�D�A�q��x�[�
)���J�&��%�%�a�(�
)�	)��r(c��|jSr")rOrQs r'�get_all_recordszFaxAddressBook.get_all_records"s���z�z�r(c�H�t|jj��Sr")rsrO�keysrQs r'�
get_all_nameszFaxAddressBook.get_all_names&s���D�J�J�O�O�%�&�&r(c���	t|jd�}tj|j|d��|j�y#t$rtjd�YywxYw)N�wbr)�protocolzI/O error saving fab file.)	rZrTr[�dumprOr\�IOErrorr=�errorr^s  r'r]zFaxAddressBook.save*sS��	4��t�y�y�$�/�K��K�K��
�
�K�!�<�������	4��I�I�2�3�	4�s�AA�A,�+A,c�2�i|_|j�yr"�rOr]rQs r'�clearzFaxAddressBook.clear3s����
��	�	�r(c�\�||jvr|j|=|j�yy)NTFr�rjs  r'�deletezFaxAddressBook.delete8s)���4�:�:���
�
�4� ��I�I�K��r(c�t�	tj|j�jS#t$rYywxYw�Nr)rW�statrT�st_mtime�OSErrorrQs r'�last_modification_timez%FaxAddressBook.last_modification_timeAs2��	��7�7�4�9�9�%�.�.�.���	��	�s�(+�	7�7c��t|jj��D]W\}}|d|vr&||dvs�|djt	|���3||dvs�;|djt	|���Y|j
�y)NrarF)rsrOrtr<r�remover]�r%�group�membersrvrws     r'�
update_groupszFaxAddressBook.update_groupsHs�������)�)�+�,�	:�D�A�q���y�G�#���(��+��h�K�&�&�z�%�'8�9��A�h�K�'��h�K�&�&�z�%�'8�9�
	:�	
�	�	�r(c���t|jj��D]*\}}||dvs�|djt	|���,|j�yrq)rsrOrtr�rr])r%r�rvrws    r'�delete_groupzFaxAddressBook.delete_groupSsU������)�)�+�,�	6�D�A�q���(��#��(��"�"�:�e�#4�5�	6�	
�	�	�r(c��g}t|jj��D]\}}||dvs�|j|�� |Srqrrr�s     r'�
group_memberszFaxAddressBook.group_membersZsK��������)�)�+�,�	"�D�A�q���(��#����q�!�	"��r(c��|j|�}g}|D]}||vs�|j|��|j|||z�yr"�r�r<r�)r%r�r�r��new_group_members�ms      r'�add_to_groupzFaxAddressBook.add_to_groupbsU���*�*�5�1�
����	,�A��
�%�!�(�(��+�	,�	
���5�-�2C�"C�Dr(c��|j|�}g}|D]}||vs�|j|��|j||�yr"r�)r%r��remove_membersr�r�r�s      r'�remove_from_groupz FaxAddressBook.remove_from_grouplsP���*�*�5�1�
����	,�A���&�!�(�(��+�	,�	
���5�"3�4r(c�n�|j|�}|j|g�|j||�yr")r�r�)r%�	old_group�	new_groupr�s    r'�rename_groupzFaxAddressBook.rename_groupvs2���$�$�Y�/�����9�b�)����9�g�.r(c��	t|d�j�}tj||�t	t|d�|�}|j�|j
�y#t$r}d|jfcYd}~Sd}~wwxYw)N�r�Tr,F)	rZ�readr=�debug_blockr �parser]�
ValueError�message)r%�filename�data�parserrvs     r'�import_ldifzFaxAddressBook.import_ldif|sq��	$���#�&�+�+�-�D��O�O�H�d�+�"�4��#�#6��=�F��L�L�N��I�I�K����	$��!�)�)�#�#��	$�s�A&A)�)	B
�2
B�?B
�B
c��t|d�j�}tj||�t	j
t	jt	j|���D�]C}tj|�|ds�d}tdd�D])}|dk(rd}nd|z}	||d||d	vs�!||d
}n|jdd�}|r|g}n%|jdd�jd
�}|sg}|jtd��|D�cgc]}|s�|��	}	}|d}
|jdtd��}tjd|
�d|�ddj|	��d|���|j!|
td�td�td�||	|���Fy#t$rY��wxYwcc}w)Nr�rar,r
i'�phonezphone%dr2�type�number�organisation�
categories�;r7rbr8r9z
 group(s)=r:z notes=r�)rZr�r=r�r�VCards�VFile�opentextfiler>�ranger;ri�splitr<rr?r@)r%r�r��cardr2�xrc�org�orFrarbs            r'�import_vcardzFaxAddressBook.import_vcard�s����H�c�"�'�'�)������$�'��L�L����U�-?�-?��-I�!J�K�"	c�D��I�I�d�O��F�|����q�$��
"�A��A�v�#��%��M��"��Q��!�D��G�F�O�3�"&�q�'�(�"3�C�!�
"��h�h�~�r�2����%�C��(�(�<��4�:�:�3�?�C�� ���
�
�:�e�,�-�%(�.��A�!�.��.��F�|������*�R�.�9���	�	�D�RU�WZ�W_�W_�`f�Wg�in�o�p�����z�"�~�z�"�~�z�"�~�s�TZ�\a�b�E"	c�H��/$����� /s�*F4� G�(G�4	G�GN)rHrIrJr#rPr@�insertrgri�selectrorxrzr}r]r�r�r�r�r�r�r�r�r�r�r�rKr(r'rMrM�sz�����"�F��
*��F����'�4��
�����E�5�/�	$�(r(rMc��eZdZdddedfd�Zd�Zd�Zeee�Zd�Z	d�Z
ee
e	�Zd�Zd	�Z
d
�Zd�Z			dd�Zd
�Zd�Zy)�	FaxDeviceNFc���tjj|||d||�d|_d|_||_|s,t
j�}|jdd�|_	yd|_	y)Nzcom.hplip.StatusServicez/com/hplip/StatusService)
r�Devicer#�send_fax_thread�upload_log_thread�fax_type�dbus�
SessionBus�
get_object�service)r%�
device_uri�printer_name�callbackr��disable_dbus�session_buss       r'r#zFaxDevice.__init__�sh��
	�
�
���t�Z��#�X�|�	=� $���!%��� ��
���/�/�+�K�&�1�1�2K�Mg�h�D�L��D�Lr(c��t�r"��AttributeError)r%�nums  r'�setPhoneNumzFaxDevice.setPhoneNum�����r(c��t�r"r�rQs r'�getPhoneNumzFaxDevice.getPhoneNum�r�r(c��t�r"r�rjs  r'�setStationNamezFaxDevice.setStationName�r�r(c��t�r"r�rQs r'�getStationNamezFaxDevice.getStationName�r�r(c��t�r"r�rQs r'�setDateAndTimezFaxDevice.setDateAndTime�r�r(c��t�r"r�rQs r'�	uploadLogzFaxDevice.uploadLog�r�r(c��t�r"r�rQs r'�isUploadLogActivezFaxDevice.isUploadLogActive�r�r(c��t�r"r�rQs r'�waitForUploadLogThreadz FaxDevice.waitForUploadLogThread�r�r(c
��t�r"r�)
r%�phone_num_list�
fax_file_list�
cover_message�cover_re�
cover_func�preserve_formattingr��update_queue�event_queues
          r'�	sendFaxeszFaxDevice.sendFaxes�s
���r(c�P�|j�|jj�Sy)NF)r��is_aliverQs r'�isSendFaxActivezFaxDevice.isSendFaxActive�s&�����+��'�'�0�0�2�2�r(c��|j�7|jj�r	|jj�yyy#t$rYywxYwr")r�r�r?�KeyboardInterruptrQs r'�waitForSendFaxThreadzFaxDevice.waitForSendFaxThread�sU�����+�� � �)�)�+�
��$�$�)�)�+�
,�,��
%�
��
�s�A�	A�A�r,r,NFr,NN)rHrIrJ�
FAX_TYPE_NONEr#r�r��property�	phone_numr�r��station_namer�r�r�r�r�r�r�rKr(r'r�r��su��"&�T��'�#� �&����k�2�I����N�N�;�L�����SU�KM�15���r(r�Fc��|tk(r�|�e|�ctj�}|D];}|jj	�|j	�k(s�/|j
}nt
t��|�tj|�}|d}tjd|z�|ttfvrddlm}||||||�S|t k(rddlm}	|	|||||�S|t&k(rddlm}
|
|||||�S|t,k(rddlm}||||||�S|t2k(rddlm}||||||�S|t8k(rdd	lm}
|
|||||�St
t>��)
Nzfax-typezfax-type=%dr
)�PMLFaxDevice)�
SOAPFaxDevice)�LEDMSOAPFaxDevice)�MarvellFaxDevice)�
LEDMFaxDevice)�CDMFaxDevice) r�r�getPrintersra�lowerr��Error�ERROR_DEVICE_NOT_FOUNDr�queryModelByURIr=r>�FAX_TYPE_BLACK_SEND_EARLY_OPEN�FAX_TYPE_BLACK_SEND_LATE_OPEN�pmlfaxr��
FAX_TYPE_SOAP�soapfaxr��FAX_TYPE_LEDMSOAP�ledmsoapfaxr�FAX_TYPE_MARVELL�
marvellfaxr�
FAX_TYPE_LEDM�ledmfaxr�FAX_TYPE_CDM�cdmfaxr�'ERROR_DEVICE_DOES_NOT_SUPPORT_OPERATION)r�r�r�r�r��printers�p�mqr�r�rrrrs              r'�getFaxDevicer�sd��
�=� ���,�":��'�'�)�H��
4���6�6�<�<�>�\�%7�%7�%9�9�!"���J��
4�
�2�3�3��!��'�'�
�3�B��*�~�H��I�I�m�h�&�'��2�4Q�R�R�(��J��h��,�W�W�	�]�	"�*��Z��x��<�X�X�	�&�	&�2� ��\�8�X�|�\�\�	�%�	%�0��
�L�(�H�l�[�[�	�]�	"�*��Z��x��<�X�X�	�\�	!�(��J��h��,�W�W��;�<�<r(����(�2�<�F�P�Z�d�n�x�c�t�eZdZ		dd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
dd
�Zd�Zd�Zd�Zd�Zy)�
FaxSendThreadNc��tjj|�||_||_||_||_|
|_||_||_	||_
||_|	|_t�|_d|_d|_||_i|_d|_g|_d|_d|_d|_d|_d|_d|_d|_y)Nr,Fr)�	threading�Threadr#�devr�r�r�r�r�r�r�r��current_printerr	�stream�prev_update�remove_temp_filer��results�cover_page_present�recipient_file_list�f�job_hort_dpi�job_vert_dpi�
job_page_size�job_resolution�job_encoding)r%r-r�r�r�r�r�r�r�r�r�r�s            r'r#zFaxSendThread.__init__Gs���	���!�!�$�'�������,���*���(���&���*��� ��
�$���+����i������ %���#6�� ����"'���#%�� ���������������������r(c���d|_tj|j�|jD]|}|\}}}}}|dk(rd|_tjd�n9|jj|dd|f�tjd||fz�|j
�s�wt}�~tj|j�|j
�rt}|S)NFzapplication/hplip-fax-coverpageTzSkipping coverpage�application/hplip-fax�HP Faxz+Processing pre-rendered file: %s (%d pages))r3r=r>r��rendered_file_listr<�check_for_cancel�
STATE_ABORTED)r%�state�fax_file�
fax_file_name�
fax_file_type�
fax_file_desc�fax_file_title�fax_file_pagess        r'�
pre_renderzFaxSendThread.pre_rendergs���#(����	�	�$�$�$�%��*�*�	&�H�19�
/�M�=�-���� A�A�*.��'��	�	�.�/��'�'�.�.�
�?V��n�0.�/��	�	�G�"�N�3�4�5��$�$�&�%��#	&�&	�	�	�$�)�)�*�� � �"�!�E��r(c�L�|jdd|_tjd�d|_tj|j�d}|jD�]�}|d}tjd|z�t
jj|��rtt|j|<t|d�}|jt�}|j|�\
}}}	}
}}}
}}}|dk7r/tjd�t|j|<t }��|s,|
|||
|f\|_|_|_|_|_|dz
}n||j"|
k7s<|j$|k7s-|j&|k7s|j(|
k7s|j*|k7r1tjd|z�t,|j|<t }tjd	|||	|
|||
|fz�|xj|	z
c_|j/�n3tjd
|z�t0|j|<t }n|j3�s���t4}n|j6r|xjdz
c_tjd|jz�|S)NzCounting total pages...rz'Processing file (counting pages): %s...rS�hplip_g3�Invalid file header. Bad magic.r
z!Incompatible options for file: %s�>Magic=%s Ver=%d Pages=%d hDPI=%d vDPI=%d Size=%d Res=%d Enc=%dzUnable to find HP Fax file: %szTotal fax pages=%d)r>r4r=r>�job_total_pagesrWrXrY�
ERROR_SUCCESSr2rZr��FILE_HEADER_SIZE�decode_fax_headerr��ERROR_FAX_INVALID_FAX_FILE�STATE_ERRORr6r7r8r9r:�ERROR_FAX_INCOMPATIBLE_OPTIONSr\�ERROR_FAX_FILE_NOT_FOUNDr?r@r3)r%rA�irBrC�fax_file_fd�header�magic�version�total_pages�hort_dpi�vert_dpi�	page_size�
resolution�encoding�	reserved1�	reserved2s                 r'�count_pageszFaxSendThread.count_pages�su��#'�#:�#:�1�#=�� ��	�	�+�,� ����	�	�$�*�*�+�
���0�0�7	�H�$�Q�K�M��I�I�?�-�O�P��w�w�~�~�m�,�.;����]�+�"�=�$�7��$�)�)�*:�;���.�.�v�6�?��w��X�x����)�Y��K�'��I�I�?�@�2L�D�L�L��/�'�E���!�(�I�z�8�K�?�D�%�t�'8�$�:L��+�T�->���F�A��(�(�H�4��)�)�X�5��*�*�i�7��+�+�z�9��)�)�X�5��	�	�"E�
�"U�V�6T����]�3� +���	�	�Z� �'�;��#�Y�
�H�F�F�G��$�$��3�$��!�!�#��	�	�:�]�J�K�.F����]�+�#����$�$�&�%���o7	�t�"�"�� � �A�%� ��	�	�&��)=�)=�=�>��r(c�b�	tjd|�S#tj$rYywxYw)N�>8sBIHHBBBII)
���rerererererererere��struct�unpackr��r%rWs  r'rPzFaxSendThread.decode_fax_header�s.��	:��=�=���8�8���|�|�	:�9�	:����.�.c�b�	tjd|�S#tj$rYywxYw)N�>IIIIII)rererererererfris  r'�decode_page_headerz FaxSendThread.decode_page_header�s.��	*��=�=��F�3�3���|�|�	*�)�	*�rjc�r�|jdkDrt}nt}|jr�tjd|dz�|j
|�\}}|rt}|S|st}|S|jjd|dddf�tjd|z�t|j|<|S)	Nr
z%Creating cover page for recipient: %srarr<r=�
Cover PagezCover page G3 file: %s)
rM�STATE_MERGE_FILES�STATE_SINGLE_FILEr3r=r>�render_cover_pager@rRr4r�rNr2)r%�	recipientrArB�canceleds     r'�
cover_pagezFaxSendThread.cover_page�s������!�#�%�E�%�E��"�"��I�I�=�	�&�@Q�Q�R�!%�!7�!7�	�!B��H�h��%�����#�����(�(�/�/��H�>U�4<�l�4L�M��	�	�2�X�=�>�)6����X�&��r(c�~�t}tjd�|jdd|_	t|jd�}|j
t�}|j|�\
}}}}}}	}
}}}
t|j|j<|dk7r8tjd�t|j|j<t}tjd||||||	|
|fz�|j�|S#t$r,tjd|jz�t}Y|SwxYw)NzProcessing single file...rrSrJrKrLzUnable to open fax file: %s)�STATE_SEND_FAXr=r>r4r5rZr�rOrPrNr2r�rQrRr\r�)r%rA�f_fdrWrXrYrZr[r\r]r^r_r`ras              r'�single_filezFaxSendThread.single_file�s)�����	�	�-�.��)�)�!�,�Q�/���	������%�D�
�Y�Y�/�0�F�>B�=S�=S�TZ�=[�
;�E�7�K��8�Y��H�i��#0�D�L�L���� ���#��	�	�;�<�'A����T�V�V�$�#���I�I�V��g�{�H�h� �*�h�8�8�
9�
�J�J�L����-�	 ��I�I�3�d�f�f�<�=��E�(��-	 �s�D�1D<�;D<c��tjddz�tj|j�d|_d}d}d}|j�ro	tj�\}|_tj|t|��|jD]�}|d}tjd|z�|jdz|_t|d	�5}	tj||j��ddd�|j�rt}n4tjd
�|j!t"|df�|dz}��tjd�tj|t|��tj$|�tjd
|jz�|S|S#t$r}	tj|	�Yd}	~	��d}	~	wwxYw#1swY��xYw#t&}Y|SxYw)Nz"%s State: Merge multiple CDM files�********************Ts��������������AsIBr
r�Processing file: %s...rSzWritting to queues...r,zadding footer...�Total pages=%d)r=r>r4r1rMr�make_temp_filer5rW�write�	bytearrayrZr��	Exceptionr?r@�write_queue�STATUS_PROCESSING_FILESr\rR)
r%rA�HeaderSrtSessionAndOpenDataSrc�FooterEndSessionAndCloseDataSrc�job_page_numrxrBrC�infile�insts
          r'�merge_cdm_fax_filesz!FaxSendThread.merge_cdm_fax_filess����	�	�6�&�A�B��	�	�$�*�*�+� $���)|�&�*5�'������
$�$�3�3�5���d�f�����y�)G�H�I� $� 8� 8�4�H�$,�Q�K�M��I�I�6��F�G�+/�+?�+?�!�+C�D�(��m�D�1�,�V�,��H�H�T�&�+�+�-�8�,�
�,�,�.� -����I�I�5�6��$�$�&=�|�R�%P�Q�#/�!�#3�L�4��	�	�,�-�����y�)H�I�J�������	�	�*�T�-A�-A�A�B���u��� )�,��I�I�d�O�O��,��,�,��
$�#����sJ�BG:�G.�$G�B?G:�	G+�G&�!G.�&G+�+G.�.G7	�3G:�:Hc���tjddz�tj|j�tjd�d|_|j�rtj�\}|_tjd|jz�tjddtd�|j|j|j|j|j|jtd	�td	��}t!j"||�d}|jD�]�}|d	}tjd
|z�|j$|t&k(�r�t)|d�}|j+t,�}|j/|�\
}	}
}}}
}}}}}|	dk7rtj1d�t2}�n`tjd
|	|
|||
|||fz�t5|�D]�}|j+t6�}|j9|�\}}}}}}|dk(r tj1d�|t2z
n�tjd|||||td	��}t!j"||�|j;t<|df�tjd|||||fz�t!j"||j+|��|dz
}��|j?�|jA�s���tB}ntj1d|z����t!j>|�tjd|jz�|S)Nz%s State: Merge multiple filesr{zMerging g3 files...TzTemp file=%srdrJr
rr|rSrKrLrezPage header errorrlr,z%Page=%d PPR=%d RPP=%d BPP=%d Thumb=%szSkipping file: %sr})"r=r>r4r1rMrr~r5rg�packrr6r7r8r9r:rWrr2rNrZr�rOrPr�rRr��PAGE_HEADER_SIZErmr�r�r\r?r@)r%rArxr�r�rBrCrVrWrXrYrZr[r\r]r^r_r`rar�page_num�ppr�rpp�
bytes_to_read�thumbnail_bytess                         r'�merge_fileszFaxSendThread.merge_files:s���	�	�2�f�=�>��	�	�$�*�*�+��	�	�'�(� $������ �/�/�1�L�D�$�&��I�I�n�t�v�v�-�.��;�;�~�{�G�A�J��H\�H\��!�!�4�#4�#4�d�6H�6H��#�#�T�%6�%6���
�G�A�J�(�D�

�H�H�T�4� ��L� �4�4�1
�� (���
��	�	�2�]�B�C��<�<�
�.�-�?�"&�}�d�";�K�(�-�-�.>�?�F�FJ�E[�E[�\b�Ec�C�E�7�K��8�Y�"�H�i����+��	�	�"C�D� +����I�I�^�$�g�{�H�h�PY�[e�go�p�q�r�#�;�/�*��!,�!1�!1�2B�!C��!�3�3�F�;�V��#�s�M�?�I�$�r�>��I�I�&9�:�!�K�/�!�!'���Y��c�3�P]�_n�pw�xy�pz�!{������v�.��(�(�*A�<�QS�)T�U��	�	�"I�#+�S�#�}�o�"V�#W�X�����{�'7�'7�
�'F�G�$��)��)*�, �%�%�'��,�,�.� -����I�I�1�M�A�B��c1
�f
�H�H�T�N��I�I�&��)=�)=�=�>��r(c#�6K�|jD]}|���y�wr")r��r%�as  r'�next_recipient_genz FaxSendThread.next_recipient_gen�s �����$�$�	�A��G�	���c#�6K�|jD]}|���y�wr")r4r�s  r'�
next_file_genzFaxSendThread.next_file_gen�s �����)�)�	�A��G�	�r�c��d}d}d}d}tj�|dvrtjd�|dkDrtjd|z�|rtjd�tj|j||�}	tj�t
j
d	|	z�d}
tjd�d}d
}tj�dz}
tj�|
k�rt
j
dt|jj�z�t|jj|jjtj |	��}t#|d
�}t
j
d|z�|r	|d
fS|j%�r.t
j'd|	z�tj(|	�ytjd�tj�|
kr��t
j'd|	z�tj(|	�y)NTr,rr
)zapplication/x-cshellzapplication/x-perlzapplication/x-pythonzapplication/x-shellzapplication/x-shz
text/plain�prettyprintznumber-up=%dz
page-ranges=1z	Job ID=%dFg�r@zWaiting for fax... type =%srzFax file=%sz%Render canceled. Canceling job #%d...)r,Tz3Timeout waiting for rendering. Canceling job #%d...)r,F)r�resetOptions�	addOption�	printFiler.r=r>�time�sleepr�r-r�rsr��CheckForWaitingFaxrU�username�strr?r��	cancelJob)r%rXr4�	mime_type�force_single_page�	all_pages�
page_range�page_set�nup�sent_job_id�job_idrB�complete�end_time�results               r'�render_filezFaxSendThread.render_file�s����	��
����������(�(�
�N�N�=�)���7��N�N�>�C�/�0���N�N�?�+��n�n�T�%9�%9�4��G�������	�	�+��+�,����
�
�1�
������9�9�;��&���i�i�k�H�$��I�I�3�D����9L�9L�4M�M�N��$�,�,�9�9�$�(�(�:M�:M�t�}�}�^i�j�k�F��6�!�9�~�H��I�I�m�h�.�/��������$�$�&��	�	�A�K�O�P����{�+���J�J�q�M�!�i�i�k�H�$�&
�I�I�K�k�Y�Z��N�N�;�'�r(c�&�d}|jj�rZ	|jjd�}|dtk(rd}tjd�|jj�r�Z|S#tj$rY|SwxYw)NFrTzCancel pressed!)r��qsizeri�EVENT_FAX_SEND_CANCELEDr=r>�Queue�Empty)r%rt�events   r'r?zFaxSendThread.check_for_cancel�s��������$�$�&�
��(�(�,�,�Q�/����8�6�6�#�H��I�I�/�0����$�$�&�����;�;�
����
�s�>A9�9B�Bc�6�tjd�tj�|j	t
j|j|dd|d|jtjdd�|jtjdd�|j|j|j��}tjd|z�|j|d	d
d��\}}	tj |�||fS#t"$rY||fSwxYw)
NzCreating cover page...rar,r2�voice_phone�
email_address)r]rZ�recipient_name�recipient_phone�
recipient_fax�sender_name�sender_phone�
sender_fax�sender_email�	regardingr�r�zPDF File=%srozapplication/pdfT)r�)r=r>�	user_confr�r�r�PAGE_SIZE_LETTERrMr�rir�r�r�r�r�rWr�r�)r%r��pdfrBrts     r'rrzFaxSendThread.render_cover_page�s	���	�	�*�+�	�����o�o�
�(C�(C�*.�*>�*>�-.�v�Y�.0�,-�e�H�*.�*:�*:�+4�=�=��
�+N�)-���+4�=�=���+P�(,�
�
�&*�&8�&8�26�2J�2J��L�� 	�	�	�-�#�%�&�!�-�-�c�<�AR�"�.�$���(�	��I�I�c�N���!�!���	����!�!�	�s�0D	�		D�Dc��|j�H||jk7r8|jj|�tjd�||_yyyr�)r�r0�putr�r�)r%r�s  r'r�zFaxSendThread.write_queue�sK�����(�W��8H�8H�-H����!�!�'�*��J�J�q�M�&�D��.I�(r(c��yr"rKrQs r'�runzFaxSendThread.runs��r(r�)F)rHrIrJr#rHrbrPrmruryr�r�r�r�r�r?rrr�r�rKr(r'r)r)Fsb��UZ�AE��@"�JF�P:�*��0�@ �DI�X��
:�z� "�F'�
r(r))J�sysrWr+r[r�rg�base.g�
base.codes�	base.ldifr�baserrr�prntr�base.sixextr	r
rrr,r�ImportErrorr�r=r��warnings�simplefilter�DeprecationWarning�STATUS_IDLEr��STATUS_SENDING_TO_RECIPIENT�STATUS_DIALING�STATUS_CONNECTING�STATUS_SENDING�STATUS_COMPLETED�STATUS_CREATING_COVER_PAGE�STATUS_ERROR�STATUS_BUSY�STATUS_CLEANUP�STATUS_ERROR_IN_CONNECTING�STATUS_ERROR_IN_TRANSMITTING�STATUS_ERROR_PROBLEM_IN_FAXLINE�STATUS_JOB_CANCELr��RESOLUTION_STD�RESOLUTION_FINE�RESOLUTION_300DPIrOr�r �objectrMr�r�r�r�
STATE_DONEr@�
STATE_SUCCESS�
STATE_BUSY�STATE_READ_SENDER_INFO�STATE_PRERENDER�STATE_COUNT_PAGES�STATE_NEXT_RECIPIENT�STATE_COVER_PAGErqrprw�
STATE_CLEANUPrRr,r)rKr(r'�<module>r�s���2�	��
��
��� �%�%���:�:�	��3�������h� 2�3�������������������������!��"$������v����������9S�J�9S�|b�V�b�LE��
�
�E�V!�t��'�#�/=�n�
��
��
�
�
��������������������
���~
�I�$�$�~
��y�	��	��
�3��I�I�1�2�3�s$�
C>�D	�>D�D�	D"�!D"

Zerion Mini Shell 1.0