📄 message-callbacks.c
字号:
/* TradeClient <http://tradeclient.sourceforge.net> * $Id: message-callbacks.c,v 1.11 2001/03/20 22:19:33 ttabner Exp $ * * Copyright (C) 1999-2000 Bynari Inc. * Copyright (C) 2001 Project TradeClient * * LGPL * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Library General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library * General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#include "puma.h"#ifdef write#undef write#endifvoid message_window_destroy (GtkWidget *widget, GdkEvent *event, gpointer data) { GtkCList *clist=GTK_CLIST (lookup_widget (widget, "attachment_clist")); Attachment *att; att=gtk_clist_get_row_data (clist, 0); attachments_destroy (att); gtk_widget_destroy (lookup_widget (widget, "message"));// if (data) free (data);}void message_window_close (GtkWidget *widget, gpointer data) { message_window_destroy (widget, NULL, data);}void message_window_replyto (GtkWidget *widget, gpointer data) { send_on_its_merry_way_stream (data, "Re:");}void message_window_replytoall (GtkWidget *widget, gpointer data) { reply_to_all_stream ((char *)data); }void message_window_forward (GtkWidget *widget, gpointer data) { send_on_its_merry_way_stream (data, "Fwd:");}void message_window_save (GtkWidget *widget, gpointer data) { GtkWidget *subject=lookup_widget (widget, "subjectline"); save_string (strdup (data), strlen ((char *)data), gtk_entry_get_text (GTK_ENTRY (subject)));}void message_attachment_save (GtkWidget *widget, gpointer data) { Attachment *att=(Attachment *)data; char *message=att->msg; char *matt; matt=mime_get_attachment (message, att); message_save_body (NULL, (gpointer *)matt);}void message_window_print (GtkWidget *widget, gpointer data) { char *full_message=(char *)data; int fd; int flags = tm_globs->flags; char *buf = (char *)malloc (2048 * sizeof (char)); char *message; Attachment *att = (Attachment *) calloc (1, sizeof (Attachment)); insert_message ("Printing Message ... "); if (!full_message) return; att->mtype = strdup ("dummyatt"); tm_globs->flags &=~SHOW_ALL_HEADER; tm_globs->flags |=SHOW_SOME_HEADER; message = mime_process (full_message, att, 0); tm_globs->flags = flags;#if DEBUG > 4 printf ("==== begin printed message =====\n%s\n===== end printed message =====\n",message);#endif fd=open ("/tmp/tradeclient/print-tmp", O_TRUNC | O_WRONLY); write (fd, full_message, strlen (full_message)); close (fd); snprintf(buf, 2048, "%s /tmp/tradeclient/print-tmp", tm_globs->printer); system (buf) ; if (message) free (message); if (att->mtype) free (att->mtype); if (att) free (att); free (buf); unlink ("/tmp/tradeclient/print-tmp"); insert_message ("Done!\n");}void message_attachment_view (GtkWidget *widget, gpointer data) { Attachment *att=(Attachment *)data; Attachment *att2=(Attachment *)calloc (1, sizeof(Attachment)); char *message=att->msg; char *matt=mime_get_attachment (message, att); int hsize=message_hsize (matt); char *head=(char *)calloc(hsize+2, sizeof(char)); char *retmsg; Header_Info *hinfo; memmove (head, matt, hsize); hinfo=parse_header (head); free (head); if (hinfo) { if (strncasecmp (hinfo->content_type, "message/rfc822", 14)==0) { message_window_new_stream (matt+hsize); } else if (strncasecmp (hinfo->content_type, "multipart/digest", 16)==0) { digest_window_create_stream (strdup(matt)); } else if (mime_handle (hinfo->content_type)==MIMEHANDLE_EXT) { message_use_ext_prog (NULL, strdup (matt)); } else { retmsg=mime_process (matt, att2, 1); if ((retmsg)&&(retmsg[0])) create_docsource_stream (retmsg); } /* if (strncasecmp (hinfo->content_type, "message/rfc822", 14)==0) { message_window_new_stream (matt+hsize); } else if (mime_handle (hinfo->content_type)==MIMEHANDLE_EXT) { message_use_ext_prog (NULL, strdup (matt)); } else { create_docsource_stream (strdup(matt)); }*/ } if (matt) free (matt); free (att2); destroy_hinfo (hinfo);}void message_attachment_view_source (GtkWidget *widget, gpointer data) { Attachment *att=(Attachment *)data; char *message=att->msg; char *matt=mime_get_attachment (message, att); int hsize=message_hsize (matt); char *head=(char *)calloc(hsize+2, sizeof(char)); Header_Info *hinfo;#if DEBUG > 1 printf ("hsize=%d\n", hsize);#endif memmove (head, matt, hsize); hinfo=parse_header (head); free (head); if (hinfo) { create_docsource_stream (strdup(matt)); } if (matt) free (matt); destroy_hinfo (hinfo);}void message_attachment_open_with (GtkWidget *widget, gpointer data) {// Message *msg=tm_globs->msg_selected;// Attachment *att=(Attachment *)data;#if DEBUG > 1 printf ("Viewing attachment with external progam\n");#endif}void message_attachment_event (GtkWidget *widget, GdkEventButton *event, gpointer data) { GtkWidget *popup; int row, column; Attachment *att; row = column = 0 ; gtk_clist_get_selection_info (GTK_CLIST (widget), event->x, event->y, &row, &column); if (row < GTK_CLIST (widget)->rows) { att=gtk_clist_get_row_data (GTK_CLIST (widget), row); att->msg=data; if (event->button==3) { gtk_clist_select_row (GTK_CLIST (widget), row, 0); popup=create_mime_popup (); if (GTK_IS_WIDGET (tm_globs->mime_popup)) gtk_widget_destroy (tm_globs->mime_popup); tm_globs->mime_popup=popup; gtk_signal_connect (GTK_OBJECT (lookup_widget (popup, "menuitem1")), "activate", GTK_SIGNAL_FUNC (message_attachment_save), (gpointer)att); gtk_signal_connect (GTK_OBJECT (lookup_widget (popup, "menuitem2")), "activate", GTK_SIGNAL_FUNC (message_attachment_view), (gpointer)att); gtk_signal_connect (GTK_OBJECT (lookup_widget (popup, "menuitem3")), "activate", GTK_SIGNAL_FUNC (message_attachment_open_with), (gpointer)att); gtk_signal_connect (GTK_OBJECT (lookup_widget (popup, "menuitem4")), "activate", GTK_SIGNAL_FUNC (message_attachment_view_source), (gpointer)att); gtk_menu_popup (GTK_MENU (popup), NULL, NULL, NULL, NULL, 3, 0); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -