Changeset 9 for SipgateFax/trunk/Resources/usr/libexec/cups/backend/sipgate
- Timestamp:
- 03/24/08 22:15:06 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
SipgateFax/trunk/Resources/usr/libexec/cups/backend/sipgate
r7 r9 68 68 user = sys.argv[2] 69 69 title = sys.argv[3] 70 copies = sys.argv[4] 70 71 opts = sys.argv[5].replace("\\ ", "%20").split() 71 72 atPos = os.environ['DEVICE_URI'].find('@') … … 74 75 faxTo = toE164(getOptionFromArray(opts, 'faxTo')) 75 76 if faxTo==False: 76 sys.stderr.write("ERROR: No fax number given ")77 sys.stderr.write("ERROR: No fax number given\n") 77 78 sys.exit(CUPS_BACKEND_CANCEL) 78 79 79 80 if len(cred)!=2: 80 sys.stderr.write("ERROR: Credentials missing in device_uri ")81 sys.stderr.write("ERROR: Credentials missing in device_uri\n") 81 82 sys.exit(CUPS_BACKEND_CANCEL) 82 83 #dbg = open('/tmp/sipgate.log', 'w')84 #for param in os.environ.keys():85 # sys.stderr.write("%20s %s\n" % (param,os.environ[param]))86 #dbg.write("\nfaxTo: %s\n" % faxTo)87 #dbg.write("host: %s\n" % host)88 #dbg.write("u/p %s %s" % (cred[0], cred[1]))89 #dbg.close()90 83 91 84 if argc == 7: … … 93 86 infilename = sys.argv[6] 94 87 else: 88 sys.stderr.write("INFO: file is stdin\n") 95 89 infilename = tempfile.mktemp("sipfax.pdf") 96 90 try: … … 98 92 except: 99 93 sys.stderr.write("ERROR: unable to create tmp file %s\n" % infilename) 100 sys.exit( 1)94 sys.exit(CUPS_BACKEND_FAILED) 101 95 102 sys.stderr.write("INFO: file is stdin\n")103 96 try: 104 97 infile.write(sys.stdin.read()) 98 infile.close() 105 99 except: 106 100 sys.stderr.write("ERROR: unable to copy into tmpfile\n") … … 108 102 sys.exit(CUPS_BACKEND_FAILED) 109 103 110 infile = open(infilename, "r") 104 outfilename = tempfile.mktemp("sipcompress.out.pdf") 105 cmd = "/System/Library/Printers/Libraries/quartzfilter" 106 filterpath = "/Library/Filters/CompressForFax.qfilter" 107 ret = os.system("%s \"%s\" \"%s\" \"%s\"" % (cmd, infilename, filterpath, outfilename)) 108 if ret == 0: 109 infile = open(outfilename, "r") 110 else: 111 sys.stderr.write("ERROR: Filter error %s\n" % ret); 112 infile = open(infilename, "r") 113 111 114 faxcontent = base64.encodestring(infile.read()); 112 115 infile.close() … … 118 121 result = server.samurai.ClientIdentify({ 119 122 'ClientName':'SipgateFax for Mac OSX', 120 'ClientVersion':'1.0b 1',123 'ClientVersion':'1.0b2', 121 124 'ClientVendor':'Christian Aust, software-consultant.net', 122 125 }) … … 139 142 if argc == 6: 140 143 os.unlink(infilename) 144 os.unlink(outfilename) 141 145 142 146 sys.exit(CUPS_BACKEND_OK)
Note: See TracChangeset
for help on using the changeset viewer.
