@@ -1184,7 +1184,7 @@ int do_erase_old(int days, char * mbtrash_name)
1184
1184
/* Move message to Trash if the message is in INBOX mailbox and date less then passed date. */
1185
1185
int do_move_old (int days , char * mbinbox_name , char * mbtrash_name )
1186
1186
{
1187
- Connection_T c ; ResultSet_T r ; ResultSet_T r1 ; PreparedStatement_T s ; PreparedStatement_T s1 ; PreparedStatement_T s2 ;
1187
+ Connection_T c ; ResultSet_T r ; ResultSet_T r1 ; PreparedStatement_T s ; PreparedStatement_T s1 ;
1188
1188
int skip = 1 ;
1189
1189
char expire [DEF_FRAGSIZE ];
1190
1190
uint64_t mailbox_to ;
@@ -1200,9 +1200,7 @@ int do_move_old (int days, char * mbinbox_name, char * mbtrash_name)
1200
1200
"WHERE mb.name = ? AND msg.status < %d "
1201
1201
"AND phys.internal_date < %s" ,
1202
1202
DBPFX , DBPFX , DBPFX , MESSAGE_STATUS_DELETE , expire );
1203
-
1204
1203
s1 = db_stmt_prepare (c , "SELECT mailbox_idnr FROM %smailboxes WHERE owner_idnr = ? AND name = ?" , DBPFX );
1205
- s2 = db_stmt_prepare (c , "UPDATE %smessages SET mailbox_idnr = ? WHERE message_idnr = ?" , DBPFX );
1206
1204
1207
1205
db_stmt_set_str (s , 1 , mbinbox_name );
1208
1206
@@ -1225,9 +1223,7 @@ int do_move_old (int days, char * mbinbox_name, char * mbtrash_name)
1225
1223
}
1226
1224
1227
1225
if (!skip ) {
1228
- db_stmt_set_u64 (s2 ,1 ,mailbox_to );
1229
- db_stmt_set_u64 (s2 ,2 ,id );
1230
- db_stmt_exec (s2 );
1226
+ db_move_message (id , mailbox_to );
1231
1227
db_mailbox_seq_update (mailbox_to , 0 );
1232
1228
db_mailbox_seq_update (mailbox_from , 0 );
1233
1229
}
0 commit comments