|
附件管理逻辑:
异步调用查询接口,系统已经提供回调接口
遗留问题:
是否附件判断的标准。
主要问题:
---sqlite实时生成原理
附件管理,帐号里面邮件全部彻底删除,附件还存在 ----更新的实时性,及时性。
附件为eml格式的附件,附件管理中查询不出来 --处理
某些邮件夹不进行附件的收集,已修改,参考:https://developer.mozilla.org/en ... bird/Gloda_indexing
研究原理,把imap新同步过来的字段:RM_MID 能否存储到mbox文件中,同时也保存到sqlite全局数据库中,并研究出根据mbox文件动态生成出msf文件和sqlite中
目前实现原理:对附件的操作,映射到主界面中对邮件的操作,包含两步: ----针对单个选中的附件
a.选中附件,把当前附件对应的相关信息(消息头、附件在消息中的位置)发送消息邮件列表,并让邮件列表选中当前附件所在的邮件。
observerService.notifyObservers(aMsgHdr, "am_downattach", partName);
this.threadTree.view.selection.select(index);
b.选中当前邮件列表中对应的邮件后,再发送消息,通知邮件内容显示面板(含附件列表),再根据当前选中的附件信息,过滤出要操作的附件,进行操作
observerService.notifyObservers(subject, "am_downattach2", data);
if ( attachmentList.getItemAtIndex(i).attachment.url.indexOf(prefName) > 0 )
curselectedAttachment.push(attachmentList.selectedItems.attachment);
HandleMultipleAttachments(curselectedAttachment, 'saveAs');
最新逻辑是,只有打开邮件时,才会定位映射到对应的邮件选中,下载和打开附件,则直接从附件信息中提取,直接弹出打开窗口
attachmentsmanagement.js
htmlThreadList.js
msgHdrViewOverlay.js
attachmentContentTypeArray[actionIndex] = attachment.contentType; //image/png
attachmentUrlArray[actionIndex] = attachment.url; //imap://13342978053@imap.139.com:143/fetch%3EUID%3E/INBOX%3E1669?part=1.2&filename=%E5%B1%8F%E8%94%BD%E6%9C%AC%E5%9C%B0%E9%82%AE%E4%BB%B6%E5%A4%B9%E7%9A%84%E5%88%9B%E5%BB%BA.png
attachmentDisplayNameArray[actionIndex] = encodeURI(attachment.name); //屏蔽本地邮件夹的创建.png
attachmentMessageUriArray[actionIndex] = attachment.uri; //imap-message://13342978053@imap.139.com/INBOX#1669
currentAttachments.push(new AttachmentInfo(contentType, url, displayName,
uri, isExternalAttachment,
size));
//尝试不通过选中邮件,而获取附件的上面四个主要信息。
msgHdrViewOverlay.js
var messageHeaderSink = {
..
handleAttachment: function(contentType, url, displayName, uri, isExternalAttachment)
{
......
currentAttachments.push(new AttachmentInfo(contentType, url, displayName,
uri, isExternalAttachment,
size));
},
}
mailWindow.js
function InitMsgWindow()
{
msgWindow.msgHeaderSink = messageHeaderSink;
}
nsMimeHtmlEmitter.cpp
nsMimeHtmlDisplayEmitter::StartAttachment(...){
rv = GetHeaderSink(getter_AddRefs(headerSink));
headerSink->HandleAttachment(contentTyp...);
}
nsMimeHtmlDisplayEmitter::GetHeaderSink(nsIMsgHeaderSink ** aHeaderSink){ msgWindow->GetMsgHeaderSink(getter_AddRefs(mHeaderSink));}
按附件名搜索
var query = Gloda.newQuery(Gloda.NOUN_MESSAGE);
query.attachmentTypes();
query.attachmentNamesMatch(AttachName);
gloda.js
_bindAttribute: function gloda_ns_bindAttr(aAttrDef, aSubjectNounDef)
datastore.js
queryFromQuery: function gloda_ds_queryFromQuery(aQuery, aListener,
原来的查询语句 查单个字查不出来
//查附件名关键字: 功
SELECT * FROM messages INNER JOIN messagesText ON messages.id = messagesText.rowid WHERE (id IN (SELECT messageID FROM messageAttributes WHERE (attributeID = 49) INTERSECT SELECT docid FROM messagesText WHERE attachmentNames MATCH ?) AND +deleted = 0 AND +folderID IS NOT NULL AND +messageKey IS NOT NULL) ARGS: 功
//查询所有附件:
SELECT * FROM messages INNER JOIN messagesText ON messages.id = messagesText.rowid WHERE (id IN (SELECT messageID FROM messageAttributes WHERE (attributeID = 49)) AND +deleted = 0 AND +folderID IS NOT NULL AND +messageKey IS NOT NULL) ARGS:
修改后的查询语句 :
SELECT * FROM messages INNER JOIN messagesText ON messages.id = messagesText.rowid WHERE (id IN (SELECT messageID FROM messageAttributes WHERE (attributeID = 49) INTERSECT SELECT docid FROM messagesText WHERE attachmentNames like '%功%') AND +deleted = 0 AND +folderID IS NOT NULL AND +messageKey IS NOT NULL) ARGS:
|
|