Annotation of sbbs/sbbs2/scfg/scfgchat.c, revision 1.1

1.1     ! root        1: #line 2 "SCFGCHAT.C"
        !             2: 
        !             3: /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
        !             4: 
        !             5: #include "scfg.h"
        !             6: 
        !             7: void page_cfg()
        !             8: {
        !             9:        static int dflt,bar;
        !            10:        char str[81],done=0;
        !            11:        int j,k;
        !            12:        uint i;
        !            13:        static page_t savpage;
        !            14: 
        !            15: while(1) {
        !            16:        for(i=0;i<total_pages && i<MAX_OPTS;i++)
        !            17:                sprintf(opt[i],"%-40.40s %.-20s",page[i]->cmd,page[i]->ar);
        !            18:        opt[i][0]=0;
        !            19:        savnum=0;
        !            20:        j=WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT;
        !            21:        if(total_pages)
        !            22:                j|=WIN_DEL|WIN_GET;
        !            23:        if(total_pages<MAX_OPTS)
        !            24:                j|=WIN_INS|WIN_INSACT|WIN_XTR;
        !            25:        if(savpage.cmd[0])
        !            26:                j|=WIN_PUT;
        !            27:        SETHELP(WHERE);
        !            28: /*
        !            29: &External Sysop Chat Pagers:&
        !            30: 
        !            31: This is a list of the configured external sysop chat pagers.
        !            32: 
        !            33: To add a pager, select the desired location and hit  INS .
        !            34: 
        !            35: To delete a pager, select it and hit  DEL .
        !            36: 
        !            37: To configure a pager, select it and hit  ENTER .
        !            38: */
        !            39:        i=ulist(j,0,0,45,&dflt,&bar,"External Sysop Chat Pagers",opt);
        !            40:        if((signed)i==-1)
        !            41:                return;
        !            42:        if((i&MSK_ON)==MSK_INS) {
        !            43:                i&=MSK_OFF;
        !            44:                sprintf(str,"%%!tone +chatpage.ton");
        !            45:                SETHELP(WHERE);
        !            46: /*
        !            47: &External Chat Pager Command Line:&
        !            48: 
        !            49: This is the command line to execute for this external chat pager.
        !            50: */
        !            51:                if(uinput(WIN_MID|WIN_SAV,0,0,"Command Line",str,50
        !            52:                        ,K_EDIT)<1)
        !            53:             continue;
        !            54:                if((page=(page_t **)REALLOC(page,sizeof(page_t *)*(total_pages+1)))
        !            55:             ==NULL) {
        !            56:             errormsg(WHERE,ERR_ALLOC,nulstr,total_pages+1);
        !            57:                        total_pages=0;
        !            58:                        bail(1);
        !            59:             continue; }
        !            60:                if(total_pages)
        !            61:                        for(j=total_pages;j>i;j--)
        !            62:                                page[j]=page[j-1];
        !            63:                if((page[i]=(page_t *)MALLOC(sizeof(page_t)))==NULL) {
        !            64:                        errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(page_t));
        !            65:                        continue; }
        !            66:                memset((page_t *)page[i],0,sizeof(page_t));
        !            67:                strcpy(page[i]->cmd,str);
        !            68:                total_pages++;
        !            69:                changes=1;
        !            70:                continue; }
        !            71:        if((i&MSK_ON)==MSK_DEL) {
        !            72:                i&=MSK_OFF;
        !            73:                FREE(page[i]);
        !            74:                total_pages--;
        !            75:                for(j=i;j<total_pages;j++)
        !            76:                        page[j]=page[j+1];
        !            77:                changes=1;
        !            78:                continue; }
        !            79:        if((i&MSK_ON)==MSK_GET) {
        !            80:                i&=MSK_OFF;
        !            81:                savpage=*page[i];
        !            82:                continue; }
        !            83:        if((i&MSK_ON)==MSK_PUT) {
        !            84:                i&=MSK_OFF;
        !            85:                *page[i]=savpage;
        !            86:                changes=1;
        !            87:         continue; }
        !            88:        j=0;
        !            89:        done=0;
        !            90:        while(!done) {
        !            91:                k=0;
        !            92:                sprintf(opt[k++],"%-27.27s%.40s","Command Line",page[i]->cmd);
        !            93:                sprintf(opt[k++],"%-27.27s%.40s","Access Requirements",page[i]->ar);
        !            94:                sprintf(opt[k++],"%-27.27s%s","Intercept I/O Interrupts"
        !            95:                        ,page[i]->misc&IO_INTS ? "Yes":"No");
        !            96:                opt[k][0]=0;
        !            97:                sprintf(str,"Sysop Chat Pager #%d",i+1);
        !            98:                savnum=1;
        !            99:                switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,60,&j,0,str,opt)) {
        !           100:                        case -1:
        !           101:                                done=1;
        !           102:                                break;
        !           103:                        case 0:
        !           104:                                SETHELP(WHERE);
        !           105: /*
        !           106: &External Chat Pager Command Line:&
        !           107: 
        !           108: This is the command line to execute for this external chat pager.
        !           109: */
        !           110:                                strcpy(str,page[i]->cmd);
        !           111:                                if(!uinput(WIN_MID|WIN_SAV,0,10,"Command Line"
        !           112:                                        ,page[i]->cmd,50,K_EDIT))
        !           113:                                        strcpy(page[i]->cmd,str);
        !           114:                                break;
        !           115:                        case 1:
        !           116:                                savnum=2;
        !           117:                                getar(str,page[i]->ar);
        !           118:                                break;
        !           119:                        case 2:
        !           120:                                k=1;
        !           121:                                strcpy(opt[0],"Yes");
        !           122:                                strcpy(opt[1],"No");
        !           123:                                opt[2][0]=0;
        !           124:                                savnum=2;
        !           125:                                SETHELP(WHERE);
        !           126: /*
        !           127: &Intercept I/O Interrupts:&
        !           128: 
        !           129: If you wish the DOS screen output and keyboard input to be intercepted
        !           130: when running this chat pager, set this option to &Yes&.
        !           131: */
        !           132:                                k=ulist(WIN_MID|WIN_SAV,0,0,0,&k,0,"Intercept I/O Interrupts"
        !           133:                                        ,opt);
        !           134:                                if(!k && !(page[i]->misc&IO_INTS)) {
        !           135:                                        page[i]->misc|=IO_INTS;
        !           136:                                        changes=1; }
        !           137:                                else if(k==1 && page[i]->misc&IO_INTS) {
        !           138:                                        page[i]->misc&=~IO_INTS;
        !           139:                                        changes=1; }
        !           140:                 break;
        !           141: 
        !           142:                                } } }
        !           143: }
        !           144: 
        !           145: void chan_cfg()
        !           146: {
        !           147:        static int chan_dflt,chan_bar,opt_dflt;
        !           148:        char str[81],code[9],done=0,*p;
        !           149:        int j,k;
        !           150:        uint i;
        !           151:        static chan_t savchan;
        !           152: 
        !           153: while(1) {
        !           154:        for(i=0;i<total_chans && i<MAX_OPTS;i++)
        !           155:                sprintf(opt[i],"%-25s",chan[i]->name);
        !           156:        opt[i][0]=0;
        !           157:        j=WIN_ACT|WIN_SAV|WIN_BOT|WIN_RHT;
        !           158:        savnum=0;
        !           159:        if(total_chans)
        !           160:                j|=WIN_DEL|WIN_GET;
        !           161:        if(total_chans<MAX_OPTS)
        !           162:                j|=WIN_INS|WIN_INSACT|WIN_XTR;
        !           163:        if(savchan.name[0])
        !           164:                j|=WIN_PUT;
        !           165:        SETHELP(WHERE);
        !           166: /*
        !           167: &Multinode Chat Channels:&
        !           168: 
        !           169: This is a list of the configured multinode chat channels.
        !           170: 
        !           171: To add a channel, select the desired location with the arrow keys and
        !           172: hit  INS .
        !           173: 
        !           174: To delete a channel, select it with the arrow keys and hit  DEL .
        !           175: 
        !           176: To configure a channel, select it with the arrow keys and hit  ENTER .
        !           177: */
        !           178:        i=ulist(j,0,0,45,&chan_dflt,&chan_bar,"Multinode Chat Channels",opt);
        !           179:        if((signed)i==-1)
        !           180:                return;
        !           181:        if((i&MSK_ON)==MSK_INS) {
        !           182:                i&=MSK_OFF;
        !           183:                strcpy(str,"Open");
        !           184:                SETHELP(WHERE);
        !           185: /*
        !           186: &Channel Name:&
        !           187: 
        !           188: This is the name or description of the chat channel.
        !           189: */
        !           190:                if(uinput(WIN_MID|WIN_SAV,0,0,"Chat Channel Name",str,25
        !           191:                        ,K_EDIT)<1)
        !           192:             continue;
        !           193:                sprintf(code,"%.8s",str);
        !           194:                p=strchr(code,SP);
        !           195:                if(p) *p=0;
        !           196:         strupr(code);
        !           197:                SETHELP(WHERE);
        !           198: /*
        !           199: &Chat Channel Internal Code:&
        !           200: 
        !           201: Every chat channel must have its own unique code for Synchronet to refer
        !           202: to it internally. This code is usually an abreviation of the chat
        !           203: channel name.
        !           204: */
        !           205:                if(uinput(WIN_MID|WIN_SAV,0,0,"Internal Code"
        !           206:                        ,code,8,K_EDIT|K_UPPER)<1)
        !           207:                        continue;
        !           208:                if(!code_ok(code)) {
        !           209:                        helpbuf=invalid_code;
        !           210:                        umsg("Invalid Code");
        !           211:                        helpbuf=0;
        !           212:             continue; }
        !           213:                if((chan=(chan_t **)REALLOC(chan,sizeof(chan_t *)*(total_chans+1)))
        !           214:             ==NULL) {
        !           215:             errormsg(WHERE,ERR_ALLOC,nulstr,total_chans+1);
        !           216:                        total_chans=0;
        !           217:                        bail(1);
        !           218:             continue; }
        !           219:                if(total_chans)
        !           220:                        for(j=total_chans;j>i;j--)
        !           221:                                chan[j]=chan[j-1];
        !           222:                if((chan[i]=(chan_t *)MALLOC(sizeof(chan_t)))==NULL) {
        !           223:                        errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(chan_t));
        !           224:                        continue; }
        !           225:                memset((chan_t *)chan[i],0,sizeof(chan_t));
        !           226:                strcpy(chan[i]->name,str);
        !           227:                strcpy(chan[i]->code,code);
        !           228:                total_chans++;
        !           229:                changes=1;
        !           230:                continue; }
        !           231:        if((i&MSK_ON)==MSK_DEL) {
        !           232:                i&=MSK_OFF;
        !           233:                FREE(chan[i]);
        !           234:                total_chans--;
        !           235:                for(j=i;j<total_chans;j++)
        !           236:                        chan[j]=chan[j+1];
        !           237:                changes=1;
        !           238:                continue; }
        !           239:        if((i&MSK_ON)==MSK_GET) {
        !           240:                i&=MSK_OFF;
        !           241:                savchan=*chan[i];
        !           242:                continue; }
        !           243:        if((i&MSK_ON)==MSK_PUT) {
        !           244:                i&=MSK_OFF;
        !           245:                *chan[i]=savchan;
        !           246:                changes=1;
        !           247:         continue; }
        !           248:     j=0;
        !           249:        done=0;
        !           250:        while(!done) {
        !           251:                k=0;
        !           252:                sprintf(opt[k++],"%-27.27s%s","Name",chan[i]->name);
        !           253:                sprintf(opt[k++],"%-27.27s%s","Internal Code",chan[i]->code);
        !           254:                sprintf(opt[k++],"%-27.27s%lu","Cost in Credits",chan[i]->cost);
        !           255:                sprintf(opt[k++],"%-27.27s%.40s","Access Requirements"
        !           256:                        ,chan[i]->ar);
        !           257:                sprintf(opt[k++],"%-27.27s%s","Password Protection"
        !           258:                        ,chan[i]->misc&CHAN_PW ? "Yes" : "No");
        !           259:                sprintf(opt[k++],"%-27.27s%s","Guru Joins When Empty"
        !           260:                        ,chan[i]->misc&CHAN_GURU ? "Yes" : "No");
        !           261:                sprintf(opt[k++],"%-27.27s%s","Channel Guru"
        !           262:                        ,chan[i]->guru<total_gurus ? guru[chan[i]->guru]->name : "");
        !           263:         sprintf(opt[k++],"%-27.27s%s","Channel Action Set"
        !           264:             ,actset[chan[i]->actset]->name);
        !           265:                opt[k][0]=0;
        !           266:                SETHELP(WHERE);
        !           267: /*
        !           268: &Chat Channel Configuration:&
        !           269: 
        !           270: This menu is for configuring the selected chat channel.
        !           271: */
        !           272:                savnum=1;
        !           273:                sprintf(str,"%s Chat Channel",chan[i]->name);
        !           274:                switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,60,&opt_dflt,0,str,opt)) {
        !           275:                        case -1:
        !           276:                                done=1;
        !           277:                                break;
        !           278:                        case 0:
        !           279:                                SETHELP(WHERE);
        !           280: /*
        !           281: &Chat Channel Name:&
        !           282: 
        !           283: This is the name or description of the chat channel.
        !           284: */
        !           285:                                strcpy(str,chan[i]->name);
        !           286:                                if(!uinput(WIN_MID|WIN_SAV,0,10,"Chat Channel Name"
        !           287:                                        ,chan[i]->name,25,K_EDIT))
        !           288:                                        strcpy(chan[i]->name,str);
        !           289:                                break;
        !           290:                        case 1:
        !           291:                                SETHELP(WHERE);
        !           292: /*
        !           293: &Chat Channel Internal Code:&
        !           294: 
        !           295: Every chat channel must have its own unique code for Synchronet to refer
        !           296: to it internally. This code is usually an abreviation of the chat
        !           297: channel name.
        !           298: */
        !           299:                                strcpy(str,chan[i]->code);
        !           300:                                if(!uinput(WIN_MID|WIN_SAV,0,10,"Internal Code"
        !           301:                                        ,str,8,K_UPPER|K_EDIT))
        !           302:                                        break;
        !           303:                                if(code_ok(str))
        !           304:                                        strcpy(chan[i]->code,str);
        !           305:                                else {
        !           306:                                        helpbuf=invalid_code;
        !           307:                                        umsg("Invalid Code");
        !           308:                     helpbuf=0; }
        !           309:                 break;
        !           310:                        case 2:
        !           311:                                ultoa(chan[i]->cost,str,10);
        !           312:                 SETHELP(WHERE);
        !           313: /*
        !           314: &Chat Channel Cost to Join:&
        !           315: 
        !           316: If you want users to be charged credits to join this chat channel, set
        !           317: this value to the number of credits to charge. If you want this channel
        !           318: to be free, set this value to &0&.
        !           319: */
        !           320:                                uinput(WIN_MID|WIN_SAV,0,0,"Cost to Join (in Credits)"
        !           321:                     ,str,10,K_EDIT|K_NUMBER);
        !           322:                                chan[i]->cost=atol(str);
        !           323:                 break;
        !           324:                        case 3:
        !           325:                                savnum=2;
        !           326:                                sprintf(str,"%s Chat Channel",chan[i]->name);
        !           327:                                getar(str,chan[i]->ar);
        !           328:                                break;
        !           329:                        case 4:
        !           330:                                k=1;
        !           331:                                strcpy(opt[0],"Yes");
        !           332:                                strcpy(opt[1],"No");
        !           333:                                opt[2][0]=0;
        !           334:                                savnum=2;
        !           335:                                SETHELP(WHERE);
        !           336: /*
        !           337: &Allow Channel to be Password Protected:&
        !           338: 
        !           339: If you want to allow the first user to join this channel to password
        !           340: protect it, set this option to &Yes&.
        !           341: */
        !           342:                                k=ulist(WIN_MID|WIN_SAV,0,0,0,&k,0
        !           343:                                        ,"Allow Channel to be Password Protected"
        !           344:                                        ,opt);
        !           345:                                if(!k && !(chan[i]->misc&CHAN_PW)) {
        !           346:                                        chan[i]->misc|=CHAN_PW;
        !           347:                                        changes=1; }
        !           348:                                else if(k==1 && chan[i]->misc&CHAN_PW) {
        !           349:                                        chan[i]->misc&=~CHAN_PW;
        !           350:                                        changes=1; }
        !           351:                                break;
        !           352:                        case 5:
        !           353:                                k=1;
        !           354:                                strcpy(opt[0],"Yes");
        !           355:                                strcpy(opt[1],"No");
        !           356:                                opt[2][0]=0;
        !           357:                                savnum=2;
        !           358:                                SETHELP(WHERE);
        !           359: /*
        !           360: &Guru Joins This Channel When Empty:&
        !           361: 
        !           362: If you want the system guru to join this chat channel when there is
        !           363: only one user, set this option to &Yes&.
        !           364: */
        !           365:                                k=ulist(WIN_MID|WIN_SAV,0,0,0,&k,0
        !           366:                                        ,"Guru Joins This Channel When Empty"
        !           367:                                        ,opt);
        !           368:                                if(!k && !(chan[i]->misc&CHAN_GURU)) {
        !           369:                                        chan[i]->misc|=CHAN_GURU;
        !           370:                                        changes=1; }
        !           371:                                else if(k==1 && chan[i]->misc&CHAN_GURU) {
        !           372:                                        chan[i]->misc&=~CHAN_GURU;
        !           373:                                        changes=1; }
        !           374:                                break;
        !           375:                        case 6:
        !           376: SETHELP(WHERE);
        !           377: /*
        !           378: &Channel Guru:&
        !           379: 
        !           380: This is a list of available chat Gurus.  Select the one that you wish
        !           381: to have available in this channel.
        !           382: */
        !           383:                                k=0;
        !           384:                                for(j=0;j<total_gurus && j<MAX_OPTS;j++)
        !           385:                                        sprintf(opt[j],"%-25s",guru[j]->name);
        !           386:                                opt[j][0]=0;
        !           387:                                savnum=2;
        !           388:                                k=ulist(WIN_SAV|WIN_RHT,0,0,25,&j,0
        !           389:                                        ,"Available Chat Gurus",opt);
        !           390:                                if(k==-1)
        !           391:                                        break;
        !           392:                                chan[i]->guru=k;
        !           393:                                break;
        !           394:                        case 7:
        !           395: SETHELP(WHERE);
        !           396: /*
        !           397: &Channel Action Set:&
        !           398: 
        !           399: This is a list of available chat action sets.  Select the one that you wish
        !           400: to have available in this channel.
        !           401: */
        !           402:                                k=0;
        !           403:                                for(j=0;j<total_actsets && j<MAX_OPTS;j++)
        !           404:                                        sprintf(opt[j],"%-25s",actset[j]->name);
        !           405:                                opt[j][0]=0;
        !           406:                                savnum=2;
        !           407:                                k=ulist(WIN_SAV|WIN_RHT,0,0,25,&j,0
        !           408:                                        ,"Available Chat Action Sets",opt);
        !           409:                                if(k==-1)
        !           410:                                        break;
        !           411:                                changes=1;
        !           412:                                chan[i]->actset=k;
        !           413:                                break; } } }
        !           414: }
        !           415: 
        !           416: void chatact_cfg(uint setnum)
        !           417: {
        !           418:        static int chatact_dflt,chatact_bar;
        !           419:        char str[128],cmd[128],out[128];
        !           420:        int j,k;
        !           421:        uint i,n,chatnum[MAX_OPTS+1];
        !           422:        static chatact_t savchatact;
        !           423: 
        !           424: while(1) {
        !           425:        for(i=0,j=0;i<total_chatacts && j<MAX_OPTS;i++)
        !           426:                if(chatact[i]->actset==setnum) {
        !           427:                        sprintf(opt[j],"%-*.*s %s",LEN_CHATACTCMD,LEN_CHATACTCMD
        !           428:                                ,chatact[i]->cmd,chatact[i]->out);
        !           429:                        chatnum[j++]=i; }
        !           430:        chatnum[j]=total_chatacts;
        !           431:        opt[j][0]=0;
        !           432:        savnum=2;
        !           433:        i=WIN_ACT|WIN_SAV;
        !           434:        if(j)
        !           435:                i|=WIN_DEL|WIN_GET;
        !           436:        if(j<MAX_OPTS)
        !           437:                i|=WIN_INS|WIN_INSACT|WIN_XTR;
        !           438:        if(savchatact.cmd[0])
        !           439:                i|=WIN_PUT;
        !           440:        SETHELP(WHERE);
        !           441: /*
        !           442: &Multinode Chat Actions:&
        !           443: 
        !           444: This is a list of the configured multinode chat actions.  The users can
        !           445: use these actions in multinode chat by turning on action commands with
        !           446: the &/A& command in multinode chat.  Then if a line is typed which
        !           447: begins with a valid &action command& and has a user name, chat handle,
        !           448: or node number following, the output string will be displayed replacing
        !           449: the &%s& symbols with the sending user's name and the receiving user's
        !           450: name (in that order).
        !           451: 
        !           452: To add an action, select the desired location with the arrow keys and
        !           453: hit  INS .
        !           454: 
        !           455: To delete an action, select it with the arrow keys and hit  DEL .
        !           456: 
        !           457: To configure an action, select it with the arrow keys and hit  ENTER .
        !           458: */
        !           459:        sprintf(str,"%s Chat Actions",actset[setnum]->name);
        !           460:        i=ulist(i,0,0,70,&chatact_dflt,&chatact_bar,str,opt);
        !           461:        savnum=3;
        !           462:        if((signed)i==-1)
        !           463:                return;
        !           464:        if((i&MSK_ON)==MSK_INS) {
        !           465:                i&=MSK_OFF;
        !           466:                SETHELP(WHERE);
        !           467: /*
        !           468: &Chat Action Command:&
        !           469: 
        !           470: This is the command word (normally a verb) to trigger the action output.
        !           471: */
        !           472:                if(uinput(WIN_MID|WIN_SAV,0,0,"Action Command",cmd,LEN_CHATACTCMD
        !           473:                        ,K_UPPER)<1)
        !           474:             continue;
        !           475:                SETHELP(WHERE);
        !           476: /*
        !           477: &Chat Action Output String:&
        !           478: 
        !           479: This is the output string displayed with this action output.
        !           480: */
        !           481:                if(uinput(WIN_MID|WIN_SAV,0,0,"",out,LEN_CHATACTOUT
        !           482:                        ,K_MSG)<1)
        !           483:             continue;
        !           484:                if((chatact=(chatact_t **)REALLOC(chatact
        !           485:             ,sizeof(chatact_t *)*(total_chatacts+1)))==NULL) {
        !           486:             errormsg(WHERE,ERR_ALLOC,nulstr,total_chatacts+1);
        !           487:                        total_chatacts=0;
        !           488:                        bail(1);
        !           489:             continue; }
        !           490:                if(j)
        !           491:                        for(n=total_chatacts;n>chatnum[i];n--)
        !           492:                                chatact[n]=chatact[n-1];
        !           493:                if((chatact[chatnum[i]]=(chatact_t *)MALLOC(sizeof(chatact_t)))==NULL) {
        !           494:                        errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(chatact_t));
        !           495:                        continue; }
        !           496:                memset((chatact_t *)chatact[chatnum[i]],0,sizeof(chatact_t));
        !           497:                strcpy(chatact[chatnum[i]]->cmd,cmd);
        !           498:                strcpy(chatact[chatnum[i]]->out,out);
        !           499:                chatact[chatnum[i]]->actset=setnum;
        !           500:                total_chatacts++;
        !           501:                changes=1;
        !           502:                continue; }
        !           503:        if((i&MSK_ON)==MSK_DEL) {
        !           504:                i&=MSK_OFF;
        !           505:                FREE(chatact[chatnum[i]]);
        !           506:                total_chatacts--;
        !           507:                for(j=chatnum[i];j<total_chatacts && j<MAX_OPTS;j++)
        !           508:                        chatact[j]=chatact[j+1];
        !           509:                changes=1;
        !           510:                continue; }
        !           511:        if((i&MSK_ON)==MSK_GET) {
        !           512:                i&=MSK_OFF;
        !           513:                savchatact=*chatact[chatnum[i]];
        !           514:                continue; }
        !           515:        if((i&MSK_ON)==MSK_PUT) {
        !           516:                i&=MSK_OFF;
        !           517:                *chatact[chatnum[i]]=savchatact;
        !           518:                chatact[chatnum[i]]->actset=setnum;
        !           519:                changes=1;
        !           520:         continue; }
        !           521:        SETHELP(WHERE);
        !           522: /*
        !           523: &Chat Action Command:&
        !           524: 
        !           525: This is the command that triggers this chat action.
        !           526: */
        !           527:        strcpy(str,chatact[chatnum[i]]->cmd);
        !           528:        if(!uinput(WIN_MID|WIN_SAV,0,10,"Chat Action Command"
        !           529:                ,chatact[chatnum[i]]->cmd,LEN_CHATACTCMD,K_EDIT|K_UPPER)) {
        !           530:                strcpy(chatact[chatnum[i]]->cmd,str);
        !           531:                continue; }
        !           532:        SETHELP(WHERE);
        !           533: /*
        !           534: &Chat Action Output String:&
        !           535: 
        !           536: This is the output string that results from this chat action.
        !           537: */
        !           538:        strcpy(str,chatact[chatnum[i]]->out);
        !           539:        if(!uinput(WIN_MID|WIN_SAV,0,10,""
        !           540:                ,chatact[chatnum[i]]->out,LEN_CHATACTOUT,K_EDIT|K_MSG))
        !           541:                strcpy(chatact[chatnum[i]]->out,str); }
        !           542: }
        !           543: 
        !           544: void guru_cfg()
        !           545: {
        !           546:        static int guru_dflt,guru_bar,opt_dflt;
        !           547:        char str[81],code[9],done=0,*p;
        !           548:        int j,k;
        !           549:        uint i;
        !           550:        static guru_t savguru;
        !           551: 
        !           552: while(1) {
        !           553:        for(i=0;i<total_gurus && i<MAX_OPTS;i++)
        !           554:                sprintf(opt[i],"%-25s",guru[i]->name);
        !           555:        opt[i][0]=0;
        !           556:        savnum=0;
        !           557:        j=WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT;
        !           558:        if(total_gurus)
        !           559:                j|=WIN_DEL|WIN_GET;
        !           560:        if(total_gurus<MAX_OPTS)
        !           561:                j|=WIN_INS|WIN_INSACT|WIN_XTR;
        !           562:        if(savguru.name[0])
        !           563:                j|=WIN_PUT;
        !           564:        SETHELP(WHERE);
        !           565: /*
        !           566: &Gurus:&
        !           567: 
        !           568: This is a list of the configured Gurus.
        !           569: 
        !           570: To add a Guru, select the desired location with the arrow keys and
        !           571: hit  INS .
        !           572: 
        !           573: To delete a Guru, select it with the arrow keys and hit  DEL .
        !           574: 
        !           575: To configure a Guru, select it with the arrow keys and hit  ENTER .
        !           576: */
        !           577:        i=ulist(j,0,0,45,&guru_dflt,&guru_bar,"Artificial Gurus",opt);
        !           578:        if((signed)i==-1)
        !           579:                return;
        !           580:        if((i&MSK_ON)==MSK_INS) {
        !           581:                i&=MSK_OFF;
        !           582:                SETHELP(WHERE);
        !           583: /*
        !           584: &Guru Name:&
        !           585: 
        !           586: This is the name of the selected Guru.
        !           587: */
        !           588:                if(uinput(WIN_MID|WIN_SAV,0,0,"Guru Name",str,25
        !           589:                        ,0)<1)
        !           590:             continue;
        !           591:                sprintf(code,"%.8s",str);
        !           592:                p=strchr(code,SP);
        !           593:                if(p) *p=0;
        !           594:         strupr(code);
        !           595:                SETHELP(WHERE);
        !           596: /*
        !           597: &Guru Internal Code:&
        !           598: 
        !           599: Every Guru must have its own unique code for Synchronet to refer to
        !           600: it internally. This code is usually an abreviation of the Guru name.
        !           601: */
        !           602:                if(uinput(WIN_MID|WIN_SAV,0,0,"Internal Code"
        !           603:                        ,code,8,K_EDIT|K_UPPER)<1)
        !           604:                        continue;
        !           605:                if(!code_ok(code)) {
        !           606:                        helpbuf=invalid_code;
        !           607:                        umsg("Invalid Code");
        !           608:                        helpbuf=0;
        !           609:             continue; }
        !           610:                if((guru=(guru_t **)REALLOC(guru,sizeof(guru_t *)*(total_gurus+1)))
        !           611:             ==NULL) {
        !           612:                        errormsg(WHERE,ERR_ALLOC,nulstr,total_gurus+1);
        !           613:                        total_gurus=0;
        !           614:                        bail(1);
        !           615:             continue; }
        !           616:                if(total_gurus)
        !           617:                        for(j=total_gurus;j>i;j--)
        !           618:                                guru[j]=guru[j-1];
        !           619:                if((guru[i]=(guru_t *)MALLOC(sizeof(guru_t)))==NULL) {
        !           620:                        errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(guru_t));
        !           621:                        continue; }
        !           622:                memset((guru_t *)guru[i],0,sizeof(guru_t));
        !           623:                strcpy(guru[i]->name,str);
        !           624:                strcpy(guru[i]->code,code);
        !           625:                total_gurus++;
        !           626:                changes=1;
        !           627:                continue; }
        !           628:        if((i&MSK_ON)==MSK_DEL) {
        !           629:                i&=MSK_OFF;
        !           630:                FREE(guru[i]);
        !           631:                total_gurus--;
        !           632:                for(j=i;j<total_gurus;j++)
        !           633:                        guru[j]=guru[j+1];
        !           634:                changes=1;
        !           635:                continue; }
        !           636:        if((i&MSK_ON)==MSK_GET) {
        !           637:                i&=MSK_OFF;
        !           638:                savguru=*guru[i];
        !           639:                continue; }
        !           640:        if((i&MSK_ON)==MSK_PUT) {
        !           641:                i&=MSK_OFF;
        !           642:                *guru[i]=savguru;
        !           643:                changes=1;
        !           644:         continue; }
        !           645:     j=0;
        !           646:        done=0;
        !           647:        while(!done) {
        !           648:                k=0;
        !           649:                sprintf(opt[k++],"%-27.27s%s","Guru Name",guru[i]->name);
        !           650:                sprintf(opt[k++],"%-27.27s%s","Guru Internal Code",guru[i]->code);
        !           651:                sprintf(opt[k++],"%-27.27s%.40s","Access Requirements",guru[i]->ar);
        !           652:                opt[k][0]=0;
        !           653:                savnum=1;
        !           654:                SETHELP(WHERE);
        !           655: /*
        !           656: &Guru Configuration:&
        !           657: 
        !           658: This menu is for configuring the selected Guru.
        !           659: */
        !           660:                switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,60,&opt_dflt,0,guru[i]->name
        !           661:                        ,opt)) {
        !           662:                        case -1:
        !           663:                                done=1;
        !           664:                                break;
        !           665:                        case 0:
        !           666:                                SETHELP(WHERE);
        !           667: /*
        !           668: &Guru Name:&
        !           669: 
        !           670: This is the name of the selected Guru.
        !           671: */
        !           672:                                strcpy(str,guru[i]->name);
        !           673:                                if(!uinput(WIN_MID|WIN_SAV,0,10,"Guru Name"
        !           674:                                        ,guru[i]->name,25,K_EDIT))
        !           675:                                        strcpy(guru[i]->name,str);
        !           676:                                break;
        !           677:                        case 1:
        !           678: SETHELP(WHERE);
        !           679: /*
        !           680: &Guru Internal Code:&
        !           681: 
        !           682: Every Guru must have its own unique code for Synchronet to refer to
        !           683: it internally. This code is usually an abreviation of the Guru name.
        !           684: */
        !           685:                                strcpy(str,guru[i]->code);
        !           686:                                if(!uinput(WIN_MID|WIN_SAV,0,0,"Guru Internal Code"
        !           687:                                        ,str,8,K_EDIT|K_UPPER))
        !           688:                                        break;
        !           689:                                if(code_ok(str))
        !           690:                                        strcpy(guru[i]->code,str);
        !           691:                                else {
        !           692:                                        helpbuf=invalid_code;
        !           693:                                        umsg("Invalid Code");
        !           694:                     helpbuf=0; }
        !           695:                                break;
        !           696:                        case 2:
        !           697:                                savnum=2;
        !           698:                                getar(guru[i]->name,guru[i]->ar);
        !           699:                                break; } } }
        !           700: }
        !           701: 
        !           702: void actsets_cfg()
        !           703: {
        !           704:     static int actset_dflt,actset_bar,opt_dflt;
        !           705:     char str[81];
        !           706:     int j,k,done;
        !           707:     uint i;
        !           708:     static actset_t savactset;
        !           709: 
        !           710: while(1) {
        !           711:        for(i=0;i<total_actsets && i<MAX_OPTS;i++)
        !           712:                sprintf(opt[i],"%-25s",actset[i]->name);
        !           713:        opt[i][0]=0;
        !           714:        j=WIN_ACT|WIN_RHT|WIN_BOT|WIN_SAV;
        !           715:        savnum=0;
        !           716:     if(total_actsets)
        !           717:         j|=WIN_DEL|WIN_GET;
        !           718:        if(total_actsets<MAX_OPTS)
        !           719:         j|=WIN_INS|WIN_INSACT|WIN_XTR;
        !           720:     if(savactset.name[0])
        !           721:         j|=WIN_PUT;
        !           722:     SETHELP(WHERE);
        !           723: /*
        !           724: &Chat Action Sets:&
        !           725: 
        !           726: This is a list of the configured action sets.
        !           727: 
        !           728: To add an action set, select the desired location with the arrow keys and
        !           729: hit  INS .
        !           730: 
        !           731: To delete an action set, select it with the arrow keys and hit  DEL .
        !           732: 
        !           733: To configure an action set, select it with the arrow keys and hit  ENTER .
        !           734: */
        !           735:        i=ulist(j,0,0,45,&actset_dflt,&actset_bar,"Chat Action Sets",opt);
        !           736:        if((signed)i==-1)
        !           737:                return;
        !           738:        if((i&MSK_ON)==MSK_INS) {
        !           739:                i&=MSK_OFF;
        !           740:         SETHELP(WHERE);
        !           741: /*
        !           742: &Chat Action Set Name:&
        !           743: 
        !           744: This is the name of the selected chat action set.
        !           745: */
        !           746:                if(uinput(WIN_MID|WIN_SAV,0,0,"Chat Action Set Name",str,25
        !           747:                        ,0)<1)
        !           748:             continue;
        !           749:         if((actset=(actset_t **)REALLOC(actset,sizeof(actset_t *)*(total_actsets+1)))
        !           750:             ==NULL) {
        !           751:             errormsg(WHERE,ERR_ALLOC,nulstr,total_actsets+1);
        !           752:                        total_actsets=0;
        !           753:                        bail(1);
        !           754:             continue; }
        !           755:         if(total_actsets)
        !           756:             for(j=total_actsets;j>i;j--)
        !           757:                 actset[j]=actset[j-1];
        !           758:         if((actset[i]=(actset_t *)MALLOC(sizeof(actset_t)))==NULL) {
        !           759:             errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(actset_t));
        !           760:             continue; }
        !           761:                memset((actset_t *)actset[i],0,sizeof(actset_t));
        !           762:         strcpy(actset[i]->name,str);
        !           763:         total_actsets++;
        !           764:         changes=1;
        !           765:         continue; }
        !           766:        if((i&MSK_ON)==MSK_DEL) {
        !           767:                i&=MSK_OFF;
        !           768:         FREE(actset[i]);
        !           769:         total_actsets--;
        !           770:         for(j=i;j<total_actsets;j++)
        !           771:             actset[j]=actset[j+1];
        !           772:         changes=1;
        !           773:         continue; }
        !           774:        if((i&MSK_ON)==MSK_GET) {
        !           775:                i&=MSK_OFF;
        !           776:         savactset=*actset[i];
        !           777:         continue; }
        !           778:        if((i&MSK_ON)==MSK_PUT) {
        !           779:                i&=MSK_OFF;
        !           780:         *actset[i]=savactset;
        !           781:         changes=1;
        !           782:         continue; }
        !           783:     j=0;
        !           784:     done=0;
        !           785:     while(!done) {
        !           786:         k=0;
        !           787:         sprintf(opt[k++],"%-27.27s%s","Action Set Name",actset[i]->name);
        !           788:         sprintf(opt[k++],"%-27.27s","Configure Chat Actions...");
        !           789:                opt[k][0]=0;
        !           790:         SETHELP(WHERE);
        !           791: /*
        !           792: &Chat Action Set Configuration:&
        !           793: 
        !           794: This menu is for configuring the selected chat action set.
        !           795: */
        !           796:                sprintf(str,"%s Chat Action Set",actset[i]->name);
        !           797:                savnum=1;
        !           798:                switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,60,&opt_dflt,0,str
        !           799:             ,opt)) {
        !           800:             case -1:
        !           801:                 done=1;
        !           802:                 break;
        !           803:             case 0:
        !           804:                 SETHELP(WHERE);
        !           805: /*
        !           806: &Chat Action Set Name:&
        !           807: 
        !           808: This is the name of the selected action set.
        !           809: */
        !           810:                 strcpy(str,actset[i]->name);
        !           811:                                if(!uinput(WIN_MID|WIN_SAV,0,10,"Action Set Name"
        !           812:                     ,actset[i]->name,25,K_EDIT))
        !           813:                     strcpy(actset[i]->name,str);
        !           814:                 break;
        !           815:             case 1:
        !           816:                 chatact_cfg(i);
        !           817:                 break; } } }
        !           818: }
        !           819: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.