XFE_FolderFrame::XFE_FolderFrame(Widget toplevel, XFE_Frame *parent_frame, Chrome *chromespec) : XFE_Frame("MailFolder", toplevel, parent_frame, FRAME_MAILNEWS_FOLDER, chromespec) { INTL_CharSetInfo c = LO_GetDocumentCharacterSetInfo(m_context); INTL_SetCSIWinCSID(c, INTL_DocToWinCharSetID (CONTEXT_DATA (m_context)->xfe_doc_csid)); geometryPrefName = "mail.folder"; D( printf ("in XFE_FolderFrame::XFE_FolderFrame()\n");)
PRIVATE void net_report_autodetect(void *closure, CCCDataObject obj, uint16 doc_csid) { NetStreamData *nsd = (NetStreamData *)closure; iDocumentContext doc_context = nsd->current_stream->window_id; CCCFunc cvtfunc = INTL_GetCCCCvtfunc(obj); INTL_CharSetInfo c = LO_GetDocumentCharacterSetInfo(doc_context); INTL_SetCSIDocCSID(c, doc_csid); /* I hope it is okay, to set the win_csid */ INTL_SetCSIWinCSID(c, INTL_GetCCCToCSID(obj)); if (cvtfunc == NULL) nsd->current_stream->put_block = (MKStreamWriteFunc) net_NoCharCodeConv; }
PUBLIC NET_StreamClass * net_ColorHTMLStream (int format_out, void *data_obj, URL_Struct *URL_s, MWContext *window_id) { DataObject* obj; char *new_markup=0; char *new_url=0; char *old_url; int status, type; NET_StreamClass *next_stream, *new_stream; Bool is_html_stream = FALSE; INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(window_id); INTL_CharSetInfo next_csi; TRACEMSG(("Setting up ColorHTML stream. Have URL: %s\n", URL_s->address)); /* treat the stream as html if the closure data says * it's HTML and it is also not a mail or news message */ type = NET_URL_Type(URL_s->address); if(data_obj && !XP_STRCMP((char *)data_obj, TEXT_HTML) && type != MAILBOX_TYPE_URL && type != IMAP_TYPE_URL && type != NEWS_TYPE_URL) is_html_stream = TRUE; /* use a new named window */ StrAllocCopy(URL_s->window_target, VIEW_SOURCE_TARGET_WINDOW_NAME); /* add the url address to the name so that there can be * one view source window per url */ StrAllocCat(URL_s->window_target, URL_s->address); /* zero position_tag to prevent hash lossage */ URL_s->position_tag = 0; /* alloc a new chrome struct and stick it in the URL * so that we can turn off the relavent stuff */ URL_s->window_chrome = XP_NEW(Chrome); if(URL_s->window_chrome) { /* zero everything to turn off all chrome */ XP_MEMSET(URL_s->window_chrome, 0, sizeof(Chrome)); URL_s->window_chrome->type = MWContextDialog; URL_s->window_chrome->show_scrollbar = TRUE; URL_s->window_chrome->allow_resize = TRUE; URL_s->window_chrome->allow_close = TRUE; } /* call the HTML parser */ StrAllocCopy(URL_s->content_type, INTERNAL_PARSER); /* use the view-source: url instead */ StrAllocCopy(new_url, VIEW_SOURCE_URL_PREFIX); StrAllocCat(new_url, URL_s->address); old_url = URL_s->address; URL_s->address = new_url; format_out = FO_PRESENT; /* open next stream */ next_stream = NET_StreamBuilder(format_out, URL_s, window_id); if(!next_stream) { FREE(old_url); return(NULL); } next_csi = LO_GetDocumentCharacterSetInfo(next_stream->window_id); /* jliu: for international's reason, set the value ASAP, so the following stream can share it */ INTL_SetCSIWinCSID(next_csi, INTL_GetCSIWinCSID(csi)); INTL_SetCSIDocCSID(next_csi, INTL_GetCSIDocCSID(csi)); #define DEF_PICS_LABEL "<META http-equiv=PICS-Label content='(PICS-1.0 \"http://home.netscape.com/default_rating\" l gen true r (s 0))'>" /* add a PICS label */ StrAllocCopy(new_markup, DEF_PICS_LABEL); StrAllocCat(new_markup, "<TITLE>"); StrAllocCat(new_markup, XP_GetString(MK_CVCOLOR_SOURCE_OF)); StrAllocCat(new_markup, old_url); StrAllocCat(new_markup, "</TITLE><BODY BGCOLOR=#C0C0C0>"); if(!is_html_stream) StrAllocCat(new_markup, "<PLAINTEXT>"); else StrAllocCat(new_markup, "<PRE>"); FREE(old_url); status = (*next_stream->put_block)(next_stream, new_markup, XP_STRLEN(new_markup)); FREE(new_markup); if(status < 0) { (*next_stream->abort)(next_stream, status); FREE(next_stream); return(NULL); } if(!is_html_stream) return(next_stream); /* else; continue on and build up this stream module * and attach the next stream to it */ new_stream = XP_NEW(NET_StreamClass); if(new_stream == NULL) { (*next_stream->abort)(next_stream, status); FREE(next_stream); return(NULL); } obj = XP_NEW(DataObject); if (obj == NULL) { (*next_stream->abort)(next_stream, status); FREE(next_stream); FREE(new_stream); return(NULL); } XP_MEMSET(obj, 0, sizeof(DataObject)); obj->state = IN_CONTENT; obj->next_stream = next_stream; obj->tag_type = P_UNKNOWN; new_stream->name = "HTML Colorer"; new_stream->complete = (MKStreamCompleteFunc) net_ColorHTMLComplete; new_stream->abort = (MKStreamAbortFunc) net_ColorHTMLAbort; new_stream->put_block = (MKStreamWriteFunc) net_ColorHTMLWrite; new_stream->is_write_ready = (MKStreamWriteReadyFunc) net_ColorHTMLWriteReady; new_stream->data_object = (void *) obj; /* document info object */ new_stream->window_id = window_id; TRACEMSG(("Returning stream from HTMLColorConverter\n")); return new_stream; }