Пример #1
0
void summaries_refresh(Logbook *logbook)
{
  gchar *sstdout, *sstderr;
  gchar *html_src;
  GError *error=NULL;
  char *argv[32];
  int exit_code;

  argv[0] = scripter_get_script_filename(logbook->summaries_scripter);
  argv[1] = logbook->db_filename;
  scripter_get_parameter_values(logbook->summaries_scripter, argv+2);

  if (spawn_script(NULL, argv, NULL, "", &sstdout, &sstderr, &exit_code, &error, NULL, NULL)) {
    html_src = sstdout;
  } else {
    html_src = error->message;
  }

  html_document_clear(logbook->summaries_html_document);
  if (html_document_open_stream (logbook->summaries_html_document, "text/html")) {
    html_document_write_stream (logbook->summaries_html_document, html_src, strlen(html_src)); 
  }

  html_document_close_stream(logbook->summaries_html_document);
  g_free(sstderr);
  g_free(logbook->summaries_html_src);
  logbook->summaries_html_src = sstdout;

}
Пример #2
0
/******************************************************************
 Shows a given mail (part)
*******************************************************************/
static void show_mail(struct Read_Data *data, struct mail *m)
{
	char *buf;
	int buf_len;

	mail_decode(m);
	mail_decoded_data(m,(void**)&buf,&buf_len);

	if (!mystricmp(m->content_type,"text") && !mystricmp(m->content_subtype,"plain"))
	{
		char *html_mail;

		html_mail = text2html(buf, buf_len,TEXT2HTML_ENDBODY_TAG|TEXT2HTML_FIXED_FONT/*|(user.config.read_wordwrap?0:TEXT2HTML_NOWRAP)*/,"");//<FONT FACE=\"fixedmail\" SIZE=\"+1\">");
		if (html_mail)
		{
			#if 0
			GtkTextBuffer *buffer;
			GtkTextIter iter;
			buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(data->text_view));
			gtk_text_buffer_get_iter_at_line(buffer,&iter,0);
			gtk_text_buffer_insert(buffer,&iter,m->html_header,strlen(m->html_header));
			gtk_text_buffer_insert(buffer,&iter,html_mail,strlen(html_mail));
			#else
			html_document_clear(data->html_document);

			if (html_document_open_stream(data->html_document, "text/html"))
			{
				if (m->html_header) html_document_write_stream(data->html_document, m->html_header, strlen(m->html_header)-14 /* FIXME: hacky, remove </BODY></HTML>*/);
				html_document_write_stream(data->html_document, html_mail, strlen(html_mail));
				html_document_close_stream(data->html_document);
			}

			//printf("%s%s\n",m->html_header,html_mail);
			#endif
		}

	} else
	{
		#if 0
		GtkTextBuffer *buffer;
		GtkTextIter iter;
		buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(data->text_view));
		gtk_text_buffer_get_iter_at_line(buffer,&iter,0);
		gtk_text_buffer_insert(buffer,&iter,m->html_header,strlen(m->html_header));
		gtk_text_buffer_insert(buffer,&iter,html_mail,strlen(html_mail));
		gtk_text_buffer_insert(buffer,&iter,buf,buf_len);
		#endif
	}

#if 0
	if (!data->attachments_group)
	{
		mail_decode(m);
		insert_text(data, m);
	} else
	{
		DoMethod(data->attachments_group, MUIM_SetUDataOnce, m, MUIA_Selected, 1);
	}
#endif
}