🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
1 messages
1 total messages Started by vischne Wed, 04 Feb 1998 00:00
Win32/95/NT patch for slrn/misc.c
#38458
Author: vischne
Date: Wed, 04 Feb 1998 00:00
119 lines
3474 bytes
The following changes to slrn_mail_file allows the Windows version of
sendmail.exe to send mail from slrn.exe:

============================================================================

int slrn_mail_file (char *file, int edit, unsigned int editline,
	char *to, char *subject) /*{{{*/
{
   char buf [256 + 2 * SLRN_MAX_PATH_LEN];
#if defined(__os2__) || defined(__NT__)  || defined(_WIN32)
   char outfile [SLRN_MAX_PATH_LEN];
#endif
   
   if (edit && (Slrn_Batch == 0))
     {
	if (slrn_edit_file (Slrn_Editor_Mail, file, editline) < 0) return -1;
	
	while (1)
	  {
	     char rsp;
	     
	     rsp = slrn_get_response ("yYnNeE", "Mail the message? \001Yes, \001No, \001Edit");
	     rsp |= 0x20;
	     if (rsp == 'n') return -1;
	     if (rsp == 'y') break;
	     if (slrn_edit_file (Slrn_Editor_Mail, file, 1) < 0) return -1;
	  }
     }
   slrn_message_now ("Sending ...");

   if (-1 == slrn_save_file_to_mail_file (file, Slrn_Save_Replies_File, NULL))
     return -1;

   slrn_chmap_fix_file (file);

#ifdef VMS
   sprintf(buf, "%s\"%s\"", MAIL_PROTOCOL, to);
   vms_send_mail( buf, subject, file );
#else
   (void) to; (void) subject;

   /* What I need to do is to open the file and feed it line by line to the
    * sendmail program.  This way I can strip out blank headers.
    */
   if (Slrn_Use_Mime)
     {
	FILE *fp, *pp;
	int header = 1;
	char line[1024];
	
	fp = fopen (file, "r");
	if (fp == NULL) return (-1);
	
	slrn_mime_scan_file (fp);
# if defined(__os2__) || defined(__NT__) || defined(_WIN32)
	pp = slrn_open_tmpfile (outfile, "w");
# else
	pp = slrn_popen (Slrn_SendMail_Command, "w");
# endif
	if (pp == NULL)
	  {
	     slrn_fclose (fp);
	     return (-1);
	  }
	
	while (fgets (line, sizeof(line), fp) != NULL)
	  {
	     unsigned int len = strlen (line);
	     
	     if (len == 0) continue;
	     len--;
	     
	     if (line [len] == '\n') line [len] = 0;
	     
	     if (header)
	       {
		  if (line[0] == 0)
		    {
		       header = 0;
		       
		       slrn_mime_add_headers (pp);
		       fp = slrn_mime_encode (fp);
		    }
		  slrn_mime_header_encode (line, sizeof(line));
	       }
	     fputs (line, pp);
	     putc('\n', pp);
	  }
	slrn_fclose (fp);
#if defined(__os2__) || defined(__NT__) || defined(_WIN32)
	slrn_fclose (pp);
#ifdef _WIN32
	sprintf (buf, "%s -F %s -t %s", Slrn_SendMail_Command, outfile, to);
#else
	sprintf (buf, "%s %s", Slrn_SendMail_Command, outfile);
#endif
	slrn_posix_system (buf, 0);
#else
	slrn_pclose (pp);
#endif
     }
   else
     {
#if defined(__os2__) || defined(__NT__)
	sprintf (buf, "%s %s", Slrn_SendMail_Command, file);
#elif defined(_WIN32)
	sprintf (buf, "%s -F %s -t %s", Slrn_SendMail_Command, outfile, to);
#else
	sprintf (buf, "%s < %s", Slrn_SendMail_Command, file);
#endif
	slrn_posix_system (buf, 0);
     }
#endif /* NOT VMS */
   slrn_message ("Sending...done");
   return 0;
}

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads