src/strip.vala
authorAlan Knowles <alan@roojs.com>
Fri, 4 May 2018 05:30:26 +0000 (13:30 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 4 May 2018 05:30:26 +0000 (13:30 +0800)
src/strip.vala

index e47fcf3..80a7b93 100644 (file)
@@ -467,38 +467,35 @@ public class Strip : GLib.Object {
       """.printf(
                int.parse(file_id),
                        this.mysql_escape(mime_type),
-                       this.created_date
+                       this.created_date,
                        this.mysql_escape(this.active_message_x_mailfort_sig)
                ));
 
                                 
  
-                       this.used_space_after += file_size;
+               this.used_space_after += file_size;
                        
                         
-                       file_id = "%d".printf((int)file_id_real);
-                       
-                       
 
-                  if (StripApplication.opt_is_extracting) {
-                               target_fn = StripApplication.opt_target_path + "/" + this.created_dir +"/"+ file_id  + "-" + filename;
-                       } 
-                   
-                   var stored =  "/" + this.created_dir +"/"+ file_id  + "-" + filename;
+           if (StripApplication.opt_is_extracting) {
+                       target_fn = StripApplication.opt_target_path + "/" + this.created_dir +"/"+ file_id  + "-" + filename;
+               } 
                    
-                       this.query("""
-                               UPDATE
-                                       Attachment
-                               SET
-                                       stored_filename = '%s'
-                               WHERE
-                                       id = %s
-                       """.printf(
-                               this.mysql_escape( stored),
-                               file_id
-                       ));
+           var stored =  "/" + this.created_dir +"/"+ file_id  + "-" + filename;
+                this.query("""
                
-               } 
+                       SELECT attachment_update_store(
+                               %d, -- in_id INT(11),
+                               '%s'  -- in_store_filename varchar(255),
+                        
+                               
+                               ) as result
+      """.printf(
+               int.parse(file_id),
+                        this.mysql_escape( stored)
+                       this.mysql_escape(this.active_message_x_mailfort_sig)
+               ));   
+                         
                
         var rep = new GMime.Part.with_type("text","html");
         // we have to set up a redirect server - to redirect hpasite... to their internal service..