scrub mail content a bit more
darcs-hash:20080721043734-84dde-de49b283d468334abd4ee4375042b7f2d003823c.gz
This commit is contained in:
		@@ -186,10 +186,30 @@ class MailerDaemon {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function cleanup_msg($msg) {
 | 
						function cleanup_msg($msg) {
 | 
				
			||||||
		# XXX: signatures
 | 
							$lines = explode("\n");
 | 
				
			||||||
		# XXX: quoting
 | 
					
 | 
				
			||||||
		preg_replace('/\s+/', ' ', $msg);
 | 
							$output = '';
 | 
				
			||||||
		return $msg;
 | 
					
 | 
				
			||||||
 | 
							foreach ($lines as $line) {
 | 
				
			||||||
 | 
								// skip quotes
 | 
				
			||||||
 | 
								if (preg_match('/^\s*>.*$/', $line)) {
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								// skip start of quote
 | 
				
			||||||
 | 
								if (preg_match('/^\s*On.*wrote:\s*$/', $line)) {
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								// skip everything after a sig
 | 
				
			||||||
 | 
								if (preg_match('/^\s*--+\s*$/', $line) ||
 | 
				
			||||||
 | 
									preg_match('/^\s*__+\s*$/', $line))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								$output .= $line;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							preg_replace('/\s+/', ' ', $output);
 | 
				
			||||||
 | 
							return $output;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user