Changeset 191 for trunk/email2trac.py.in
- Timestamp:
- 10/11/07 12:01:11 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/email2trac.py.in
r190 r191 170 170 self.SPAM_LEVEL = 0 171 171 172 if parameters.has_key('email_comment'): 173 self.comment = str(parameters['email_comment']) 172 if parameters.has_key('email_quote'): 173 self.EMAIL_QUOTE = str(parameters['email_quote']) 174 else: 175 self.EMAIL_QUOTE = '> ' 174 176 175 177 if parameters.has_key('email_header'): … … 207 209 else: 208 210 self.STRIP_SIGNATURE = 0 211 212 if parameters.has_key('strip_quotes'): 213 self.STRIP_QUOTES = int(parameters['strip_quotes']) 214 else: 215 self.STRIP_QUOTES = 0 209 216 210 217 if parameters.has_key('use_textwrap'): … … 223 230 self.TMPDIR = os.path.normcase(str(parameters['tmpdir'])) 224 231 225 # X-Spam-Score: *** (3.255) BAYES_50,DNS_FROM_AHBL_RHSBL,HTML_ 226 # Note if Spam_level then '*' are included 232 227 233 def spam(self, message): 234 """ 235 # X-Spam-Score: *** (3.255) BAYES_50,DNS_FROM_AHBL_RHSBL,HTML_ 236 # Note if Spam_level then '*' are included 237 """ 228 238 if message.has_key('X-Spam-Score'): 229 239 spam_l = string.split(message['X-Spam-Score']) … … 233 243 return 'Spam' 234 244 235 elif message.has_key('X-Virus-found'): # treat virus mails as spam 245 # treat virus mails as spam 246 # 247 elif message.has_key('X-Virus-found'): 236 248 return 'Spam' 237 249 238 250 return self.get_config('ticket', 'default_component') 251 239 252 240 253 def blacklisted_from(self): … … 695 708 return ('\n'.join(body)) 696 709 710 def strip_quotes(self, text): 711 """ 712 Strip quotes from message by Nicolas Mendoza 713 """ 714 body = [] 715 for line in text.splitlines(): 716 if line.startswith(self.EMAIL_QUOTE): 717 continue 718 body.append(line) 719 720 return ('\n'.join(body)) 721 697 722 698 723 def wrap_text(self, text, replace_whitespace = False): 699 724 """ 700 Will break a lines longer then given length into several small lines of size701 given length725 Will break a lines longer then given length into several small 726 lines of size given length 702 727 """ 703 728 import textwrap … … 746 771 body_text = self.strip_signature(body_text) 747 772 773 if self.STRIP_QUOTES: 774 body_text = self.strip_quotes(body_text) 775 748 776 if self.USE_TEXTWRAP: 749 777 body_text = self.wrap_text(body_text) … … 815 843 except Exception, e: 816 844 print 'TD: Failure sending notification on creation of ticket #%s: %s' %(tkt['id'], e) 817 818 def mail_line(self, str):819 return '%s %s' % (self.comment, str)820 821 845 822 846 def html_mailto_link(self, subject, id, body):
Note: See TracChangeset
for help on using the changeset viewer.