|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T b
Length: 27328 (0x6ac0)
Types: TextFile
Names: »bops.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z«
└─⟦e5a54fb17⟧
└─⟦this⟧ »pp-5.0/Src/MTAconsole/bops.c«
/* bops.c: various buttons routines */
# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Src/MTAconsole/RCS/bops.c,v 5.0 90/09/20 16:19:31 pp Exp Locker: pp $";
# endif
/*
* $Header: /cs/research/pp/hubris/pp-beta/Src/MTAconsole/RCS/bops.c,v 5.0 90/09/20 16:19:31 pp Exp Locker: pp $
*
* $Log: bops.c,v $
* Revision 5.0 90/09/20 16:19:31 pp
* rcsforce : 5.0 public release
*
*/
#include "console.h"
extern int autoReconnect,
userConnected;
extern State connectState;
extern struct chan_struct *find_channel();
extern struct mta_struct *find_mta();
extern struct msg_struct *find_msg();
extern Widget top;
void SetAuthDisplay();
/* ARGSUSED */
void Refresh(w, client_data, call_data)
Widget w;
caddr_t client_data; /* unused */
caddr_t call_data; /* unused */
{
/* StartWait();*/
if (connectState == connected)
my_invoke(chanread, (char **) NULL);
else if (autoReconnect == TRUE && userConnected == TRUE) {
TermConnectTimeOut();
ConnectTimeOut((caddr_t) NULL,(XtIntervalId *) NULL);
}
ResetInactiveTimeout();
/* EndWait();*/
}
extern time_t parsetime();
Operations currentop;
extern struct chan_struct *currentchan;
extern struct mta_struct *currentmta;
extern struct msg_struct *currentmsg;
extern int confirm, read_currentchan;
extern char *hostname;
extern Popup_menu *yesno,
*one,
*two,
*three;
int forceDown = FALSE;
/* ARGSUSED */
void Command(w, op, call_data)
Widget w;
Operations op;
caddr_t call_data; /* unused */
{
char *title;
int x, y;
Popup_menu *popup = NULL;
Window r_child;
ResetInactiveTimeout();
WidgetGet(w,
XtNlabel, &title,
NULL);
if (strcmp(title, "all") == 0) {
if (op == chaninfo)
chan_display_all();
else if (op == mtainfo)
mta_display_all();
else if (op = msginfo)
msg_display_all();
return;
}
currentop = op;
/* StartWait(); */
/* should pop up template hereabouts */
switch (op) {
case quit:
if (confirm == TRUE) {
popup = yesno;
} else {
Quit();
}
break;
case connect:
case disconnect:
if (strcmp(title, "connect") == 0) {
currentop = connect;
popup = one;
textdisplay(&(one->tuple[0]),
(hostname == NULL) ? "" : hostname);
WidgetSet(one->tuple[0].label,
XtNlabel, "Connect to ",
NULL);
} else {
currentop = disconnect;
if (confirm == TRUE) {
popup = yesno;
} else {
Disconnect();
}
}
break;
case chanstart:
if (currentchan == NULL) {
textdisplay(&(one->tuple[0]), "");
WidgetSet(one->tuple[0].label,
XtNlabel, "Enable channel",
NULL);
popup = one;
} else
ChanControl(currentop, currentchan->channelname,
(char *) NULL);
break;
case chanstop:
if (currentchan == NULL) {
textdisplay(&(one->tuple[0]), "");
WidgetSet(one->tuple[0].label,
XtNlabel, "Disable channel",
NULL);
popup = one;
} else
ChanControl(currentop, currentchan->channelname,
(char *) NULL);
break;
case chanclear:
if (currentchan == NULL) {
textdisplay(&(one->tuple[0]), "");
WidgetSet(one->tuple[0].label,
XtNlabel, "Remove delay on channel",
NULL);
popup = one;
} else
ChanControl(currentop, currentchan->channelname,
(char *) NULL);
break;
case chancacheadd:
popup = two;
WidgetSet(two->tuple[0].label,
XtNlabel, "Add delay (in s m h d and/or w)",
NULL);
WidgetSet(two->tuple[1].label,
XtNlabel, "On channel",
NULL);
textdisplay(&(two->tuple[1]),
(currentchan == NULL) ? "" : currentchan->channelname);
textdisplay(&(two->tuple[0]), "");
break;
case chaninfo:
if (currentchan == NULL) {
textdisplay(&(one->tuple[0]), "");
WidgetSet(one->tuple[0].label,
XtNlabel, "Info on channel",
NULL);
popup = one;
} else
ChanInfo(currentchan->channelname);
break;
case chandownforce:
if (currentchan == NULL) {
textdisplay (&(one->tuple[0]), "");
WidgetSet(one->tuple[0].label,
XtNlabel, "Downward force attempt on channel",
NULL);
popup = one;
} else {
forceDown = TRUE;
ChanDownForce (currentchan);
forceDown = FALSE;
}
break;
case mtastart:
if (currentmta == NULL
|| currentchan == NULL) {
textdisplay(&(two->tuple[0]),
(currentmta == NULL) ? "" : currentmta->mta);
WidgetSet(two->tuple[0].label,
XtNlabel, "Enable mta ",
NULL);
textdisplay(&(two->tuple[1]),
(currentchan == NULL) ? "" : currentchan->channelname);
WidgetSet(two->tuple[1].label,
XtNlabel, "On channel",
(char *) NULL);
popup = two;
} else
MtaControl(currentop,
currentmta->mta,
currentchan->channelname,
(char *) NULL);
break;
case mtastop:
if (currentmta == NULL
|| currentchan == NULL) {
textdisplay(&(two->tuple[0]),
(currentmta == NULL) ? "" : currentmta->mta);
WidgetSet(two->tuple[0].label,
XtNlabel, "Disable mta ",
NULL);
textdisplay(&(two->tuple[1]),
(currentchan == NULL) ? "" : currentchan->channelname);
WidgetSet(two->tuple[1].label,
XtNlabel, "On channel",
NULL);
popup = two;
} else
MtaControl(currentop,
currentmta->mta,
currentchan->channelname,
(char *) NULL);
break;
case mtaclear:
if (currentmta == NULL
|| currentchan == NULL) {
textdisplay(&(two->tuple[0]),
(currentmta == NULL) ? "" : currentmta->mta);
WidgetSet(two->tuple[0].label,
XtNlabel, "Remove delay on mta",
NULL);
textdisplay(&(two->tuple[1]),
(currentchan == NULL) ? "" : currentchan->channelname);
WidgetSet(two->tuple[1].label,
XtNlabel, "On channel",
NULL);
popup = two;
} else
MtaControl(currentop,
currentmta->mta,
currentchan->channelname,
(char *) NULL);
break;
case mtaforce:
if (currentmta == NULL
|| currentchan == NULL) {
textdisplay(&(two->tuple[0]),
(currentmta == NULL) ? "" : currentmta->mta);
WidgetSet(two->tuple[0].label,
XtNlabel, "Force attempt of mta",
NULL);
textdisplay(&(two->tuple[1]),
(currentchan == NULL) ? "" : currentchan->channelname);
WidgetSet(two->tuple[1].label,
XtNlabel, "On channel",
NULL);
popup = two;
} else
MtaForce(currentmta,
currentchan);
break;
case mtadownforce:
if (currentmta == NULL
|| currentchan == NULL) {
textdisplay(&(two->tuple[0]),
(currentmta == NULL) ? "" : currentmta->mta);
WidgetSet(two->tuple[0].label,
XtNlabel, "Downward force attempt of mta",
NULL);
textdisplay(&(two->tuple[1]),
(currentchan == NULL) ? "" : currentchan->channelname);
WidgetSet(two->tuple[1].label,
XtNlabel, "On channel",
NULL);
popup = two;
} else {
forceDown = TRUE;
MtaDownForce(currentchan,
currentmta);
forceDown = FALSE;
}
break;
case mtacacheadd:
popup = three;
WidgetSet(three->tuple[0].label,
XtNlabel, "Add delay (in s m h d and/or w)",
NULL);
textdisplay(&(three->tuple[0]), "");
WidgetSet(three->tuple[1].label,
XtNlabel, "For mta",
NULL);
textdisplay(&(three->tuple[1]),
(currentmta == NULL) ? "" : currentmta->mta);
WidgetSet(three->tuple[2].label,
XtNlabel,"On channel",
NULL);
textdisplay(&(three->tuple[2]),
(currentchan == NULL) ? "" : currentchan->channelname);
break;
case mtainfo:
if (currentmta == NULL
|| currentchan == NULL) {
textdisplay(&(two->tuple[0]),
(currentmta == NULL) ? "" : currentmta->mta);
WidgetSet(two->tuple[0].label,
XtNlabel, "Info on mta",
NULL);
textdisplay(&(two->tuple[1]),
(currentchan == NULL) ? "" : currentchan->channelname);
WidgetSet(two->tuple[1].label,
XtNlabel, "On channel",
NULL);
popup = two;
} else
MtaInfo(currentmta->mta,
currentchan->channelname);
break;
case msgstart:
popup = two;
WidgetSet(two->tuple[0].label,
XtNlabel, "Thaw message",
NULL);
textdisplay(&(two->tuple[0]),
(currentmsg == NULL) ? "" : currentmsg->msginfo->queueid);
textdisplay(&(two->tuple[1]), "");
WidgetSet(two->tuple[1].label,
XtNlabel, "User list (,) *=all",
NULL);
break;
case msgstop:
popup = two;
WidgetSet(two->tuple[0].label,
XtNlabel, "Freeze message ",
NULL);
textdisplay(&(two->tuple[0]),
(currentmsg == NULL) ? "" : currentmsg->msginfo->queueid);
textdisplay(&(two->tuple[1]), "");
WidgetSet(two->tuple[1].label,
XtNlabel, "User list (,) *=all",
NULL);
break;
case msgclear:
popup = two;
WidgetSet(two->tuple[0].label,
XtNlabel, "Remove delay on message",
NULL);
textdisplay(&(two->tuple[0]),
(currentmsg == NULL) ? "" : currentmsg->msginfo->queueid);
textdisplay(&(two->tuple[1]), "");
WidgetSet(two->tuple[1].label,
XtNlabel, "User list (,) *=all",
NULL);
break;
case msgforce:
if (currentmta == NULL) {
popup = three;
WidgetSet(three->tuple[0].label,
XtNlabel, "Force Attempt on Message",
NULL);
textdisplay(&(three->tuple[0]),
(currentmsg == NULL) ? "" : currentmsg->msginfo->queueid);
WidgetSet(three->tuple[1].label,
XtNlabel, "User list (,) *=all",
NULL);
textdisplay(&(three->tuple[1]),"");
WidgetSet(three->tuple[2].label,
XtNlabel, "On Mta",
NULL);
textdisplay(&(three->tuple[2]),"");
} else {
/* know what mta is */
popup = two;
WidgetSet(two->tuple[0].label,
XtNlabel, "Force Attempt on Message",
NULL);
textdisplay(&(two->tuple[0]),
(currentmsg == NULL) ? "" : currentmsg->msginfo->queueid);
WidgetSet(two->tuple[1].label,
XtNlabel, "User list (,) *=all",
NULL);
textdisplay(&(two->tuple[1]),"");
}
break;
case msginfo:
if (currentmsg == NULL) {
popup = one;
WidgetSet(one->tuple[0].label,
XtNlabel, "Info on message",
NULL);
textdisplay(&(one->tuple[0]), "");
} else
MsgInfo(currentmsg->msginfo->queueid);
break;
case msgcacheadd:
popup = three;
WidgetSet(three->tuple[0].label,
XtNlabel, "Add delay (in s m h d and/or w)",
NULL);
textdisplay(&(three->tuple[0]), "");
WidgetSet(three->tuple[1].label,
XtNlabel, "To message",
NULL);
textdisplay(&(three->tuple[1]),
(currentmsg == NULL) ? "" : currentmsg->msginfo->queueid);
WidgetSet(three->tuple[2].label,
XtNlabel, "User list (,) *=all",
NULL);
textdisplay(&(three->tuple[2]), "");
break;
default:
popup = one;
WidgetSet(one->tuple[0].label,
XtNlabel, "WHAT ????????",
NULL);
break;
}
/* EndWait();*/
if (popup != NULL) {
XTranslateCoordinates(XtDisplay(w),XtWindow(w),
XDefaultRootWindow(XtDisplay(w)),0,0,
&x,&y,
&r_child);
Popup(popup,currentop,x,y);
}
}
extern Popup_menu *connectpopup;
extern int newauth,
auth;
extern char password[],
username[],
tailorfile[];
/* ARGSUSED */
void Connectbutton(w, op, call_data)
Widget w;
Operations op;
caddr_t call_data; /* unused */
{
char *title;
int x, y;
Popup_menu *popup = NULL;
Window r_child;
WidgetGet(w,
XtNlabel, &title,
NULL);
currentop = op;
if (strcmp(title, "connect") == 0) {
currentop = connect;
newauth = auth;
SetAuthDisplay(newauth);
popup = connectpopup;
textdisplay(&(connectpopup->tuple[0]),
(hostname == NULL) ? "" : hostname);
textdisplay(&(connectpopup->tuple[1]),
(tailorfile[0] == '\0') ? "" : tailorfile);
} else {
currentop = disconnect;
if (confirm == TRUE) {
popup = yesno;
} else {
Disconnect();
}
}
if (popup != NULL) {
XTranslateCoordinates(XtDisplay(w),XtWindow(w),
XDefaultRootWindow(XtDisplay(w)),0,0,
&x,&y,
&r_child);
Popup(popup,currentop,x,y);
}
}
Mode mode = monitor;
extern Widget mode_command, channel_label, qcontrol_command;
extern Authentication authentication;
extern void ChanToggle();
/* ARGSUSED */
void ChangeMode(w, client_data, call_data)
Widget w;
caddr_t client_data;
caddr_t call_data;
{
extern Widget channel_form,
monitor_viewport,
control_form;
/* StartWait();*/
if (mode == monitor) {
WidgetSet(mode_command,
XtNlabel, "monitor",
NULL);
mode = control;
toggle_info_displays();
reset_label(channel_label);
XtSetMappedWhenManaged(monitor_viewport, False);
XtSetMappedWhenManaged(control_form, True);
XtSetMappedWhenManaged(channel_form, True);
if (authentication == full && connectState == connected)
XtSetMappedWhenManaged(qcontrol_command, True);
if (currentchan != NULL && read_currentchan != 0) {
clear_mta_refresh_list();
add_mta_refresh_list(currentchan->channelname);
construct_event(mtaread);
}
} else {
WidgetSet(mode_command,
XtNlabel, "control",
NULL);
mode = monitor;
ChanToggle();
XtSetMappedWhenManaged(monitor_viewport, True);
XtSetMappedWhenManaged(control_form, False);
XtSetMappedWhenManaged(channel_form, False);
if (authentication == full)
XtSetMappedWhenManaged(qcontrol_command, False);
if (connectState == connected)
my_invoke(chanread,(char **) NULL);
}
/* EndWait();*/
ResetInactiveTimeout();
}
extern unsigned long timeoutFor,
inactiveFor,
connectInit,
connectInc,
connectMax;
extern char *unparsetime();
extern Popup_menu *config;
extern Widget refresh_toggle,
reconnect_toggle,
backoff_toggle,
confirm_toggle,
heur_toggle;
extern int autoRefresh,
autoReconnect,
backoff,
percent,
lower_bound_mtas,
max_vert_lines;
extern Heuristic heuristic,
newheur;
extern int newautoRefresh,
newautoReconnect,
newbackoff,
newconfirm;
int newint;
unsigned long newTimes;
extern XColor white, black;
extern Pixel bg, fg;
/* ARGSUSED */
void Configure(w, client_data, call_data)
Widget w;
caddr_t client_data; /* unused */
caddr_t call_data; /* unused */
{
int x,y,i;
Window r_child;
char number[BUFSIZ], *str;
newautoRefresh = autoRefresh;
newautoReconnect = autoReconnect;
newbackoff = backoff;
newconfirm = confirm;
newheur = heuristic;
textdisplay(&(config->tuple[REFRESH]),
unparsetime(timeoutFor / 1000 ));
textdisplay(&(config->tuple[INACTIVE]),
unparsetime(inactiveFor / 1000));
textdisplay(&(config->tuple[START]),
unparsetime(connectInit / 1000 ));
textdisplay(&(config->tuple[BACKOFF]),
unparsetime(connectInc / 1000 ));
textdisplay(&(config->tuple[CONNECTMAX]),
unparsetime(connectMax / 1000 ));
sprintf(number, "%d", percent);
textdisplay(&(config->tuple[PERCENT]),number);
sprintf(number, "%d", lower_bound_mtas);
textdisplay(&(config->tuple[MINBADMTA]), number);
sprintf(number, "%d", max_vert_lines);
textdisplay(&(config->tuple[LINEMAX]), number);
XtSetKeyboardFocus(config->form, config->tuple[REFRESH].text);
WidgetSet(config->tuple[REFRESH].text,
XtNborderColor, fg,
NULL);
WidgetSet (refresh_toggle,
XtNlabel, (autoRefresh == TRUE) ? "enabled" : "disabled",
NULL);
WidgetSet (reconnect_toggle,
XtNlabel, (autoReconnect == TRUE) ? "enabled" : "disabled",
NULL);
WidgetSet (backoff_toggle,
XtNlabel, (backoff == TRUE) ? "enabled" : "disabled",
NULL);
WidgetSet (confirm_toggle,
XtNlabel, (confirm == TRUE) ? "enabled" : "disabled",
NULL);
switch (heuristic) {
case percentage:
str = PERCENT_BASED;
break;
case all:
str = ALL_BASED;
break;
default:
heuristic = line;
case line:
str = LINE_BASED;
break;
}
WidgetSet (heur_toggle,
XtNlabel, str,
NULL);
for (i = 1; i < config->numberOftuples; i++)
WidgetSet(config->tuple[i].text,
XtNborderColor, bg,
NULL);
XTranslateCoordinates(XtDisplay(w),XtWindow(w),
XDefaultRootWindow(XtDisplay(w)),0,0,&x,&y,
&r_child);
Popup(config, unknown, x, y);
}
/* ARGSUSED */
void popup_NOTOK(w, op, call_data)
Widget w;
Operations *op;
caddr_t call_data;
{
Popup_menu *popup;
switch(*op) {
case quit:
case disconnect:
popup = yesno;
break;
case connect:
popup = connectpopup;
break;
case chanread:
case chanstop:
case chanstart:
case chanclear:
case chaninfo:
case chandownforce:
case msginfo:
popup = one;
break;
case chancacheadd:
case mtaread:
case mtastop:
case mtastart:
case mtaclear:
case msgstop:
case msgstart:
case msgclear:
case mtainfo:
case mtaforce:
case mtadownforce:
popup = two;
break;
case mtacacheadd:
case msgcacheadd:
popup = three;
break;
case msgforce:
if (currentmta == NULL)
popup = three;
else
popup = two;
break;
default:
popup = config;
break;
}
ResetInactiveTimeout();
if (popup != NULL)
Popdown(popup);
}
/* ARGSUSED */
void popup_OK(w, op, call_data)
Widget w;
Operations *op;
caddr_t call_data;
{
Popup_menu *popup = NULL;
struct chan_struct *chan;
XSync(XtDisplay(w), 0);
switch(*op) {
case quit:
Quit();
popup = yesno;
break;
case disconnect:
Disconnect();
popup = yesno;
break;
case chanstop:
case chanstart:
case chanclear:
if (one->tuple[0].str[0] != '\0') {
ChanControl(*op, one->tuple[0].str, (char *) NULL);
popup = one;
}
break;
case chancacheadd:
if (two->tuple[0].str[0] != '\0'
&& two->tuple[1].str[0] != '\0') {
ChanControl(*op, two->tuple[1].str,
two->tuple[0].str);
popup = two;
}
break;
case chaninfo:
if (one->tuple[0].str[0] != '\0') {
ChanInfo(one->tuple[0].str);
popup = one;
}
break;
case chandownforce:
if (one->tuple[0].str[0] != '\0') {
if ((chan = find_channel(one->tuple[0].str)) != NULL){
ChanDownForce(chan);
popup = one;
}
}
break;
case msgstop:
case msgstart:
case msgclear:
if (two->tuple[0].str[0] != '\0'
&& two->tuple[1].str[0] != '\0') {
MsgControl(*op, two->tuple[0].str,
two->tuple[1].str, (char *) NULL);
popup = two;
}
break;
case msgforce:
if (currentchan == NULL)
break;
if (currentmta == NULL) {
if (three->tuple[0].str[0] != '\0'
&& three->tuple[1].str[0] != '\0'
&& three->tuple[2].str[0] != '\0') {
struct mta_struct *mta;
struct msg_struct *msg;
if ((mta = find_mta(currentchan,
three->tuple[2].str)) != NULL
&& (msg = find_msg(three->tuple[0].str)) != NULL) {
MsgForce(msg, three->tuple[1].str,
mta, currentchan);
popup = three;
}
}
} else {
if (two->tuple[0].str[0] != '\0'
&& two->tuple[1].str[0] != '\0') {
struct msg_struct *msg;
if ((msg = find_msg(two->tuple[0].str)) != NULL) {
MsgForce(msg, two->tuple[1].str,
currentmta, currentchan);
popup = two;
}
}
}
break;
case msgcacheadd:
if (three->tuple[0].str[0] != '\0'
&& three->tuple[1].str[0] != '\0'
&& three->tuple[2].str[0] != '\0') {
MsgControl(*op, three->tuple[1].str,
three->tuple[2].str, three->tuple[0].str);
popup = three;
}
break;
case msginfo:
if (one->tuple[0].str[0] != '\0') {
MsgInfo(one->tuple[0].str);
popup = one;
}
break;
case mtaclear:
case mtastop:
case mtastart:
if (two->tuple[0].str[0] != '\0'
&& two->tuple[1].str[0] != '\0') {
MtaControl(*op, two->tuple[0].str,
two->tuple[1].str, (char *) NULL);
popup = two;
}
break;
case mtaforce:
if (two->tuple[0].str[0] != '\0'
&& two->tuple[1].str[0] != '\0') {
struct mta_struct *mta;
struct chan_struct *chan;
if ((chan = find_channel(two->tuple[1].str)) != NULL
&& (mta = find_mta(chan,
two->tuple[0].str)) != NULL) {
MtaForce(mta, chan);
popup = two;
}
}
break;
case mtadownforce:
if (two->tuple[0].str[0] != '\0'
&& two->tuple[1].str[0] != '\0') {
struct mta_struct *mta;
struct chan_struct *chan;
if ((chan = find_channel(two->tuple[1].str)) != NULL
&& (mta = find_mta(chan,
two->tuple[0].str)) != NULL) {
MtaDownForce(chan, mta);
popup = two;
}
}
break;
case mtainfo:
if (two->tuple[0].str[0] != '\0'
&& two->tuple[1].str[0] != '\0') {
MtaInfo(two->tuple[0].str, two->tuple[1].str);
popup = two;
}
break;
case mtacacheadd:
if (three->tuple[0].str[0] != '\0'
&& three->tuple[1].str[0] != '\0'
&& three->tuple[2].str[0] != '\0') {
MtaControl(*op, three->tuple[1].str,
three->tuple[2].str, three->tuple[0].str);
popup = three;
}
default:
break;
}
ResetInactiveTimeout();
if (popup != NULL)
Popdown(popup);
else
XBell(XtDisplay(w), 50);
}
/* configure buttons */
#define MINTIMEOUT 30000 /* 1/2 min */
extern Widget load1_sc, load2_sc;
settimeoutFor(str)
char *str;
{
newTimes = (unsigned long) (parsetime(str) * 1000);
if (newTimes > MINTIMEOUT)
timeoutFor = newTimes;
}
/* ARGSUSED */
void config_OK(w, client_data, call_data)
Widget w;
caddr_t client_data;
caddr_t call_data;
{
int ok = TRUE,
do_reset_refresh = FALSE,
do_reset_reconnect = FALSE;
if (newautoRefresh != autoRefresh) {
autoRefresh = newautoRefresh;
do_reset_refresh = TRUE;
}
newTimes = (unsigned long) (parsetime(config->tuple[REFRESH].str) * 1000);
if (newTimes != timeoutFor) {
if (newTimes < MINTIMEOUT) {
/* BEEP */
timeoutFor = MINTIMEOUT;
textdisplay(&(config->tuple[REFRESH]),
unparsetime(timeoutFor / 1000));
ok = FALSE;
} else {
timeoutFor = newTimes;
do_reset_refresh = TRUE;
}
WidgetSet(load1_sc,
XtNupdate, (int) (timeoutFor / 2000),
NULL);
WidgetSet(load2_sc,
XtNupdate, (int) (timeoutFor / 2000),
NULL);
}
newTimes = (unsigned long) (parsetime(config->tuple[INACTIVE].str) * 1000);
if (newTimes != inactiveFor)
inactiveFor = newTimes;
newTimes = (unsigned long) (parsetime(config->tuple[START].str) * 1000);
if (newTimes != connectInit) {
connectInit = newTimes;
do_reset_reconnect = TRUE;
}
newTimes = (unsigned long) (parsetime(config->tuple[BACKOFF].str) * 1000);
if (newTimes != connectInc) {
connectInc = newTimes;
do_reset_reconnect = TRUE;
}
newTimes = (unsigned long) (parsetime(config->tuple[CONNECTMAX].str) * 1000);
if (newTimes != connectMax) {
connectMax = newTimes;
do_reset_reconnect = TRUE;
}
if (newautoReconnect != autoReconnect) {
autoReconnect = newautoReconnect;
do_reset_reconnect = TRUE;
}
if (newbackoff != backoff) {
backoff = newbackoff;
do_reset_reconnect = TRUE;
}
if (newconfirm != confirm)
confirm = newconfirm;
if (newheur != heuristic)
heuristic = newheur;
switch (heuristic) {
case percentage:
if ((newint = atoi(config->tuple[PERCENT].str)) != 0)
percent = newint;
if ((newint = atoi(config->tuple[MINBADMTA].str)) != 0)
lower_bound_mtas = newint;
break;
case line:
if ((newint = atoi(config->tuple[LINEMAX].str)) != 0)
max_vert_lines = newint;
break;
default:
break;
}
if (do_reset_refresh == TRUE
&& connectState == connected)
InitRefreshTimeOut((unsigned long) 500);
if (do_reset_reconnect == TRUE
&& connectState != connected
&& userConnected == TRUE) InitConnectTimeOut();
ResetInactiveTimeout();
if (ok == TRUE)
Popdown(config);
else
XBell(XtDisplay(w), 50);
}
extern Popup_menu *currentpopup,
*qcontrol;
extern Widget line_form, percent_form;
/* ARGSUSED */
void heurToggle (w, pheur, call_data)
Widget w;
Heuristic *pheur;
caddr_t call_data;
{
if (currentpopup != config)
return;
switch (*pheur) {
case percentage:
*pheur = line;
WidgetSet(w,
XtNlabel, LINE_BASED,
NULL);
XtSetMappedWhenManaged (line_form, True);
XtSetMappedWhenManaged (percent_form, False);
break;
case line:
*pheur = all;
WidgetSet(w,
XtNlabel, ALL_BASED,
NULL);
XtSetMappedWhenManaged (line_form, False);
XtSetMappedWhenManaged (percent_form, False);
break;
case all:
*pheur = percentage;
WidgetSet(w,
XtNlabel, PERCENT_BASED,
NULL);
XtSetMappedWhenManaged (line_form, False);
XtSetMappedWhenManaged (percent_form, True);
break;
}
}
extern Widget auth_toggle;
/* ARGSUSED */
void configToggle(w, pint, call_data)
Widget w;
int *pint;
caddr_t call_data;
{
if (currentpopup == NULL)
return;
if (*pint == TRUE) {
/* enabled -> disabled */
*pint = FALSE;
WidgetSet(w,
XtNlabel, "disabled",
NULL);
if (w == auth_toggle
&& currentpopup->selected != 0) {
XtSetKeyboardFocus(top,
currentpopup->tuple[0].text);
XtSetKeyboardFocus(currentpopup->form,
currentpopup->tuple[0].text);
WidgetSet(currentpopup->tuple[0].text,
XtNborderColor, fg,
NULL);
WidgetSet(currentpopup->tuple[currentpopup->selected].text,
XtNborderColor, bg,
NULL);
currentpopup->selected = 0;
}
} else {
/* disabled -> enabled */
*pint = TRUE;
WidgetSet(w,
XtNlabel, "enabled",
NULL);
}
if (w == auth_toggle)
SetAuthDisplay(*pint);
ResetInactiveTimeout();
}
void SetAuthDisplay(bool)
int bool;
{
XtSetMappedWhenManaged(connectpopup->tuple[2].label, bool);
XtSetMappedWhenManaged(connectpopup->tuple[3].label, bool);
XtSetMappedWhenManaged(connectpopup->tuple[2].text, bool);
XtSetMappedWhenManaged(connectpopup->tuple[3].text, bool);
if (bool == TRUE) {
textdisplay(&(connectpopup->tuple[2]),
(username == NULL) ? "" : username);
password[0] = '\0';
textdisplay(&(connectpopup->tuple[3]),"");
}
}
/* ARGSUSED */
void connectpopup_OK(w, client_data, call_data)
Widget w;
caddr_t client_data;
caddr_t call_data;
{
if (newauth != auth)
auth = newauth;
if (connectpopup->tuple[0].str[0] == '\0'
|| (auth == TRUE && (connectpopup->tuple[2].str[0] == '\0'))) {
XBell(XtDisplay(w), 50);
return;
}
if (connectpopup->tuple[1].str[0] == '\0')
tailorfile[0] = '\0';
else
strcpy(tailorfile, connectpopup->tuple[1].str);
if (connectpopup->tuple[2].str[0] != '\0')
strcpy(username, connectpopup->tuple[2].str);
fillin_passwdpep(username, password, auth);
StartWait();
Connect(connectpopup->tuple[0].str);
EndWait();
ResetInactiveTimeout();
Popdown(connectpopup);
}
/* ARGSUSED */
void QControlPopup(w, op, call_data)
Widget w;
int op;
caddr_t call_data;
{
int x,y;
Window r_child;
XTranslateCoordinates(XtDisplay(w),XtWindow(w),
XDefaultRootWindow(XtDisplay(w)),0,0,&x,&y,
&r_child);
ResetInactiveTimeout();
Popup(qcontrol, unknown, x, y);
}
extern int msgs_ub;
/* ARGSUSED */
void MsgsShowAll (w, client_data, call_data)
Widget w;
caddr_t client_data,
call_data;
{
msgs_ub = False;
control_display_msgs();
msgs_ub = True;
}
/* ARGSUSED */
void QControl(w, op, call_data)
Widget w;
int op;
caddr_t call_data;
{
my_invoke(quecontrol, (char **) op);
ResetInactiveTimeout();
Popdown(qcontrol);
}
/* \f
*/
extern Widget channel_commands,
mta_commands,
msg_commands,
qcontrol_command;
SensitizeButtons(bool)
int bool;
{
XtSetSensitive(qcontrol_command,bool);
XtSetSensitive(channel_commands,bool);
XtSetSensitive(mta_commands,bool);
XtSetSensitive(msg_commands,bool);
}