|
5#
楼主 |
发表于 2016-4-20 23:28:07
|
只看该作者
- nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream *stream)
- nsDocumentOpenInfo::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt,
- nsImapCacheStreamListener::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt, nsIInputStream * aInStream, uint32_t aSourceOffset, uint32_t aCount)
- nsresult nsStreamConverter::OnDataAvailable(nsIRequest *request,
- D:\svn\Client\ThinkMail_ClientWin_2013\trunk\src\thinkmail\mailnews\mime\src\mimei.cppMimeObject *
- mime_new (MimeObjectClass *clazz, MimeHeaders *hdrs, const char *override_content_type)
- {
- }
- d:\svn\Client\ThinkMail_ClientWin_2013\trunk\src\thinkmail\mailnews\mime\src\mimemoz2.cpp
- extern "C" void *
- mime_bridge_create_display_stream(
- nsIMimeEmitter *newEmitter,
- nsStreamConverter *newPluginObj2,
- nsIURI *uri,
- nsMimeOutputType format_out,
- uint32_t whattodo,
- nsIChannel *aChannel)
- {
- MimeObject *obj;
- mime_stream_data *msd;
- nsMIMESession *stream = 0;
- obj = mime_new ((MimeObjectClass *)&mimeMessageClass, (MimeHeaders *) NULL, MESSAGE_RFC822);
- }
- extern "C" int
- mime_display_stream_write (nsMIMESession *stream,
- const char* buf, ///所有网络流源码数据都在这个buf里
- int32_t size){
- mime_stream_data *msd = (mime_stream_data *) ((nsMIMESession *)stream)->data_object;
- MimeObject *obj = (msd ? msd->obj : 0);
- return obj->clazz->parse_buffer((char *) buf, size, obj);
- }
- d:\svn\Client\ThinkMail_ClientWin_2013\trunk\src\thinkmail\mailnews\mime\src\mimeobj.cpp
- MimeObject_parse_buffer (const char *buffer, int32_t size, MimeObject *obj)
- {
- return mime_LineBuffer (buffer, size,
- &obj->ibuffer, &obj->ibuffer_size, &obj->ibuffer_fp,
- true,
- ((int (*) (char *, int32_t, void *))
- /* This cast is to turn void into MimeObject */
- obj->clazz->parse_line),
- obj);
- }
- d:\svn\Client\ThinkMail_ClientWin_2013\trunk\src\thinkmail\mailnews\mime\src\mimebuf.cpp
- extern "C" int mime_LineBuffer (const char *net_buffer, int32_t net_buffer_size, char **bufferP, int32_t *buffer_sizeP, uint32_t *buffer_fpP,
- bool convert_newlines_p,
- int32_t (* per_line_fn) (char *line, uint32_t line_length,
- void *closure),
- void *closure)
- {
- while (net_buffer_size > 0) //循环解析每个字符 {
- for (s = net_buffer; s < net_buffer_end; s++) //过虑得到一行字符
- //得到的一行字符放bufferP中
- status = convert_and_send_buffer(*bufferP, *buffer_fpP,
- convert_newlines_p,
- per_line_fn, closure);
- }
- }
- convert_and_send_buffer(char* buf, int length, bool convert_newlines_p,
- int32_t (* per_line_fn) (char *line,
- uint32_t line_length,
- void *closure),
- void *closure)
- {
- return (*per_line_fn)(buf, length, closure);
- }
- d:\svn\Client\ThinkMail_ClientWin_2013\trunk\src\thinkmail\mailnews\mime\src\mimemsg.cpp
- MimeMessage_parse_line (const char *aLine, int32_t aLength, MimeObject *obj) //解析消息中的每行数据
- {//////////////先完成头部分获取///////////////////
- MimeMessage *msg = (MimeMessage *) obj;
- msg->hdrs = MimeHeaders_new(); //创建消息头
- status = MimeHeaders_parse_line(line, length, msg->hdrs);//解析消息头
- status = MimeMessage_close_headers(obj);//完成消息头解析
- //////有子项的再调用///即已经解析出新的节点(Multipart/report;)了,后面的内容就是在此基础上进行解析
- if (msg->container.nchildren)
- {
- if (nl)
- return kid->clazz->parse_buffer (line, length, kid);//重新递归解析这个子节点
- }
- }
- static int MimeMessage_close_headers (MimeObject *obj)//获取完整头部后的操作
- {
- MimeMessage *msg = (MimeMessage *) obj;
- int status = 0;
- char *ct = 0; /* Content-Type header */
- status = MimeMessage_write_headers_html(obj); //写入头信息
- body = mime_create(ct, msg->hdrs, obj->options);
- status = ((MimeContainerClass *) obj->clazz)->add_child (obj, body); //在原来默认的父节点(Multipart/rfc8233)上加入新的节点(Multipart/report;)
- status = body->clazz->parse_begin(body);
- mimeEmitterStartBody(obj->options, (obj->options->headers == MimeHeadersNone), msgID, outCharset);
- }
-
- D:\svn\Client\ThinkMail_ClientWin_2013\trunk\src\thinkmail\mailnews\mime\src\mimei.cppmime_create (const char *content_type, MimeHeaders *hdrs,
- MimeDisplayOptions *opts, bool forceInline /* = false */)
- {
- clazz = mime_find_class(content_type, hdrs, opts, false); //获取子类型 这里是Multipart/report; 由于report不支持默认为 mimeMultipartMixedClass
- }
- MimeObjectClass *
- mime_find_class (const char *content_type, MimeHeaders *hdrs,
- MimeDisplayOptions *opts, bool exact_match_p)
- {
- bool basic_formatting = (html_as == 4) ||
- (opts && opts->format_out == nsMimeOutput::nsMimeMessageAttach);
- if (!PL_strcasecmp(content_type+10, "alternative"))
- clazz = basic_formatting ? (MimeObjectClass *)&mimeMultipartMixedClass :
- (MimeObjectClass *)&mimeMultipartAlternativeClass;
- else if (!PL_strcasecmp(content_type+10, "related"))
- }
- d:\svn\Client\ThinkMail_ClientWin_2013\trunk\src\thinkmail\mailnews\mime\src\mimemult.cpp
- static int
- MimeMultipart_parse_line (const char *line, int32_t length, MimeObject *obj)
- {
- mult->state = MimeMultipartHeaders; //新段开始mult->hdrs = MimeHeaders_new();
- status = ((MimeMultipartClass *) obj->clazz)->create_child(obj); //段中出现空行时,创建新节点 ---MimeMultipart_create_child
- status = ((MimeMultipartClass *) obj->clazz)->create_child(obj);
- }
- d:\svn\Client\ThinkMail_ClientWin_2013\trunk\src\thinkmail\mailnews\mime\src\mimemult.cpp
- MimeMultipart_create_child(MimeObject *obj)
- {
- char *ct = (mult->hdrs
- ? MimeHeaders_get (mult->hdrs, HEADER_CONTENT_TYPE,
- true, false)
- : 0);
- }
复制代码 |
|