From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 14-NOV-1990 07:08:05.65
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	PLM$MAIL, part 7 of 10

Received:  by crdgw1.ge.com (5.57/GE 1.76)
	 id AA02140; Wed, 14 Nov 90 06:51:26 EST
Received: From ICNUCEVM.CNUCE.CNR.IT by CRVAX.SRI.COM with TCP; Wed, 14 NOV 90 01:36:17 PST
Received: from ITOPOLI.BITNET by ICNUCEVM.CNUCE.CNR.IT (IBM VM SMTP R1.2.2MX) with BSMTP id 0276; Wed, 14 Nov 90 10:33:15 MET
Date: Wed, 14 Nov 90 10:31 GMT+1
From: "P.L. Montessoro * CENS-CNR * +39-11-556.7013" <PIERLUCA%ITOPOLI.BITNET@ICNUCEVM.CNUCE.CNR.IT>
Subject: PLM$MAIL, part 7 of 10
To: info-vax@kl.sri.com
Message-Id: <04DBA14C3D1F20028A@ITOPOLI.BITNET>
X-Envelope-To: info-vax@kl.sri.com
X-Vms-To: INFOVAX

-+-+-+-+-+-+-+-+ START OF PART 7 -+-+-+-+-+-+-+-+
X            sscanf (comm_buffer + par_offset , "%s", int_buffer);
X            switch (wild_code = int_buffer `0910`093)
X            `123
X               case '*':
X               case 'r':
X               case 'R':
X               case 'e':
X               case 'E':
X                  msg_dsc_ptr = curr_group->msg_list_ptr;
X                  if (msg_dsc_ptr == END_OF_MSG_LIST)
X                  `123
X                     printf`032
X                       ("PLM$MAIL-E-NOMSG, No messages in current group\n");
X                     goto READ_COMM;
X                  `125
X                  tmp_message = msg_dsc_ptr;
X                  wild = TRUE;
X                  break;
X
X               case '1':
X               case '2':
X               case '3':
X               case '4':
X               case '5':
X               case '6':
X               case '7':
X               case '8':
X               case '9':
X               case '0':
X                  wild = FALSE;
X                  sscanf (comm_buffer + par_offset , "%d", &message_id);
X                  msg_dsc_ptr = curr_group->msg_list_ptr;
X                  while (msg_dsc_ptr != END_OF_MSG_LIST)
X                  `123
X                     if (msg_dsc_ptr->id == message_id)
X                        break;
X                     msg_dsc_ptr = msg_dsc_ptr->next;
X                  `125
X                  if (msg_dsc_ptr == END_OF_MSG_LIST)
X                  `123
X                     printf`032
X                        ("PLM$MAIL-E-MSGNOTFND, Message not found in current
V group\n");
X                     goto READ_COMM;
X                  `125
X                  tmp_message = msg_dsc_ptr;
X                  break;
X
X               default:`032
X                  printf`032
X                     ("PLM$MAIL-E-WMSGID, Wrong message identifier\n");
X                  goto READ_COMM;
X                  break;
X            `125
X         `125
X
X         do
X         `123
X            /* mark the messages */
X            if (!wild)
X               if (tmp_message->deleted)
X                  printf ("PLM$MAIL-I-ALRDEL, Message #%d was already marked
V for deletion\n",`032
X                          tmp_message->id);
X               else
X                  tmp_message->deleted = TRUE;
X            else
X               switch (wild_code)
X               `123
X                  case '*':
X                     if (tmp_message->deleted)
X                        printf ("PLM$MAIL-I-ALRDEL, Message #%d was already
V marked for deletion\n",`032
X                                tmp_message->id);
X                     else
X                        tmp_message->deleted = TRUE;
X                     break;
X
X                  case 'r':
X                  case 'R':
X                     if (tmp_message->read)
X                        if (tmp_message->deleted)
X                           printf ("PLM$MAIL-I-ALRDEL, Message #%d was alrea
Vdy marked for deletion\n",`032
X                                   tmp_message->id);
X                        else
X                           tmp_message->deleted = TRUE;
X                     break;
X
X                  case 'e':
X                  case 'E':
X                     if (tmp_message->extracted)
X                        if (tmp_message->deleted)
X                           printf ("PLM$MAIL-I-ALRDEL, Message #%d was alrea
Vdy marked for deletion\n",`032
X                                   tmp_message->id);
X                        else
X                           tmp_message->deleted = TRUE;
X                     break;
X               `125
X
X            /* get next message, if wildcard */
X            if (wild)
X            `123
X               tmp_message = tmp_message->next;
X            `125
X
X         `125  while (wild && (tmp_message != END_OF_MSG_LIST));
X         goto READ_COMM;
X         break;
X
X      case 'u':
X      case 'U':
X         /* undelete a message */
X         if (comm_buffer `091par_offset`093 == '\0')
X         `123
X            if ((curr_message == BEG_OF_MSG_LIST) `124`124`032
X                (curr_message == END_OF_MSG_LIST))
X            `123
X               printf`032
X                  ("PLM$MAIL-E-NOCURRMSG, No message selected as current\n")
V;
X               goto READ_COMM;
X            `125
X            wild = FALSE;
X            tmp_message = curr_message;
X         `125
X         else
X         `123
X            if (curr_group == NULL)
X            `123
X               printf ("PLM$MAIL-E-NOCURRGRUP, No current group selected\n")
V;
X               goto READ_COMM;
X            `125
X
X            /* wildcard ? */
X            sscanf (comm_buffer + par_offset , "%s", int_buffer);
X            switch (wild_code = int_buffer `0910`093)
X            `123
X               case '*':
X               case 'r':
X               case 'R':
X               case 'e':
X               case 'E':
X                  msg_dsc_ptr = curr_group->msg_list_ptr;
X                  if (msg_dsc_ptr == END_OF_MSG_LIST)
X                  `123
X                     printf`032
X                       ("PLM$MAIL-E-NOMSG, No messages in current group\n");
X                     goto READ_COMM;
X                  `125
X                  tmp_message = msg_dsc_ptr;
X                  wild = TRUE;
X                  break;
X
X               case '1':
X               case '2':
X               case '3':
X               case '4':
X               case '5':
X               case '6':
X               case '7':
X               case '8':
X               case '9':
X               case '0':
X                  wild = FALSE;
X                  sscanf (comm_buffer + par_offset , "%d", &message_id);
X                  msg_dsc_ptr = curr_group->msg_list_ptr;
X                  while (msg_dsc_ptr != END_OF_MSG_LIST)
X                  `123
X                     if (msg_dsc_ptr->id == message_id)
X                        break;
X                     msg_dsc_ptr = msg_dsc_ptr->next;
X                  `125
X                  if (msg_dsc_ptr == END_OF_MSG_LIST)
X                  `123
X                     printf`032
X                        ("PLM$MAIL-E-MSGNOTFND, Message not found in current
V group\n");
X                     goto READ_COMM;
X                  `125
X                  tmp_message = msg_dsc_ptr;
X                  break;
X
X               default:`032
X                  printf`032
X                     ("PLM$MAIL-E-WMSGID, Wrong message identifier\n");
X                  goto READ_COMM;
X                  break;
X            `125
X         `125
X
X         do
X         `123
X            /* unmark the messages */
X            if (!wild)
X               if (!tmp_message->deleted)
X                  printf ("PLM$MAIL-I-NOTDEL, Message #%d was not marked for
V deletion\n",`032
X                          tmp_message->id);
X               else
X                  tmp_message->deleted = FALSE;
X            else
X               switch (wild_code)
X               `123
X                  case '*':
X                     if (!tmp_message->deleted)
X                        printf ("PLM$MAIL-I-NOTDEL, Message #%d was not mark
Ved for deletion\n",`032
X                                tmp_message->id);
X                     else
X                        tmp_message->deleted = FALSE;
X                     break;
X
X                  case 'r':
X                  case 'R':
X                     if (tmp_message->read)
X                        if (!tmp_message->deleted)
X                           printf ("PLM$MAIL-I-NOTDEL, Message #%d was not m
Varked for deletion\n",`032
X                                   tmp_message->id);
X                        else
X                           tmp_message->deleted = FALSE;
X                     break;
X
X                  case 'e':
X                  case 'E':
X                     if (tmp_message->extracted)
X                        if (tmp_message->deleted)
X                           printf ("PLM$MAIL-I-NOTDEL, Message #%d was not m
Varked for deletion\n",`032
X                                   tmp_message->id);
X                        else
X                           tmp_message->deleted = TRUE;
X                     break;
X               `125
X
X            /* get next message, if wildcard */
X            if (wild)
X            `123
X               tmp_message = tmp_message->next;
X            `125
X
X         `125  while (wild && (tmp_message != END_OF_MSG_LIST));
X         goto READ_COMM;
X         break;
X
X      case 's':
X      case 'S':
X         /* send a message */
X         if (comm_buffer `091par_offset`093 == '\0')
X         `123
X            /* no filename given */
X            filename `0910`093 ='\0';
X         `125
X         else
X         `123
X            /* read the filename */
X            sscanf (comm_buffer + par_offset , "%s", filename);
X         `125
X
X         printf ("\n");
X
X         /* ask for destination */
X         printf ("To: ");
X         if (gets (int_buffer) == NULL)
X         `123
X            /* control Z */
X            goto READ_COMM;
X         `125      `032
X         trim (int_buffer);
X         if (int_buffer `0910`093 == '\0')
X         `123
X            /* no destination */
X            goto READ_COMM;
X         `125
X         if (int_buffer `0910`093 == '@')
X         `123
X            /* filename */
X            sscanf (int_buffer + 1, "%s", dis_filename);
X            strcat (dis_filename, DIS_FILE_EXTENSION);
X            if ((dis_fp = fopen (dis_filename, "r")) == NULL)
X            `123
X               printf`032
X                  ("PLM$MAIL-F-OPENERR, Cannot open file %s\n", dis_filename
V);
X               goto READ_COMM;
X            `125
X         `125
X         else
X         `123
X            dis_filename `0910`093 = '\0';
X         `125
X
X         send_context = 0;
X         if ((status = mail$send_begin`032
X                          (&send_context,`032
X                           &mail_null_list,`032
X                           &mail_null_list)) != SS$_NORMAL)
X         `123
X#if FALSE
X            lib$signal (status);
X#endif
X            printf ("\n\n");
X         `125
X
X         /* get all the destination addresses */
X         init_get_next_dst ();
X         while (get_next_dst (to_buffer, int_buffer, dis_fp, dis_filename))
X         `123
X            /* try to translate the name */
X            proc_trnlnm (to_buffer);
X            if (return_string `0910`093 != '\0')
X               strcpy (to_buffer, return_string);
X           `032
X            if (to_buffer `0910`093 == '\0')
X            `123
X               printf ("PLM$MAIL-E-INVDEST, Invalid destination\n");
X               /* abort */
X               if ((status = mail$send_end`032
X                                (&send_context,`032
X                                 &mail_null_list,`032
X                                 &mail_null_list)) != SS$_NORMAL)
X               `123
X#if FALSE  `032
X                  lib$signal (status);
X#endif     `032
X                  printf ("\n\n");
X               `125
X               if (dis_filename `0910`093 != '\0')
X                  fclose (dis_fp);
X               goto READ_COMM;
X            `125
X           `032
X            message_send_address_itmlst`0910`093.buffer_address = to_buffer;
X            message_send_address_itmlst`0910`093.buffer_length = strlen (to_
Vbuffer);
X            if ((status = mail$send_add_address`032
X                             (&send_context,`032
X                              &message_send_address_itmlst,`032
X                              &mail_null_list)) != SS$_NORMAL)
X            `123
X#if FALSE  `032
X               lib$signal (status);
X#endif     `032
X               printf ("\n\n");
X               /* abort */
X               if ((status = mail$send_end`032
X                                (&send_context,`032
X                                 &mail_null_list,`032
X                                 &mail_null_list)) != SS$_NORMAL)
X               `123
X#if FALSE  `032
X                  lib$signal (status);
X#endif     `032
X                  printf ("\n\n");
X               `125
X               if (dis_filename `0910`093 != '\0')
X                  fclose (dis_fp);
X               goto READ_COMM;
X            `125
X         `125  /* end of destinations */
X
X         /* ask for subject */
X         printf ("Subject: ");
X         if (gets (int_buffer) == NULL)
X         `123
X            /* control Z */
X            if ((status = mail$send_end`032
X                             (&send_context,`032
X                              &mail_null_list,`032
X                              &mail_null_list)) != SS$_NORMAL)
X            `123
X#if FALSE
X               lib$signal (status);
X#endif
X               printf ("\n\n");
X            `125
X            goto READ_COMM;
X         `125      `032
X         strcpy (subj_buffer, int_buffer);
X
X         message_send_attribute_itmlst`0910`093.buffer_address = subj_buffer
V;
X         message_send_attribute_itmlst`0910`093.buffer_length = strlen (subj
V_buffer);
X         if ((status = mail$send_add_attribute
X                          (&send_context,`032
X                           &message_send_attribute_itmlst,`032
X                           &mail_null_list)) != SS$_NORMAL)
X         `123
X#if FALSE
X            lib$signal (status);
X#endif
X            printf ("\n\n");
X         `125
X
X         if (filename `0910`093 != '\0')
X         `123
X            /* still to be edited? */
X            do
X            `123
X               printf ("Do you want to edit the message? ");
X               if (gets (int_buffer) == NULL)
X               `123
X                  /* control Z */
X                  if ((status = mail$send_abort`032
X                                   (&send_context,`032
X                                    &mail_null_list,`032
X                                    &mail_null_list)) != SS$_NORMAL)
X                  `123
X#if FALSE
X                     lib$signal (status);
X#endif
X                     printf ("\n\n");
X                  `125
X                  if ((status = mail$send_end`032
X                                   (&send_context,`032
X                                    &mail_null_list,`032
X                                    &mail_null_list)) != SS$_NORMAL)
X                  `123
+-+-+-+-+-+-+-+-  END  OF PART 7 +-+-+-+-+-+-+-+-

