--- sbbs/sbbs2/scfg/scfgchat.c 2018/04/24 16:37:52 1.1.1.1 +++ sbbs/sbbs2/scfg/scfgchat.c 2018/04/24 16:39:20 1.1.1.2 @@ -1,819 +1,819 @@ -#line 2 "SCFGCHAT.C" - -/* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */ - -#include "scfg.h" - -void page_cfg() -{ - static int dflt,bar; - char str[81],done=0; - int j,k; - uint i; - static page_t savpage; - -while(1) { - for(i=0;icmd,page[i]->ar); - opt[i][0]=0; - savnum=0; - j=WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT; - if(total_pages) - j|=WIN_DEL|WIN_GET; - if(total_pagesi;j--) - page[j]=page[j-1]; - if((page[i]=(page_t *)MALLOC(sizeof(page_t)))==NULL) { - errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(page_t)); - continue; } - memset((page_t *)page[i],0,sizeof(page_t)); - strcpy(page[i]->cmd,str); - total_pages++; - changes=1; - continue; } - if((i&MSK_ON)==MSK_DEL) { - i&=MSK_OFF; - FREE(page[i]); - total_pages--; - for(j=i;jcmd); - sprintf(opt[k++],"%-27.27s%.40s","Access Requirements",page[i]->ar); - sprintf(opt[k++],"%-27.27s%s","Intercept I/O Interrupts" - ,page[i]->misc&IO_INTS ? "Yes":"No"); - opt[k][0]=0; - sprintf(str,"Sysop Chat Pager #%d",i+1); - savnum=1; - switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,60,&j,0,str,opt)) { - case -1: - done=1; - break; - case 0: - SETHELP(WHERE); -/* -External Chat Pager Command Line: - -This is the command line to execute for this external chat pager. -*/ - strcpy(str,page[i]->cmd); - if(!uinput(WIN_MID|WIN_SAV,0,10,"Command Line" - ,page[i]->cmd,50,K_EDIT)) - strcpy(page[i]->cmd,str); - break; - case 1: - savnum=2; - getar(str,page[i]->ar); - break; - case 2: - k=1; - strcpy(opt[0],"Yes"); - strcpy(opt[1],"No"); - opt[2][0]=0; - savnum=2; - SETHELP(WHERE); -/* -Intercept I/O Interrupts: - -If you wish the DOS screen output and keyboard input to be intercepted -when running this chat pager, set this option to Yes. -*/ - k=ulist(WIN_MID|WIN_SAV,0,0,0,&k,0,"Intercept I/O Interrupts" - ,opt); - if(!k && !(page[i]->misc&IO_INTS)) { - page[i]->misc|=IO_INTS; - changes=1; } - else if(k==1 && page[i]->misc&IO_INTS) { - page[i]->misc&=~IO_INTS; - changes=1; } - break; - - } } } -} - -void chan_cfg() -{ - static int chan_dflt,chan_bar,opt_dflt; - char str[81],code[9],done=0,*p; - int j,k; - uint i; - static chan_t savchan; - -while(1) { - for(i=0;iname); - opt[i][0]=0; - j=WIN_ACT|WIN_SAV|WIN_BOT|WIN_RHT; - savnum=0; - if(total_chans) - j|=WIN_DEL|WIN_GET; - if(total_chansi;j--) - chan[j]=chan[j-1]; - if((chan[i]=(chan_t *)MALLOC(sizeof(chan_t)))==NULL) { - errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(chan_t)); - continue; } - memset((chan_t *)chan[i],0,sizeof(chan_t)); - strcpy(chan[i]->name,str); - strcpy(chan[i]->code,code); - total_chans++; - changes=1; - continue; } - if((i&MSK_ON)==MSK_DEL) { - i&=MSK_OFF; - FREE(chan[i]); - total_chans--; - for(j=i;jname); - sprintf(opt[k++],"%-27.27s%s","Internal Code",chan[i]->code); - sprintf(opt[k++],"%-27.27s%lu","Cost in Credits",chan[i]->cost); - sprintf(opt[k++],"%-27.27s%.40s","Access Requirements" - ,chan[i]->ar); - sprintf(opt[k++],"%-27.27s%s","Password Protection" - ,chan[i]->misc&CHAN_PW ? "Yes" : "No"); - sprintf(opt[k++],"%-27.27s%s","Guru Joins When Empty" - ,chan[i]->misc&CHAN_GURU ? "Yes" : "No"); - sprintf(opt[k++],"%-27.27s%s","Channel Guru" - ,chan[i]->guruguru]->name : ""); - sprintf(opt[k++],"%-27.27s%s","Channel Action Set" - ,actset[chan[i]->actset]->name); - opt[k][0]=0; - SETHELP(WHERE); -/* -Chat Channel Configuration: - -This menu is for configuring the selected chat channel. -*/ - savnum=1; - sprintf(str,"%s Chat Channel",chan[i]->name); - switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,60,&opt_dflt,0,str,opt)) { - case -1: - done=1; - break; - case 0: - SETHELP(WHERE); -/* -Chat Channel Name: - -This is the name or description of the chat channel. -*/ - strcpy(str,chan[i]->name); - if(!uinput(WIN_MID|WIN_SAV,0,10,"Chat Channel Name" - ,chan[i]->name,25,K_EDIT)) - strcpy(chan[i]->name,str); - break; - case 1: - SETHELP(WHERE); -/* -Chat Channel Internal Code: - -Every chat channel must have its own unique code for Synchronet to refer -to it internally. This code is usually an abreviation of the chat -channel name. -*/ - strcpy(str,chan[i]->code); - if(!uinput(WIN_MID|WIN_SAV,0,10,"Internal Code" - ,str,8,K_UPPER|K_EDIT)) - break; - if(code_ok(str)) - strcpy(chan[i]->code,str); - else { - helpbuf=invalid_code; - umsg("Invalid Code"); - helpbuf=0; } - break; - case 2: - ultoa(chan[i]->cost,str,10); - SETHELP(WHERE); -/* -Chat Channel Cost to Join: - -If you want users to be charged credits to join this chat channel, set -this value to the number of credits to charge. If you want this channel -to be free, set this value to 0. -*/ - uinput(WIN_MID|WIN_SAV,0,0,"Cost to Join (in Credits)" - ,str,10,K_EDIT|K_NUMBER); - chan[i]->cost=atol(str); - break; - case 3: - savnum=2; - sprintf(str,"%s Chat Channel",chan[i]->name); - getar(str,chan[i]->ar); - break; - case 4: - k=1; - strcpy(opt[0],"Yes"); - strcpy(opt[1],"No"); - opt[2][0]=0; - savnum=2; - SETHELP(WHERE); -/* -Allow Channel to be Password Protected: - -If you want to allow the first user to join this channel to password -protect it, set this option to Yes. -*/ - k=ulist(WIN_MID|WIN_SAV,0,0,0,&k,0 - ,"Allow Channel to be Password Protected" - ,opt); - if(!k && !(chan[i]->misc&CHAN_PW)) { - chan[i]->misc|=CHAN_PW; - changes=1; } - else if(k==1 && chan[i]->misc&CHAN_PW) { - chan[i]->misc&=~CHAN_PW; - changes=1; } - break; - case 5: - k=1; - strcpy(opt[0],"Yes"); - strcpy(opt[1],"No"); - opt[2][0]=0; - savnum=2; - SETHELP(WHERE); -/* -Guru Joins This Channel When Empty: - -If you want the system guru to join this chat channel when there is -only one user, set this option to Yes. -*/ - k=ulist(WIN_MID|WIN_SAV,0,0,0,&k,0 - ,"Guru Joins This Channel When Empty" - ,opt); - if(!k && !(chan[i]->misc&CHAN_GURU)) { - chan[i]->misc|=CHAN_GURU; - changes=1; } - else if(k==1 && chan[i]->misc&CHAN_GURU) { - chan[i]->misc&=~CHAN_GURU; - changes=1; } - break; - case 6: -SETHELP(WHERE); -/* -Channel Guru: - -This is a list of available chat Gurus. Select the one that you wish -to have available in this channel. -*/ - k=0; - for(j=0;jname); - opt[j][0]=0; - savnum=2; - k=ulist(WIN_SAV|WIN_RHT,0,0,25,&j,0 - ,"Available Chat Gurus",opt); - if(k==-1) - break; - chan[i]->guru=k; - break; - case 7: -SETHELP(WHERE); -/* -Channel Action Set: - -This is a list of available chat action sets. Select the one that you wish -to have available in this channel. -*/ - k=0; - for(j=0;jname); - opt[j][0]=0; - savnum=2; - k=ulist(WIN_SAV|WIN_RHT,0,0,25,&j,0 - ,"Available Chat Action Sets",opt); - if(k==-1) - break; - changes=1; - chan[i]->actset=k; - break; } } } -} - -void chatact_cfg(uint setnum) -{ - static int chatact_dflt,chatact_bar; - char str[128],cmd[128],out[128]; - int j,k; - uint i,n,chatnum[MAX_OPTS+1]; - static chatact_t savchatact; - -while(1) { - for(i=0,j=0;iactset==setnum) { - sprintf(opt[j],"%-*.*s %s",LEN_CHATACTCMD,LEN_CHATACTCMD - ,chatact[i]->cmd,chatact[i]->out); - chatnum[j++]=i; } - chatnum[j]=total_chatacts; - opt[j][0]=0; - savnum=2; - i=WIN_ACT|WIN_SAV; - if(j) - i|=WIN_DEL|WIN_GET; - if(jname); - i=ulist(i,0,0,70,&chatact_dflt,&chatact_bar,str,opt); - savnum=3; - if((signed)i==-1) - return; - if((i&MSK_ON)==MSK_INS) { - i&=MSK_OFF; - SETHELP(WHERE); -/* -Chat Action Command: - -This is the command word (normally a verb) to trigger the action output. -*/ - if(uinput(WIN_MID|WIN_SAV,0,0,"Action Command",cmd,LEN_CHATACTCMD - ,K_UPPER)<1) - continue; - SETHELP(WHERE); -/* -Chat Action Output String: - -This is the output string displayed with this action output. -*/ - if(uinput(WIN_MID|WIN_SAV,0,0,"",out,LEN_CHATACTOUT - ,K_MSG)<1) - continue; - if((chatact=(chatact_t **)REALLOC(chatact - ,sizeof(chatact_t *)*(total_chatacts+1)))==NULL) { - errormsg(WHERE,ERR_ALLOC,nulstr,total_chatacts+1); - total_chatacts=0; - bail(1); - continue; } - if(j) - for(n=total_chatacts;n>chatnum[i];n--) - chatact[n]=chatact[n-1]; - if((chatact[chatnum[i]]=(chatact_t *)MALLOC(sizeof(chatact_t)))==NULL) { - errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(chatact_t)); - continue; } - memset((chatact_t *)chatact[chatnum[i]],0,sizeof(chatact_t)); - strcpy(chatact[chatnum[i]]->cmd,cmd); - strcpy(chatact[chatnum[i]]->out,out); - chatact[chatnum[i]]->actset=setnum; - total_chatacts++; - changes=1; - continue; } - if((i&MSK_ON)==MSK_DEL) { - i&=MSK_OFF; - FREE(chatact[chatnum[i]]); - total_chatacts--; - for(j=chatnum[i];jactset=setnum; - changes=1; - continue; } - SETHELP(WHERE); -/* -Chat Action Command: - -This is the command that triggers this chat action. -*/ - strcpy(str,chatact[chatnum[i]]->cmd); - if(!uinput(WIN_MID|WIN_SAV,0,10,"Chat Action Command" - ,chatact[chatnum[i]]->cmd,LEN_CHATACTCMD,K_EDIT|K_UPPER)) { - strcpy(chatact[chatnum[i]]->cmd,str); - continue; } - SETHELP(WHERE); -/* -Chat Action Output String: - -This is the output string that results from this chat action. -*/ - strcpy(str,chatact[chatnum[i]]->out); - if(!uinput(WIN_MID|WIN_SAV,0,10,"" - ,chatact[chatnum[i]]->out,LEN_CHATACTOUT,K_EDIT|K_MSG)) - strcpy(chatact[chatnum[i]]->out,str); } -} - -void guru_cfg() -{ - static int guru_dflt,guru_bar,opt_dflt; - char str[81],code[9],done=0,*p; - int j,k; - uint i; - static guru_t savguru; - -while(1) { - for(i=0;iname); - opt[i][0]=0; - savnum=0; - j=WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT; - if(total_gurus) - j|=WIN_DEL|WIN_GET; - if(total_gurusi;j--) - guru[j]=guru[j-1]; - if((guru[i]=(guru_t *)MALLOC(sizeof(guru_t)))==NULL) { - errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(guru_t)); - continue; } - memset((guru_t *)guru[i],0,sizeof(guru_t)); - strcpy(guru[i]->name,str); - strcpy(guru[i]->code,code); - total_gurus++; - changes=1; - continue; } - if((i&MSK_ON)==MSK_DEL) { - i&=MSK_OFF; - FREE(guru[i]); - total_gurus--; - for(j=i;jname); - sprintf(opt[k++],"%-27.27s%s","Guru Internal Code",guru[i]->code); - sprintf(opt[k++],"%-27.27s%.40s","Access Requirements",guru[i]->ar); - opt[k][0]=0; - savnum=1; - SETHELP(WHERE); -/* -Guru Configuration: - -This menu is for configuring the selected Guru. -*/ - switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,60,&opt_dflt,0,guru[i]->name - ,opt)) { - case -1: - done=1; - break; - case 0: - SETHELP(WHERE); -/* -Guru Name: - -This is the name of the selected Guru. -*/ - strcpy(str,guru[i]->name); - if(!uinput(WIN_MID|WIN_SAV,0,10,"Guru Name" - ,guru[i]->name,25,K_EDIT)) - strcpy(guru[i]->name,str); - break; - case 1: -SETHELP(WHERE); -/* -Guru Internal Code: - -Every Guru must have its own unique code for Synchronet to refer to -it internally. This code is usually an abreviation of the Guru name. -*/ - strcpy(str,guru[i]->code); - if(!uinput(WIN_MID|WIN_SAV,0,0,"Guru Internal Code" - ,str,8,K_EDIT|K_UPPER)) - break; - if(code_ok(str)) - strcpy(guru[i]->code,str); - else { - helpbuf=invalid_code; - umsg("Invalid Code"); - helpbuf=0; } - break; - case 2: - savnum=2; - getar(guru[i]->name,guru[i]->ar); - break; } } } -} - -void actsets_cfg() -{ - static int actset_dflt,actset_bar,opt_dflt; - char str[81]; - int j,k,done; - uint i; - static actset_t savactset; - -while(1) { - for(i=0;iname); - opt[i][0]=0; - j=WIN_ACT|WIN_RHT|WIN_BOT|WIN_SAV; - savnum=0; - if(total_actsets) - j|=WIN_DEL|WIN_GET; - if(total_actsetsi;j--) - actset[j]=actset[j-1]; - if((actset[i]=(actset_t *)MALLOC(sizeof(actset_t)))==NULL) { - errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(actset_t)); - continue; } - memset((actset_t *)actset[i],0,sizeof(actset_t)); - strcpy(actset[i]->name,str); - total_actsets++; - changes=1; - continue; } - if((i&MSK_ON)==MSK_DEL) { - i&=MSK_OFF; - FREE(actset[i]); - total_actsets--; - for(j=i;jname); - sprintf(opt[k++],"%-27.27s","Configure Chat Actions..."); - opt[k][0]=0; - SETHELP(WHERE); -/* -Chat Action Set Configuration: - -This menu is for configuring the selected chat action set. -*/ - sprintf(str,"%s Chat Action Set",actset[i]->name); - savnum=1; - switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,60,&opt_dflt,0,str - ,opt)) { - case -1: - done=1; - break; - case 0: - SETHELP(WHERE); -/* -Chat Action Set Name: - -This is the name of the selected action set. -*/ - strcpy(str,actset[i]->name); - if(!uinput(WIN_MID|WIN_SAV,0,10,"Action Set Name" - ,actset[i]->name,25,K_EDIT)) - strcpy(actset[i]->name,str); - break; - case 1: - chatact_cfg(i); - break; } } } -} - +#line 2 "SCFGCHAT.C" + +/* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */ + +#include "scfg.h" + +void page_cfg() +{ + static int dflt,bar; + char str[81],done=0; + int j,k; + uint i; + static page_t savpage; + +while(1) { + for(i=0;icmd,page[i]->ar); + opt[i][0]=0; + savnum=0; + j=WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT; + if(total_pages) + j|=WIN_DEL|WIN_GET; + if(total_pagesi;j--) + page[j]=page[j-1]; + if((page[i]=(page_t *)MALLOC(sizeof(page_t)))==NULL) { + errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(page_t)); + continue; } + memset((page_t *)page[i],0,sizeof(page_t)); + strcpy(page[i]->cmd,str); + total_pages++; + changes=1; + continue; } + if((i&MSK_ON)==MSK_DEL) { + i&=MSK_OFF; + FREE(page[i]); + total_pages--; + for(j=i;jcmd); + sprintf(opt[k++],"%-27.27s%.40s","Access Requirements",page[i]->ar); + sprintf(opt[k++],"%-27.27s%s","Intercept I/O Interrupts" + ,page[i]->misc&IO_INTS ? "Yes":"No"); + opt[k][0]=0; + sprintf(str,"Sysop Chat Pager #%d",i+1); + savnum=1; + switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,60,&j,0,str,opt)) { + case -1: + done=1; + break; + case 0: + SETHELP(WHERE); +/* +External Chat Pager Command Line: + +This is the command line to execute for this external chat pager. +*/ + strcpy(str,page[i]->cmd); + if(!uinput(WIN_MID|WIN_SAV,0,10,"Command Line" + ,page[i]->cmd,50,K_EDIT)) + strcpy(page[i]->cmd,str); + break; + case 1: + savnum=2; + getar(str,page[i]->ar); + break; + case 2: + k=1; + strcpy(opt[0],"Yes"); + strcpy(opt[1],"No"); + opt[2][0]=0; + savnum=2; + SETHELP(WHERE); +/* +Intercept I/O Interrupts: + +If you wish the DOS screen output and keyboard input to be intercepted +when running this chat pager, set this option to Yes. +*/ + k=ulist(WIN_MID|WIN_SAV,0,0,0,&k,0,"Intercept I/O Interrupts" + ,opt); + if(!k && !(page[i]->misc&IO_INTS)) { + page[i]->misc|=IO_INTS; + changes=1; } + else if(k==1 && page[i]->misc&IO_INTS) { + page[i]->misc&=~IO_INTS; + changes=1; } + break; + + } } } +} + +void chan_cfg() +{ + static int chan_dflt,chan_bar,opt_dflt; + char str[81],code[9],done=0,*p; + int j,k; + uint i; + static chan_t savchan; + +while(1) { + for(i=0;iname); + opt[i][0]=0; + j=WIN_ACT|WIN_SAV|WIN_BOT|WIN_RHT; + savnum=0; + if(total_chans) + j|=WIN_DEL|WIN_GET; + if(total_chansi;j--) + chan[j]=chan[j-1]; + if((chan[i]=(chan_t *)MALLOC(sizeof(chan_t)))==NULL) { + errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(chan_t)); + continue; } + memset((chan_t *)chan[i],0,sizeof(chan_t)); + strcpy(chan[i]->name,str); + strcpy(chan[i]->code,code); + total_chans++; + changes=1; + continue; } + if((i&MSK_ON)==MSK_DEL) { + i&=MSK_OFF; + FREE(chan[i]); + total_chans--; + for(j=i;jname); + sprintf(opt[k++],"%-27.27s%s","Internal Code",chan[i]->code); + sprintf(opt[k++],"%-27.27s%lu","Cost in Credits",chan[i]->cost); + sprintf(opt[k++],"%-27.27s%.40s","Access Requirements" + ,chan[i]->ar); + sprintf(opt[k++],"%-27.27s%s","Password Protection" + ,chan[i]->misc&CHAN_PW ? "Yes" : "No"); + sprintf(opt[k++],"%-27.27s%s","Guru Joins When Empty" + ,chan[i]->misc&CHAN_GURU ? "Yes" : "No"); + sprintf(opt[k++],"%-27.27s%s","Channel Guru" + ,chan[i]->guruguru]->name : ""); + sprintf(opt[k++],"%-27.27s%s","Channel Action Set" + ,actset[chan[i]->actset]->name); + opt[k][0]=0; + SETHELP(WHERE); +/* +Chat Channel Configuration: + +This menu is for configuring the selected chat channel. +*/ + savnum=1; + sprintf(str,"%s Chat Channel",chan[i]->name); + switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,60,&opt_dflt,0,str,opt)) { + case -1: + done=1; + break; + case 0: + SETHELP(WHERE); +/* +Chat Channel Name: + +This is the name or description of the chat channel. +*/ + strcpy(str,chan[i]->name); + if(!uinput(WIN_MID|WIN_SAV,0,10,"Chat Channel Name" + ,chan[i]->name,25,K_EDIT)) + strcpy(chan[i]->name,str); + break; + case 1: + SETHELP(WHERE); +/* +Chat Channel Internal Code: + +Every chat channel must have its own unique code for Synchronet to refer +to it internally. This code is usually an abreviation of the chat +channel name. +*/ + strcpy(str,chan[i]->code); + if(!uinput(WIN_MID|WIN_SAV,0,10,"Internal Code" + ,str,8,K_UPPER|K_EDIT)) + break; + if(code_ok(str)) + strcpy(chan[i]->code,str); + else { + helpbuf=invalid_code; + umsg("Invalid Code"); + helpbuf=0; } + break; + case 2: + ultoa(chan[i]->cost,str,10); + SETHELP(WHERE); +/* +Chat Channel Cost to Join: + +If you want users to be charged credits to join this chat channel, set +this value to the number of credits to charge. If you want this channel +to be free, set this value to 0. +*/ + uinput(WIN_MID|WIN_SAV,0,0,"Cost to Join (in Credits)" + ,str,10,K_EDIT|K_NUMBER); + chan[i]->cost=atol(str); + break; + case 3: + savnum=2; + sprintf(str,"%s Chat Channel",chan[i]->name); + getar(str,chan[i]->ar); + break; + case 4: + k=1; + strcpy(opt[0],"Yes"); + strcpy(opt[1],"No"); + opt[2][0]=0; + savnum=2; + SETHELP(WHERE); +/* +Allow Channel to be Password Protected: + +If you want to allow the first user to join this channel to password +protect it, set this option to Yes. +*/ + k=ulist(WIN_MID|WIN_SAV,0,0,0,&k,0 + ,"Allow Channel to be Password Protected" + ,opt); + if(!k && !(chan[i]->misc&CHAN_PW)) { + chan[i]->misc|=CHAN_PW; + changes=1; } + else if(k==1 && chan[i]->misc&CHAN_PW) { + chan[i]->misc&=~CHAN_PW; + changes=1; } + break; + case 5: + k=1; + strcpy(opt[0],"Yes"); + strcpy(opt[1],"No"); + opt[2][0]=0; + savnum=2; + SETHELP(WHERE); +/* +Guru Joins This Channel When Empty: + +If you want the system guru to join this chat channel when there is +only one user, set this option to Yes. +*/ + k=ulist(WIN_MID|WIN_SAV,0,0,0,&k,0 + ,"Guru Joins This Channel When Empty" + ,opt); + if(!k && !(chan[i]->misc&CHAN_GURU)) { + chan[i]->misc|=CHAN_GURU; + changes=1; } + else if(k==1 && chan[i]->misc&CHAN_GURU) { + chan[i]->misc&=~CHAN_GURU; + changes=1; } + break; + case 6: +SETHELP(WHERE); +/* +Channel Guru: + +This is a list of available chat Gurus. Select the one that you wish +to have available in this channel. +*/ + k=0; + for(j=0;jname); + opt[j][0]=0; + savnum=2; + k=ulist(WIN_SAV|WIN_RHT,0,0,25,&j,0 + ,"Available Chat Gurus",opt); + if(k==-1) + break; + chan[i]->guru=k; + break; + case 7: +SETHELP(WHERE); +/* +Channel Action Set: + +This is a list of available chat action sets. Select the one that you wish +to have available in this channel. +*/ + k=0; + for(j=0;jname); + opt[j][0]=0; + savnum=2; + k=ulist(WIN_SAV|WIN_RHT,0,0,25,&j,0 + ,"Available Chat Action Sets",opt); + if(k==-1) + break; + changes=1; + chan[i]->actset=k; + break; } } } +} + +void chatact_cfg(uint setnum) +{ + static int chatact_dflt,chatact_bar; + char str[128],cmd[128],out[128]; + int j,k; + uint i,n,chatnum[MAX_OPTS+1]; + static chatact_t savchatact; + +while(1) { + for(i=0,j=0;iactset==setnum) { + sprintf(opt[j],"%-*.*s %s",LEN_CHATACTCMD,LEN_CHATACTCMD + ,chatact[i]->cmd,chatact[i]->out); + chatnum[j++]=i; } + chatnum[j]=total_chatacts; + opt[j][0]=0; + savnum=2; + i=WIN_ACT|WIN_SAV; + if(j) + i|=WIN_DEL|WIN_GET; + if(jname); + i=ulist(i,0,0,70,&chatact_dflt,&chatact_bar,str,opt); + savnum=3; + if((signed)i==-1) + return; + if((i&MSK_ON)==MSK_INS) { + i&=MSK_OFF; + SETHELP(WHERE); +/* +Chat Action Command: + +This is the command word (normally a verb) to trigger the action output. +*/ + if(uinput(WIN_MID|WIN_SAV,0,0,"Action Command",cmd,LEN_CHATACTCMD + ,K_UPPER)<1) + continue; + SETHELP(WHERE); +/* +Chat Action Output String: + +This is the output string displayed with this action output. +*/ + if(uinput(WIN_MID|WIN_SAV,0,0,"",out,LEN_CHATACTOUT + ,K_MSG)<1) + continue; + if((chatact=(chatact_t **)REALLOC(chatact + ,sizeof(chatact_t *)*(total_chatacts+1)))==NULL) { + errormsg(WHERE,ERR_ALLOC,nulstr,total_chatacts+1); + total_chatacts=0; + bail(1); + continue; } + if(j) + for(n=total_chatacts;n>chatnum[i];n--) + chatact[n]=chatact[n-1]; + if((chatact[chatnum[i]]=(chatact_t *)MALLOC(sizeof(chatact_t)))==NULL) { + errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(chatact_t)); + continue; } + memset((chatact_t *)chatact[chatnum[i]],0,sizeof(chatact_t)); + strcpy(chatact[chatnum[i]]->cmd,cmd); + strcpy(chatact[chatnum[i]]->out,out); + chatact[chatnum[i]]->actset=setnum; + total_chatacts++; + changes=1; + continue; } + if((i&MSK_ON)==MSK_DEL) { + i&=MSK_OFF; + FREE(chatact[chatnum[i]]); + total_chatacts--; + for(j=chatnum[i];jactset=setnum; + changes=1; + continue; } + SETHELP(WHERE); +/* +Chat Action Command: + +This is the command that triggers this chat action. +*/ + strcpy(str,chatact[chatnum[i]]->cmd); + if(!uinput(WIN_MID|WIN_SAV,0,10,"Chat Action Command" + ,chatact[chatnum[i]]->cmd,LEN_CHATACTCMD,K_EDIT|K_UPPER)) { + strcpy(chatact[chatnum[i]]->cmd,str); + continue; } + SETHELP(WHERE); +/* +Chat Action Output String: + +This is the output string that results from this chat action. +*/ + strcpy(str,chatact[chatnum[i]]->out); + if(!uinput(WIN_MID|WIN_SAV,0,10,"" + ,chatact[chatnum[i]]->out,LEN_CHATACTOUT,K_EDIT|K_MSG)) + strcpy(chatact[chatnum[i]]->out,str); } +} + +void guru_cfg() +{ + static int guru_dflt,guru_bar,opt_dflt; + char str[81],code[9],done=0,*p; + int j,k; + uint i; + static guru_t savguru; + +while(1) { + for(i=0;iname); + opt[i][0]=0; + savnum=0; + j=WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT; + if(total_gurus) + j|=WIN_DEL|WIN_GET; + if(total_gurusi;j--) + guru[j]=guru[j-1]; + if((guru[i]=(guru_t *)MALLOC(sizeof(guru_t)))==NULL) { + errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(guru_t)); + continue; } + memset((guru_t *)guru[i],0,sizeof(guru_t)); + strcpy(guru[i]->name,str); + strcpy(guru[i]->code,code); + total_gurus++; + changes=1; + continue; } + if((i&MSK_ON)==MSK_DEL) { + i&=MSK_OFF; + FREE(guru[i]); + total_gurus--; + for(j=i;jname); + sprintf(opt[k++],"%-27.27s%s","Guru Internal Code",guru[i]->code); + sprintf(opt[k++],"%-27.27s%.40s","Access Requirements",guru[i]->ar); + opt[k][0]=0; + savnum=1; + SETHELP(WHERE); +/* +Guru Configuration: + +This menu is for configuring the selected Guru. +*/ + switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,60,&opt_dflt,0,guru[i]->name + ,opt)) { + case -1: + done=1; + break; + case 0: + SETHELP(WHERE); +/* +Guru Name: + +This is the name of the selected Guru. +*/ + strcpy(str,guru[i]->name); + if(!uinput(WIN_MID|WIN_SAV,0,10,"Guru Name" + ,guru[i]->name,25,K_EDIT)) + strcpy(guru[i]->name,str); + break; + case 1: +SETHELP(WHERE); +/* +Guru Internal Code: + +Every Guru must have its own unique code for Synchronet to refer to +it internally. This code is usually an abreviation of the Guru name. +*/ + strcpy(str,guru[i]->code); + if(!uinput(WIN_MID|WIN_SAV,0,0,"Guru Internal Code" + ,str,8,K_EDIT|K_UPPER)) + break; + if(code_ok(str)) + strcpy(guru[i]->code,str); + else { + helpbuf=invalid_code; + umsg("Invalid Code"); + helpbuf=0; } + break; + case 2: + savnum=2; + getar(guru[i]->name,guru[i]->ar); + break; } } } +} + +void actsets_cfg() +{ + static int actset_dflt,actset_bar,opt_dflt; + char str[81]; + int j,k,done; + uint i; + static actset_t savactset; + +while(1) { + for(i=0;iname); + opt[i][0]=0; + j=WIN_ACT|WIN_RHT|WIN_BOT|WIN_SAV; + savnum=0; + if(total_actsets) + j|=WIN_DEL|WIN_GET; + if(total_actsetsi;j--) + actset[j]=actset[j-1]; + if((actset[i]=(actset_t *)MALLOC(sizeof(actset_t)))==NULL) { + errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(actset_t)); + continue; } + memset((actset_t *)actset[i],0,sizeof(actset_t)); + strcpy(actset[i]->name,str); + total_actsets++; + changes=1; + continue; } + if((i&MSK_ON)==MSK_DEL) { + i&=MSK_OFF; + FREE(actset[i]); + total_actsets--; + for(j=i;jname); + sprintf(opt[k++],"%-27.27s","Configure Chat Actions..."); + opt[k][0]=0; + SETHELP(WHERE); +/* +Chat Action Set Configuration: + +This menu is for configuring the selected chat action set. +*/ + sprintf(str,"%s Chat Action Set",actset[i]->name); + savnum=1; + switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,60,&opt_dflt,0,str + ,opt)) { + case -1: + done=1; + break; + case 0: + SETHELP(WHERE); +/* +Chat Action Set Name: + +This is the name of the selected action set. +*/ + strcpy(str,actset[i]->name); + if(!uinput(WIN_MID|WIN_SAV,0,10,"Action Set Name" + ,actset[i]->name,25,K_EDIT)) + strcpy(actset[i]->name,str); + break; + case 1: + chatact_cfg(i); + break; } } } +} +