130 |
130 |
131 ((name, host), arg) = split_mail(mailaddr) |
131 ((name, host), arg) = split_mail(mailaddr) |
132 baremail = "%s@%s" % (name, host) |
132 baremail = "%s@%s" % (name, host) |
133 imgname = (name + "_" + host).replace(".", "_") + ".png" |
133 imgname = (name + "_" + host).replace(".", "_") + ".png" |
134 imgfile = path.join(path.split(htmlfile)[0], imgname) |
134 imgfile = path.join(path.split(htmlfile)[0], imgname) |
|
135 mod = os.stat(htmlfile).st_mode |
|
136 gid = os.stat(htmlfile).st_gid |
135 cmd("convert label:'%s' '%s'" % (baremail, imgfile)) |
137 cmd("convert label:'%s' '%s'" % (baremail, imgfile)) |
|
138 os.chmod(imgfile, mod) |
|
139 os.chown(imgfile, -1, gid) |
136 if arg is not None: |
140 if arg is not None: |
137 mailsimple = u"{%s} AT [%s] WITH (%s)" % (name, host, arg) |
141 mailsimple = u"{%s} AT [%s] WITH (%s)" % (name, host, arg) |
138 mailscript = u" ".join(map(mk_line, ['<a href="', "mailto:", name, "@", host, "?", arg, '">'])); |
142 mailscript = u" ".join(map(mk_line, ['<a href="', "mailto:", name, "@", host, "?", arg, '">'])); |
139 else: |
143 else: |
140 mailsimple = u"{%s} AT [%s]" % (name, host) |
144 mailsimple = u"{%s} AT [%s]" % (name, host) |
172 if mails: |
176 if mails: |
173 # transform mails |
177 # transform mails |
174 mails_subst = {} |
178 mails_subst = {} |
175 for mail in mails.iterkeys(): |
179 for mail in mails.iterkeys(): |
176 mails_subst[mail] = obfuscate(mail, filename) |
180 mails_subst[mail] = obfuscate(mail, filename) |
177 |
181 |
178 # transform pages |
182 # transform pages |
179 istream = StringIO(open(filename, 'r').read()) |
183 istream = StringIO(open(filename, 'r').read()) |
180 ostream = open(filename, 'wb') |
184 ostream = open(filename, 'wb') |
181 print "writing %s with %s" % (filename, enc) |
185 print "writing %s with %s" % (filename, enc) |
182 replacehandler = ReplaceHandler(ostream, options.dtd, enc, mails_subst) |
186 replacehandler = ReplaceHandler(ostream, options.dtd, enc, mails_subst) |