@@ -165,13 +165,16 @@ function update($event_name,$data) {
165165 }
166166 }
167167
168- // Write the custom mailfilter script, if mailfilter recipe has changed
169- if ($ data ["old " ]["custom_mailfilter " ] != $ data ["new " ]["custom_mailfilter " ]
170- or $ data ["old " ]["move_junk " ] != $ data ["new " ]["move_junk " ]
171- or $ data ["old " ]["cc " ] != $ data ["new " ]["cc " ]) {
168+ // Write the custom mailfilter script, if mailfilter recipe has changed
169+ if ($ data ["old " ]["custom_mailfilter " ] != $ data ["new " ]["custom_mailfilter " ]
170+ or $ data ["old " ]["move_junk " ] != $ data ["new " ]["move_junk " ]
171+ or $ data ["old " ]["cc " ] != $ data ["new " ]["cc " ]) {
172172
173173 $ app ->log ("Mailfilter config has been changed " ,LOGLEVEL_DEBUG );
174- if (trim ($ data ["new " ]["custom_mailfilter " ]) != '' or $ data ["new " ]["move_junk " ] != 'n ' ) {
174+ if (trim ($ data ["new " ]["custom_mailfilter " ]) != ''
175+ or $ data ["new " ]["move_junk " ] != 'n '
176+ or $ data ["new " ]["cc " ] != '' ) {
177+
175178 // Delete the old filter recipe
176179 $ email_parts = explode ("@ " ,$ data ["old " ]["email " ]);
177180 $ file = $ this ->mailfilter_config_dir .'/ ' .$ email_parts [1 ].'/ ' .$ email_parts [0 ].'/.mailfilter ' ;
@@ -189,6 +192,7 @@ function update($event_name,$data) {
189192
190193 if ($ data ["new " ]["cc " ] != '' ) {
191194 $ mailfilter_content .= "cc \"! " .$ data ["new " ]["cc " ]."\"\n" ;
195+ $ app ->log ("Added CC address " .$ data ["new " ]["cc " ].' to mailfilter file. ' ,LOGLEVEL_DEBUG );
192196 }
193197
194198 if ($ data ["new " ]["move_junk " ] == 'y ' ) {
@@ -211,7 +215,6 @@ function update($event_name,$data) {
211215 if (is_file ($ file )) unlink ($ file ) or $ app ->log ("Unable to delete file: $ file " ,LOGLEVEL_WARN );
212216 $ app ->log ("Deleting custom Mailfiter " .$ file ,LOGLEVEL_DEBUG );
213217 }
214- //}
215218 }
216219 }
217220
0 commit comments