[MERGE] thunderbird fix by tfr and atp lp:778466 lp:785611

bzr revid: tfr@openerp.com-20110616101852-19wwxp7bimwaonp5
This commit is contained in:
tfr@openerp.com 2011-06-16 12:18:52 +02:00
commit a8e1dee41c
8 changed files with 17 additions and 63 deletions

View File

@ -24,6 +24,7 @@ import base64
import email
import tools
import binascii
import dateutil.parser
class email_server_tools(osv.osv_memory):
_inherit = "email.server.tools"
def history_message(self, cr, uid, model, res_id, message, context=None):
@ -73,7 +74,8 @@ class email_server_tools(osv.osv_memory):
msg['reply'] = self._decode_header(msg_txt.get('Reply-To'))
if 'Date' in fields:
msg['date'] = self._decode_header(msg_txt.get('Date'))
date = self._decode_header(msg_txt.get('Date'))
msg['date'] = dateutil.parser.parse(date).strftime("%Y-%m-%d %H:%M:%S")
if 'Content-Transfer-Encoding' in fields:
msg['encoding'] = msg_txt.get('Content-Transfer-Encoding')

Binary file not shown.

View File

@ -148,17 +148,10 @@ function getPredefinedFolder(type) {
// type 2 = selected messages
var use_dir = "mboximport.exportMSG.use_dir";
var dir_path="";
if(navigator.userAgent.indexOf('Linux')!= -1){
dir_path ="/tmp"
}
else if(navigator.userAgent.indexOf('Win')!= -1){
dir_path ="C:\\"
}
else if(navigator.userAgent.indexOf('Mac OS X')!= -1){
dir_path ="/tmp"
}
var dirService = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).get("Home", Components.interfaces.nsIFile);
var homeDir = dirService.path;
var dir_path = ((homeDir.search(/\\/) != -1) ? homeDir + "\\" : homeDir + "/")
try {
var localFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
localFile.initWithPath(dir_path);

View File

@ -38,6 +38,10 @@ function searchmail()
return true
}
var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
var dirService = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).get("Home", Components.interfaces.nsIFile);
var homeDir = dirService.path;
var path = ((homeDir.search(/\\/) != -1) ? homeDir + "\\" : homeDir + "/")
var version_obj = prefService.getBranch("extensions.");
version_obj.QueryInterface(Components.interfaces.nsIPrefBranch2);
version = version_obj.getCharPref("lastAppVersion");
@ -148,19 +152,7 @@ function searchmail()
url[i] = currentAttachments[i].url;
name[i] = currentAttachments[i].displayName;
var obj = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
if(navigator.userAgent.indexOf('Linux')!= -1){
obj.initWithPath("/tmp/");
}
else if(navigator.userAgent.indexOf('Win')!= -1){
obj.initWithPath("c:\\");
}
else if(navigator.userAgent.indexOf('Mac OS X')!= -1){
obj.initWithPath("/tmp/");
}
else{
alert("Not Compatible for this Operating System");
false();
}
obj.initWithPath(path)
//saving the attachment files in system's temp folder
test[i] = messenger.saveAttachmentToFolder(contentType[i],url[i],name[i],uri,obj);
}
@ -335,15 +327,10 @@ var listDocumentHandler = {
//function to archive the mail content through xmlrpc request
function parse_eml(){
var fpath =""
if(navigator.userAgent.indexOf('Linux')!= -1){
fpath ="/tmp/"
}
else if(navigator.userAgent.indexOf('Win')!= -1){
fpath ="C:\\"
}
else if(navigator.userAgent.indexOf('Mac OS X')!= -1){
fpath ="/tmp/"
}
var dirService = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).get("Home", Components.interfaces.nsIFile);
var homeDir = dirService.path;
fpath = ((homeDir.search(/\\/) != -1) ? homeDir + "\\" : homeDir + "/")
name = fpath + getPref().getCharPref('fname') +".eml"
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath( name );

View File

@ -1434,34 +1434,6 @@ var listArchiveHandler = {
}
//function to archive the mail content through xmlrpc request
function parse_eml(){
var fpath =""
if(navigator.userAgent.indexOf('Linux')!= -1){
fpath ="/tmp/"
}
else if(navigator.userAgent.indexOf('Win')!= -1){
fpath ="C:\\"
}
else if(navigator.userAgent.indexOf('Mac OS X')!= -1){
fpath ="/tmp/"
}
name = fpath + getFileName() +".eml"
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath( name );
if ( file.exists() == false ) {
return null;
} else {
var is = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance( Components.interfaces.nsIFileInputStream );
is.init( file,0x01, 00004, null);
var sis = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance( Components.interfaces.nsIScriptableInputStream );
sis.init( is );
var output = sis.read( sis.available() );
return output
}
}
function upload_archivemail()
{
list_documents = document.getElementById('listSearchBox')
@ -1484,6 +1456,7 @@ function upload_archivemail()
strobj.data = 'thunderbird.partner';
var resobj = xmlRpcClient.createType(xmlRpcClient.STRING,{});
for(i=0;i<cnt;i++)
{
var object = list_documents.getSelectedItem(i);
@ -1497,7 +1470,6 @@ function upload_archivemail()
var a = ['ref_ids','message'];
var b = [ref_ids, eml_string];
var arrofarr = dictcontact(a,b);
xmlRpcClient.asyncCall(listArchiveHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6);
}