22 static void usage(
void);
24 static char *optstr =
"u37m:d:p:w:M:D:P:W:";
37 char password[BUFSIZ];
40 struct X400msSession *sp;
41 struct X400Recipient *rp;
48 if (get_args(argc, argv, optstr)) {
53 printf(
"Connection type (0 = P7, 1 = P3 submit only, 2 = P3 both directions) [%d]: ", x400_contype);
54 contype = ic_fgetc(x400_contype, stdin);
56 ic_fgetc(x400_contype, stdin);
58 if ( contype <
'0' ||
'2' < contype )
59 contype = x400_contype;
64 def_oraddr = x400_ms_user_addr;
65 def_dn = x400_ms_user_dn;
66 def_pa = x400_ms_presentation_address;
68 def_oraddr = x400_mta_user_addr;
69 def_dn = x400_mta_user_dn;
70 def_pa = x400_mta_presentation_address;
73 printf(
"Your ORAddress [%s] > ", def_oraddr);
74 ic_fgets (orn,
sizeof orn, stdin);
76 if ( orn[strlen(orn)-1] ==
'\n' )
77 orn[strlen(orn)-1] =
'\0';
80 strcpy(orn, def_oraddr);
83 printf (
"Password [%s]: ",
84 contype == 0 ? x400_p7_password : x400_p3_password);
85 if ( ic_fgets (buffer,
sizeof buffer, stdin) == NULL )
88 if (buffer[strlen(buffer)-1] ==
'\n' )
89 buffer[strlen(buffer)-1] =
'\0';
90 if (buffer[0] ==
'\0')
91 strcpy(buffer, contype == 0 ? x400_p7_password : x400_p3_password);
92 strcpy(password, buffer);
95 printf(
"Presentation Address [%s] > ", def_pa);
96 ic_fgets (pa,
sizeof pa, stdin);
98 if ( pa[strlen(pa)-1] ==
'\n' )
99 pa[strlen(pa)-1] =
'\0';
105 printf(
"Register or Deregister the AutoAction ? (R = Register, D = Deregister): ");
106 if ( ic_fgets (buffer,
sizeof buffer, stdin) == NULL )
108 autoaction = buffer[0];
109 if ((autoaction !=
'R') && (autoaction !=
'D'))
113 status =
X400msOpen (contype, orn, def_dn, password, pa, &nummsg, &sp);
115 fprintf (stderr,
"Error in Open: %s\n",
X400msError (status));
130 struct X400msAutoActionParameter *aa_param;
176 "This message was autoforwarded",
181 "This is a cover note",
193 "Error in RegisterAutoAction: %s\n",
X400msError (status));
196 printf(
"Registered AutoForwarding autoaction (id = 4) OK\n");
205 fprintf (stderr,
"Error in RegisterAutoAction: %s\n",
209 printf(
"Registered AutoAlert autoaction (id = 9) OK\n");
215 fprintf (stderr,
"Error in RegisterAutoAction: %s\n",
219 printf(
"Registered AutoAlert autoaction (id = 10) OK\n");
224 fprintf (stderr,
"Error in DeregisterAutoAction: %s\n",
228 printf(
"Deregistered AutoAlert autoaction (id = 10) OK\n");
232 printf(
"no messages - waiting 60 seconds for a message to be delivered.....\n");
234 printf (
"%d messages waiting\n", nummsg);
242 static void usage(
void) {
243 printf(
"usage: %s\n", optstr);
244 printf(
"\t where:\n");
245 printf(
"\t -u : Don't prompt to override defaults \n");
246 printf(
"\t -3 : Use P3 connection \n");
247 printf(
"\t -7 : Use P7 connection \n");
248 printf(
"\t -m : OR Address in P7 bind arg \n");
249 printf(
"\t -d : DN in P7 bind arg \n");
250 printf(
"\t -p : Presentation Address of P7 Store \n");
251 printf(
"\t -w : P7 password of P7 user \n");
252 printf(
"\t -M : OR Address in P3 bind arg \n");
253 printf(
"\t -D : DN in P3 bind arg \n");
254 printf(
"\t -P : Presentation Address of P3 server\n");
255 printf(
"\t -W : P3 password of P3 user \n");
#define X400_S_LOG_CONFIGURATION_FILE
#define X400_N_DISCLOSURE
int X400msAutoActionParameterAddRecip(struct X400msAutoActionParameter *aap, int reciptype, struct X400Recipient *recip)
Add a receipient to the autoaction parameter.
int X400msAutoActionParameterAddIntParam(struct X400msAutoActionParameter *aap, int paramtype, int value)
Add integer-valued parameter to the autoaction parameter.
#define X400_N_CONTENT_RETURN_REQUEST
#define X400_S_THIS_IPM_PREFIX
int X400msOpen(int type, const char *oraddr, const char *dirname, const char *credentials, const char *pa, int *messages, struct X400msSession **spp)
Open a session to a Message Store (P7) or MTA (P3) in synchronous mode.
#define X400_S_COVER_NOTE
struct X400msAutoActionParameter * X400msNewAutoActionParameter(void)
Create a new (empty) autoaction parameter structure.
int X400msSetStrDefault(struct X400msSession *sp, int paramtype, const char *value, size_t length)
Set a default string parameter value in a session.
void X400msFreeAutoActionParameter(struct X400msAutoActionParameter *aa_param)
Free an autoaction parameter.
int X400msClose(struct X400msSession *sp)
Close a X400 Session.
int X400msDeregisterAutoAction(struct X400msSession *sp, int type, int id)
Deregister an autoaction from the Message Store.
int X400RecipAddStrParam(struct X400Recipient *rp, int paramtype, const char *value, size_t length)
Add string-valued parameter to the recipient.
#define X400_AUTO_FORWARDING
int X400RecipNew(int type, struct X400Recipient **rpp)
Create a new recipient object.
const char * X400msError(int error)
Obtain a string describing the meaning of the given error code.
#define X400_RECIP_STANDARD
#define X400_S_AUTO_FORWARDING_COMMENT
#define X400_S_CONTENT_IDENTIFIER
#define X400_N_WAIT_INTERVAL
#define X400_N_IMPLICIT_CONVERSION_PROHIBITED
X400 MA/MS (P3/P7) Interface.
int X400msAutoActionParameterAddStrParam(struct X400msAutoActionParameter *aap, int paramtype, const char *value, size_t length)
Add string-valued parameter to the autoaction parameter.
int X400msSetIntDefault(struct X400msSession *sp, int paramtype, int value)
Set a default integer parameter value in a session.
#define X400_N_ALTERNATE_RECIPIENT_ALLOWED
#define X400_N_DELETE_AFTER_AUTO_FORWARDING
int X400msRegisterAutoAction(struct X400msSession *sp, int type, int id, struct X400msAutoActionParameter *aa_param)
Register an autoaction with the Message Store.
#define X400_S_OR_ADDRESS