📄 new-message-callbacks.c
字号:
bcc_line=(char *)calloc (bccl, sizeof (char)); } for (s=tree->children;s;s=s->next) { GtkWidget *item=s->data; GtkWidget *hbox=GTK_BIN (item)->child; GtkBoxChild *typew=GTK_BOX (hbox)->children->next->data; GtkBoxChild *add=GTK_BOX (hbox)->children->next->next->data; char *type=gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (typew->widget)->entry)); char *address=gtk_entry_get_text (GTK_ENTRY (add->widget)); if (strcasecmp (type, "To:")==0) { if (strlen (to_line)>0) { sprintf (to_line, "%s,%s", to_line, address); } else { sprintf (to_line, "%s", address); } } if (strcasecmp (type, "Cc:")==0) { if (strlen (cc_line)>0) { sprintf (cc_line, "%s,%s", cc_line, address); } else { sprintf (cc_line, "%s", address); } } if (strcasecmp (type, "Bcc:")==0) { if (strlen (bcc_line)>0) { sprintf (bcc_line, "%s,%s", bcc_line, address); } else { sprintf (bcc_line, "%s", address); } } } *to=to_line; *cc=cc_line; *bcc=bcc_line;#if DEBUG>=1 printf ("to_line: %s\n", to_line); printf ("cc_line: %s\n", cc_line); printf ("bcc_line: %s\n", bcc_line); printf ("to: %s\n", *to); printf ("cc: %s\n", *cc); printf ("bcc: %s\n", *bcc); printf ("**********\n");#endif tmp_full_message=mime_encode (sender, replyto, org, to_line, cc_line, bcc_line, subject_line, timestamp, alist, GTK_TOGGLE_BUTTON (lookup_widget (parent, "return_receipt"))->active, get_priority_string(parent)); free (body); llist_blow_away (alist); full_message=message_fix_for_send (tmp_full_message); free (tmp_full_message); if (replyto) free (replyto); if (org) free (org); if (sender) free (sender); if( timestamp ) free(timestamp) ; return full_message;}MailMessage *new_new_message_generate_full (GtkWidget *parent, char **to, char **cc, char **bcc) { char *to_line=NULL, *cc_line=NULL, *bcc_line=NULL; char *subject_line=gtk_entry_get_text (GTK_ENTRY(lookup_widget (parent, "subject_entry"))); char *body=gtk_editable_get_chars (GTK_EDITABLE(lookup_widget (parent, "body_textbox")), 0, -1); GtkCList *clist=GTK_CLIST (lookup_widget (parent, "attachment_clist")); GtkTree *tree=GTK_TREE (lw (parent, "recip_tree")); int popid=seek_popaccount_by_name (gtk_entry_get_text (GTK_ENTRY (lookup_widget (parent, "account_to_use")))); PopAccount *pop=seek_popaccount (popid); MailMessage *mmessage=NULL; char *timestamp=generate_timestamp (); char *sender=NULL, *org=NULL, *replyto=NULL; char *tmp, *tmp2; Llist *alist=NULL; AFS *afs=NULL; int i; guint tol=1, ccl=1, bccl=1; GList *s; { char *t=strdup (body); g_free (body); body=t; } if( (pop -> spid != -1) || (pop -> pid != -1) ) { insert_error ( _("Transmission in progress. Please wait until transmission is finished\n") );#if DEBUG > 3 printf( "please report these values: spid = %d, pid = %d,\n", pop -> spid, pop -> pid ) ;#endif return mmessage; } /* should never be null but just to be sure */ if (pop->emailaddr) sender=strdup (pop->emailaddr); else sender=strdup ("Defunct"); if (pop->organization) if (pop->organization[0]!='\0') org=strdup(pop->organization) ; if (tm_globs->organization && org==NULL) if (tm_globs->organization[0]!='\0') org=strdup(tm_globs->organization); else org=(char *)calloc(2, sizeof(char)); else if (!org) org=(char *)calloc(2, sizeof(char)); if (pop->replyaddr) if (pop->replyaddr[0]!='\0') replyto=strdup(pop->replyaddr); if (tm_globs->replyto && replyto==NULL) if (tm_globs->replyto[0]!='\0') replyto=strdup(tm_globs->replyto); else replyto=(char *)calloc(2, sizeof(char)); else if (!replyto) replyto=(char *)calloc(2, sizeof(char));#if DEBUG > 3 printf( "Value for word wrapping is %d!\n", tm_globs -> wwrap ) ;#endif /* This value is hard coded for now, but will soon have GUI support */ tmp = word_wrap_body( body, tm_globs->wwrap ) ; if( tmp ) { free( body ) ; body = tmp ; } if (pop->flags & USE_THIS_SIG) { if (pop->signature) { tmp=(char *)malloc( strlen (body)+strlen (pop->signature)+4 ) ; sprintf (tmp, "%s\n\n%s", body, pop->signature); free (body); body=tmp; } } else { if (pop->flags & USE_THIS_UNIX_SIG) { tmp=(char *)calloc (1024, sizeof (char)); snprintf (tmp, 1024, "$(HOME)/.sig"); env_srch_rep (tmp); if (!access (tmp, R_OK)) { struct stat buf; int fd; stat (tmp, &buf); fd=open (tmp, O_RDONLY); free (tmp); tmp2=(char *)calloc (buf.st_size+1, sizeof (char)); read (fd, tmp2, buf.st_size+1); close (fd); tmp=(char *)calloc (strlen (body)+strlen (tmp2)+4, sizeof (char)); sprintf (tmp, "%s\n\n%s", body, tmp2); free (tmp2); free (body); body=tmp; } else { perror ("Unable to stat ~/.sig"); free (tmp); } } else { if (tm_globs->flags & USE_SIGNATURE) { tmp=(char *)malloc( strlen (body)+strlen (tm_globs->signature)+4 ) ; sprintf (tmp, "%s\n\n%s", body, tm_globs->signature); free (body); body = tmp ; } } } afs=(AFS *)calloc (1, sizeof (AFS)); afs->data = body ; afs->type=strdup ("text/plain"); alist=llist_append (alist, afs);// } for (i=0;i<clist->rows;i++) { afs=gtk_clist_get_row_data (clist, i);#if DEBUG > 7 printf ("1afs: <%p>\nafs->filename: <%p> '%s'\n", afs, afs->filename, afs->filename);#endif alist=llist_append (alist, afs); } /* generate the to, cc, and bcc lines */ for (s=tree->children;s;s=s->next) { GtkWidget *item=s->data; GtkWidget *hbox=GTK_BIN (item)->child; GtkBoxChild *typew=GTK_BOX (hbox)->children->next->data; GtkBoxChild *add=GTK_BOX (hbox)->children->next->next->data; char *type=gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (typew->widget)->entry)); char *address=gtk_entry_get_text (GTK_ENTRY (add->widget)); if (strcasecmp (type, "To:")==0) { tol+=strlen (address)+3; } if (strcasecmp (type, "Cc:")==0) { ccl+=strlen (address)+3; } if (strcasecmp (type, "Bcc:")==0) { bccl+=strlen (address)+3; } } if (tol>0) { if (tol==1) { insert_message ("You must supply at least one To: recipient\n"); return mmessage; } to_line=(char *)calloc (tol, sizeof (char)); } else { insert_message ("You must supply at least one To: recipient\n"); return mmessage; } if (ccl>0) { cc_line=(char *)calloc (ccl, sizeof (char)); } if (bccl>0) { bcc_line=(char *)calloc (bccl, sizeof (char)); } for (s=tree->children;s;s=s->next) { GtkWidget *item=s->data; GtkWidget *hbox=GTK_BIN (item)->child; GtkBoxChild *typew=GTK_BOX (hbox)->children->next->data; GtkBoxChild *add=GTK_BOX (hbox)->children->next->next->data; char *type=gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (typew->widget)->entry)); char *address=gtk_entry_get_text (GTK_ENTRY (add->widget)); if(!strlen(address)) break; if (strcasecmp (type, "To:")==0) { if (strlen (to_line)>0) { sprintf (to_line, "%s,%s", to_line, address); } else { sprintf (to_line, "%s", address); } } if (strcasecmp (type, "Cc:")==0) { if (strlen (cc_line)>0) { sprintf (cc_line, "%s,%s", cc_line, address); } else { sprintf (cc_line, "%s", address); } } if (strcasecmp (type, "Bcc:")==0) { if (strlen (bcc_line)>0) { sprintf (bcc_line, "%s,%s", bcc_line, address); } else { sprintf (bcc_line, "%s", address); } } } *to=to_line; *cc=cc_line; *bcc=bcc_line;#if DEBUG>=1 printf ("to_line: %s\n", to_line); printf ("cc_line: %s\n", cc_line); printf ("bcc_line: %s\n", bcc_line); printf ("to: %s\n", *to); printf ("cc: %s\n", *cc); printf ("bcc: %s\n", *bcc); printf ("**********\n");#endif /* This will return a mmessage with all attachments MIME encoded. */ mmessage=new_mime_encode (sender, replyto, org, to_line, cc_line, bcc_line, subject_line, timestamp, alist, GTK_TOGGLE_BUTTON (lookup_widget (parent, "return_receipt"))->active, get_priority_string( parent ), get_sensitivity_string( parent ), get_keyword_string( parent ), get_expire_string( parent ), get_replyby_string( parent ), get_messageflag_string( parent ) ) ; mmessage->popid=popid; llist_blow_away (alist); if (replyto) free (replyto); if (org) free (org); if (sender) free (sender); if( timestamp ) free( timestamp ) ; if( to_line ) free( to_line ) ; if( cc_line ) free( cc_line ) ; if( bcc_line ) free( bcc_line ) ; return mmessage;}void new_message_send_success (char *messagebody, GtkWidget *widget) { Folder *fl; int msgid; Message *msg; fl=folder_seek (folder_seek_by_name (_("Sent-Items"))); msgid=message_save (_("Sent-Items"), messagebody); msg=message_seek (fl, msgid); msg->flags=0; msg->rfolder=strdup (_("Sent-Items")); create_new_message (fl, msg); fl->total++; destroy_new_message_window (widget, NULL); free (messagebody);}void accept_new_message_window (GtkWidget *widget, gpointer data2) { GtkWidget *parent=lookup_widget (widget, "new_message_window"); char *to=NULL, *cc=NULL, *bcc=NULL; MailMessage *mmessage; int popid=seek_popaccount_by_name (gtk_entry_get_text (GTK_ENTRY (lookup_widget (parent, "account_to_use")))); PopAccount *pop=seek_popaccount (popid); char *recp_line;#if 0 Message *msel=data2; Folder *fsel;#endif#if 1 Folder *fl; int msgid; Message *msg; char *msgText ; msgText = NULL ;#endif tm_globs -> wwrap = 0 ; if( TBA( parent, "wwrap_tog" ) ) tm_globs -> wwrap = gv( parent, "wwrap_val" ) ; mmessage = new_new_message_generate_full( parent, &to, &cc, &bcc ) ;#if 1 msgText = new_message_generate_full( parent, &to, &cc, &bcc ) ;#endif /* Make sure the message has been accepted for processing */ if (!to || !cc || !bcc) return ; recp_line = (char *)calloc( (strlen(to) + strlen(cc) + strlen(bcc) )*2, sizeof(char) ) ; if( (pop -> spid != -1) || (pop -> pid != -1) ) { insert_error ( _("Transmission in progress. Please wait until transmission is finished\n") ); return ; } sprintf (recp_line, "%s", to); if (strlen (cc)>0) sprintf (recp_line, "%s,%s", recp_line, cc); if (strlen (bcc)>0) sprintf (recp_line, "%s,%s", recp_line, bcc); insert_message( _("Sending message... ") ) ; new_fork_send_message( pop, mmessage, recp_line ) ; tm_globs -> send_timeout = gtk_timeout_add(750, (GtkFunction)send_message_timeout, NULL ) ; destroy_new_message_window (widget, data2);#if 1 /* Now, insert the message into the sent-items folder */ insert_message( _("Sent-Items...") ) ; fl=folder_seek (folder_seek_by_name( _("Sent-Items") ) ) ; if( fl ) { msgid = message_save( _("Sent-Items"), msgText ) ; msg = message_seek( fl, msgid ) ; msg -> flags = 0 ; msg -> rfolder = strdup( _("Sent-Items") ) ; create_new_message( fl, msg ) ; fl -> total++ ; }#if 0 if ((msel)&&(msg->subject)) { if (strncasecmp (msg->subject, "re:", 3)==0) msel->flags |= MESSAGE_REPLY; if (strncasecmp (msg->subject, "fwd:", 4)==0) msel->flags |= MESSAGE_FORWARD; fsel = folder_seek (folder_seek_by_name (msel->folder)); if (fsel) folder_display (GTK_CLIST (lookup_widget (tm_globs->main_window, "message_clist")), fsel); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -