Index: /sandbox/2.5.1-expresso1/prototype/modules/mail/templates/attachment_search.ejs =================================================================== --- /sandbox/2.5.1-expresso1/prototype/modules/mail/templates/attachment_search.ejs (revision 7895) +++ /sandbox/2.5.1-expresso1/prototype/modules/mail/templates/attachment_search.ejs (revision 7901) @@ -2,5 +2,6 @@
Index: /sandbox/2.5.1-expresso1/prototype/modules/attach_message/attach_message.js =================================================================== --- /sandbox/2.5.1-expresso1/prototype/modules/attach_message/attach_message.js (revision 7900) +++ /sandbox/2.5.1-expresso1/prototype/modules/attach_message/attach_message.js (revision 7901) @@ -700,7 +700,47 @@ } var search_imap_messages = function(param, folder){ + var filters = [ + [ + 'from', + '*', + param + ], + [ + 'OR', + 'to', + '*', + param + ], + [ + 'OR', + 'subject', + '*', + param + ] + ]; + + var data = DataLayer.get( 'message', { filter: filters, criteria: { properties: { context: { folder: folder } } } }, true ); + var tmp = [DataLayer.get( 'message', {filter: [ "msgNumber", "IN", data ], criteria: { properties: { context: { folder: folder } } } })]; + msgs = []; - - // Obrigatório o retorno do array com mensagens... + console.log(tmp); + $.each(tmp, function(i, msg){ + flag = msg['flag']; + id = msg['msg_number']; + var message = {}; + + message['msg_number'] = id; + message['flags'] = flag; + message['from.name'] = msg['from']; + message['subject'] = msg['subject']; + message['timestamp'] = msg['timestamp']; + message['size'] = msg['size']; + message['id'] = id; + msgs.push( message ); + + }); + + console.log(msgs); + return msgs; }