Annotation of sbbs/sbbs3/atcodes.cpp, revision 1.1.1.2

1.1       root        1: /* atcodes.cpp */
                      2: 
                      3: /* Synchronet "@code" functions */
                      4: 
1.1.1.2 ! root        5: /* $Id: atcodes.cpp,v 1.42 2004/09/08 03:34:56 rswindell Exp $ */
1.1       root        6: 
                      7: /****************************************************************************
                      8:  * @format.tab-size 4          (Plain Text/Source Code File Header)                    *
                      9:  * @format.use-tabs true       (see http://www.synchro.net/ptsc_hdr.html)              *
                     10:  *                                                                                                                                                     *
1.1.1.2 ! root       11:  * Copyright 2003 Rob Swindell - http://www.synchro.net/copyright.html         *
1.1       root       12:  *                                                                                                                                                     *
                     13:  * This program is free software; you can redistribute it and/or                       *
                     14:  * modify it under the terms of the GNU General Public License                         *
                     15:  * as published by the Free Software Foundation; either version 2                      *
                     16:  * of the License, or (at your option) any later version.                                      *
                     17:  * See the GNU General Public License for more details: gpl.txt or                     *
                     18:  * http://www.fsf.org/copyleft/gpl.html                                                                                *
                     19:  *                                                                                                                                                     *
                     20:  * Anonymous FTP access to the most recent released source is available at     *
                     21:  * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net     *
                     22:  *                                                                                                                                                     *
                     23:  * Anonymous CVS access to the development source and modification history     *
                     24:  * is available at cvs.synchro.net:/cvsroot/sbbs, example:                                     *
                     25:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs login                       *
                     26:  *     (just hit return, no password is necessary)                                                     *
                     27:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src                *
                     28:  *                                                                                                                                                     *
                     29:  * For Synchronet coding style and modification guidelines, see                                *
                     30:  * http://www.synchro.net/source.html                                                                          *
                     31:  *                                                                                                                                                     *
                     32:  * You are encouraged to submit any modifications (preferably in Unix diff     *
                     33:  * format) via e-mail to [email protected]                                                                      *
                     34:  *                                                                                                                                                     *
                     35:  * Note: If this box doesn't appear square, then you need to fix your tabs.    *
                     36:  ****************************************************************************/
                     37: 
                     38: #include "sbbs.h"
                     39: #include "cmdshell.h"
                     40: 
1.1.1.2 ! root       41: #if defined(_WINSOCKAPI_)
        !            42:        extern WSADATA WSAData;
        !            43:        #define SOCKLIB_DESC WSAData.szDescription
        !            44: #else
        !            45:        #define SOCKLIB_DESC NULL
        !            46: #endif
        !            47: 
1.1       root       48: /****************************************************************************/
                     49: /* Returns 0 if invalid @ code. Returns length of @ code if valid.          */
                     50: /****************************************************************************/
1.1.1.2 ! root       51: int sbbs_t::show_atcode(char *instr)
1.1       root       52: {
1.1.1.2 ! root       53:        char    str[128],str2[128],*p,*tp,*sp;
        !            54:     int     len;
        !            55:        bool    padded_left=false;
        !            56:        bool    padded_right=false;
1.1       root       57: 
1.1.1.2 ! root       58:        sprintf(str,"%.80s",instr);
1.1       root       59:        tp=strchr(str+1,'@');
                     60:        if(!tp)                 /* no terminating @ */
                     61:                return(0);
1.1.1.2 ! root       62:        sp=strchr(str+1,' ');
1.1       root       63:        if(sp && sp<tp)         /* space before terminating @ */
                     64:                return(0);
                     65:        len=(tp-str)+1;
                     66:        (*tp)=0;
                     67:        sp=(str+1);
                     68: 
1.1.1.2 ! root       69:        if((p=strstr(sp,"-L"))!=NULL)
        !            70:                padded_left=true;
        !            71:        else if((p=strstr(sp,"-R"))!=NULL)
        !            72:                padded_right=true;
        !            73:        if(p!=NULL)
        !            74:                *p=0;
        !            75: 
        !            76:        p=atcode(sp,str2);
        !            77:        if(p==NULL)
        !            78:                return(0);
        !            79: 
        !            80:        if(padded_left)
        !            81:                rprintf("%-*.*s",len,len,p);
        !            82:        else if(padded_right)
        !            83:                rprintf("%*.*s",len,len,p);
        !            84:        else
        !            85:                rputs(p);
        !            86: 
        !            87:        return(len);
        !            88: }
        !            89: 
        !            90: char* sbbs_t::atcode(char* sp, char* str)
        !            91: {
        !            92:        char*   tp;
        !            93:        uint    i;
        !            94:        uint    ugrp;
        !            95:        uint    usub;
        !            96:        long    l;
        !            97:     stats_t stats;
        !            98:     node_t  node;
        !            99:        struct  tm tm;
        !           100: 
        !           101:        str[0]=0;
        !           102: 
1.1       root      103:        if(!strcmp(sp,"VER"))
1.1.1.2 ! root      104:                return(VERSION);
        !           105: 
        !           106:        if(!strcmp(sp,"REV")) {
        !           107:                sprintf(str,"%c",REVISION);
        !           108:                return(str);
        !           109:        }
        !           110: 
        !           111:        if(!strcmp(sp,"FULL_VER")) {
        !           112:                sprintf(str,"%s%c%s",VERSION,REVISION,beta_version);
        !           113:                truncsp(str);
        !           114: #if defined(_DEBUG)
        !           115:                strcat(str," Debug");
        !           116: #endif
        !           117:                return(str);
        !           118:        }
        !           119: 
        !           120:        if(!strcmp(sp,"VER_NOTICE"))
        !           121:                return(VERSION_NOTICE);
1.1       root      122: 
1.1.1.2 ! root      123:        if(!strcmp(sp,"OS_VER"))
        !           124:                return(os_version(str));
1.1       root      125: 
1.1.1.2 ! root      126: #ifdef JAVASCRIPT
        !           127:        if(!strcmp(sp,"JS_VER"))
        !           128:                return((char *)JS_GetImplementationVersion());
        !           129: #endif
        !           130: 
        !           131:        if(!strcmp(sp,"PLATFORM"))
        !           132:                return(PLATFORM_DESC);
        !           133: 
        !           134:        if(!strcmp(sp,"COPYRIGHT"))
        !           135:                return(COPYRIGHT_NOTICE);
        !           136: 
        !           137:        if(!strcmp(sp,"COMPILER")) {
        !           138:                DESCRIBE_COMPILER(str);
        !           139:                return(str);
        !           140:        }
1.1       root      141: 
1.1.1.2 ! root      142:        if(!strcmp(sp,"UPTIME")) {
        !           143:                extern time_t uptime;
        !           144:                time_t up=time(NULL)-uptime;
        !           145:                if(up<0)
        !           146:                        up=0;
        !           147:                char   days[64]="";
        !           148:                if((up/(24*60*60))>=2) {
        !           149:                sprintf(days,"%lu days ",(ulong)(up/(24L*60L*60L)));
        !           150:                        up%=(24*60*60);
        !           151:                }
        !           152:                sprintf(str,"%s%lu:%02lu"
        !           153:                ,days
        !           154:                        ,(ulong)(up/(60L*60L))
        !           155:                        ,(ulong)((up/60L)%60L)
        !           156:                        );
        !           157:                return(str);
        !           158:        }
1.1       root      159: 
1.1.1.2 ! root      160:        if(!strcmp(sp,"SERVED")) {
        !           161:                extern DWORD served;
        !           162:                sprintf(str,"%lu",served);
        !           163:                return(str);
        !           164:        }
1.1       root      165: 
1.1.1.2 ! root      166:        if(!strcmp(sp,"SOCKET_LIB"))
        !           167:                return(socklib_version(str,SOCKLIB_DESC));
1.1       root      168: 
1.1.1.2 ! root      169:        if(!strcmp(sp,"MSG_LIB")) {
        !           170:                sprintf(str,"SMBLIB %s",smb_lib_ver());
        !           171:                return(str);
        !           172:        }
        !           173: 
        !           174:        if(!strcmp(sp,"BBS") || !strcmp(sp,"BOARDNAME"))
        !           175:                return(cfg.sys_name);
1.1       root      176: 
1.1.1.2 ! root      177:        if(!strcmp(sp,"BAUD") || !strcmp(sp,"BPS")) {
        !           178:                sprintf(str,"%lu",cur_rate);
        !           179:                return(str);
        !           180:        }
1.1       root      181: 
1.1.1.2 ! root      182:        if(!strcmp(sp,"CONN"))
        !           183:                return(connection);
        !           184: 
        !           185:        if(!strcmp(sp,"SYSOP"))
        !           186:                return(cfg.sys_op);
        !           187: 
        !           188:        if(!strcmp(sp,"LOCATION"))
        !           189:                return(cfg.sys_location);
        !           190: 
        !           191:        if(!strcmp(sp,"NODE")) {
        !           192:                sprintf(str,"%u",cfg.node_num);
        !           193:                return(str);
        !           194:        }
        !           195: 
        !           196:        if(!strcmp(sp,"TNODE")) {
        !           197:                sprintf(str,"%u",cfg.sys_nodes);
        !           198:                return(str);
        !           199:        }
1.1       root      200: 
1.1.1.2 ! root      201:        if(!strcmp(sp,"INETADDR"))
        !           202:                return(cfg.sys_inetaddr);
1.1       root      203: 
1.1.1.2 ! root      204:        if(!strcmp(sp,"HOSTNAME"))
        !           205:                return(startup->host_name);
        !           206: 
        !           207:        if(!strcmp(sp,"FIDOADDR")) {
1.1       root      208:                if(cfg.total_faddrs)
1.1.1.2 ! root      209:                        return(smb_faddrtoa(&cfg.faddr[0],str));
        !           210:                return(nulstr);
1.1       root      211:        }
                    212: 
1.1.1.2 ! root      213:        if(!strcmp(sp,"EMAILADDR"))
        !           214:                return(usermailaddr(&cfg, str
        !           215:                        ,cfg.inetmail_misc&NMAIL_ALIAS ? useron.alias : useron.name));
        !           216: 
        !           217:        if(!strcmp(sp,"QWKID"))
        !           218:                return(cfg.sys_id);
1.1       root      219: 
1.1.1.2 ! root      220:        if(!strcmp(sp,"TIME") || !strcmp(sp,"SYSTIME")) {
1.1       root      221:                now=time(NULL);
1.1.1.2 ! root      222:                memset(&tm,0,sizeof(tm));
        !           223:                localtime_r(&now,&tm);
        !           224:                if(cfg.sys_misc&SM_MILITARY)
        !           225:                        sprintf(str,"%02d:%02d"
        !           226:                                ,tm.tm_hour,tm.tm_min);
1.1       root      227:                else
1.1.1.2 ! root      228:                        sprintf(str,"%02d:%02d %s"
        !           229:                                ,tm.tm_hour==0 ? 12
        !           230:                                : tm.tm_hour>12 ? tm.tm_hour-12
        !           231:                                : tm.tm_hour, tm.tm_min, tm.tm_hour>11 ? "pm":"am");
        !           232:                return(str);
1.1       root      233:        }
                    234: 
1.1.1.2 ! root      235:        if(!strcmp(sp,"DATE") || !strcmp(sp,"SYSDATE")) {
1.1       root      236:                now=time(NULL);
1.1.1.2 ! root      237:                return(unixtodstr(&cfg,now,str));
        !           238:        }
1.1       root      239: 
1.1.1.2 ! root      240:        if(!strcmp(sp,"TMSG")) {
1.1       root      241:                l=0;
                    242:                for(i=0;i<cfg.total_subs;i++)
1.1.1.2 ! root      243:                        l+=getposts(&cfg,i);            /* l=total posts */
        !           244:                sprintf(str,"%lu",l);
        !           245:                return(str);
        !           246:        }
1.1       root      247: 
1.1.1.2 ! root      248:        if(!strcmp(sp,"TUSER")) {
        !           249:                sprintf(str,"%u",total_users(&cfg));
        !           250:                return(str);
        !           251:        }
1.1       root      252: 
1.1.1.2 ! root      253:        if(!strcmp(sp,"TFILE")) {
1.1       root      254:                l=0;
                    255:                for(i=0;i<cfg.total_dirs;i++)
1.1.1.2 ! root      256:                        l+=getfiles(&cfg,i);
        !           257:                sprintf(str,"%lu",l);
        !           258:                return(str);
        !           259:        }
1.1       root      260: 
1.1.1.2 ! root      261:        if(!strcmp(sp,"TCALLS") || !strcmp(sp,"NUMCALLS")) {
1.1       root      262:                getstats(&cfg,0,&stats);
1.1.1.2 ! root      263:                sprintf(str,"%lu",stats.logons);
        !           264:                return(str);
        !           265:        }
1.1       root      266: 
1.1.1.2 ! root      267:        if(!strcmp(sp,"PREVON") || !strcmp(sp,"LASTCALLERNODE")
1.1       root      268:                || !strcmp(sp,"LASTCALLERSYSTEM"))
1.1.1.2 ! root      269:                return(lastuseron);
1.1       root      270: 
1.1.1.2 ! root      271:        if(!strcmp(sp,"CLS")) {
1.1       root      272:                CLS;
1.1.1.2 ! root      273:                return(nulstr);
        !           274:        }
1.1       root      275: 
1.1.1.2 ! root      276:        if(!strcmp(sp,"PAUSE") || !strcmp(sp,"MORE")) {
1.1       root      277:                pause();
1.1.1.2 ! root      278:                return(nulstr);
        !           279:        }
1.1       root      280: 
1.1.1.2 ! root      281:        if(!strcmp(sp,"RESETPAUSE")) {
        !           282:                lncntr=0;
        !           283:                return(nulstr);
        !           284:        }
        !           285: 
        !           286:        if(!strcmp(sp,"NOPAUSE") || !strcmp(sp,"POFF")) {
1.1       root      287:                sys_status^=SS_PAUSEOFF;
1.1.1.2 ! root      288:                return(nulstr);
        !           289:        }
1.1       root      290: 
1.1.1.2 ! root      291:        if(!strcmp(sp,"PON") || !strcmp(sp,"AUTOMORE")) {
1.1       root      292:                sys_status^=SS_PAUSEON;
1.1.1.2 ! root      293:                return(nulstr);
        !           294:        }
1.1       root      295: 
                    296:        /* NOSTOP */
                    297: 
                    298:        /* STOP */
                    299: 
1.1.1.2 ! root      300:        if(!strcmp(sp,"BELL") || !strcmp(sp,"BEEP"))
        !           301:                return("\a");
1.1       root      302: 
1.1.1.2 ! root      303:        if(!strcmp(sp,"EVENT")) {
        !           304:                if(event_time==0)
        !           305:                        return("<none>");
        !           306:                return(timestr(&event_time));
        !           307:        }
1.1       root      308: 
                    309:        /* LASTCALL */
                    310: 
1.1.1.2 ! root      311:        if(!strncmp(sp,"NODE",4)) {
1.1       root      312:                i=atoi(sp+4);
                    313:                if(i && i<=cfg.sys_nodes) {
                    314:                        getnodedat(i,&node,0);
1.1.1.2 ! root      315:                        printnodedat(i,&node);
        !           316:                }
        !           317:                return(nulstr);
        !           318:        }
1.1       root      319: 
1.1.1.2 ! root      320:        if(!strcmp(sp,"WHO")) {
1.1       root      321:                whos_online(true);
1.1.1.2 ! root      322:                return(nulstr);
        !           323:        }
1.1       root      324: 
                    325:        /* User Codes */
                    326: 
1.1.1.2 ! root      327:        if(!strcmp(sp,"USER") || !strcmp(sp,"ALIAS") || !strcmp(sp,"NAME"))
        !           328:                return(useron.alias);
1.1       root      329: 
1.1.1.2 ! root      330:        if(!strcmp(sp,"FIRST")) {
        !           331:                strcpy(str,useron.alias);
        !           332:                tp=strchr(str,' ');
1.1       root      333:                if(tp) *tp=0;
1.1.1.2 ! root      334:                return(str);
        !           335:        }
1.1       root      336: 
1.1.1.2 ! root      337:        if(!strcmp(sp,"USERNUM")) {
        !           338:                sprintf(str,"%u",useron.number);
        !           339:                return(str);
        !           340:        }
1.1       root      341: 
1.1.1.2 ! root      342:        if(!strcmp(sp,"PHONE") || !strcmp(sp,"HOMEPHONE")
1.1       root      343:                || !strcmp(sp,"DATAPHONE") || !strcmp(sp,"DATA"))
1.1.1.2 ! root      344:                return(useron.phone);
1.1       root      345: 
1.1.1.2 ! root      346:        if(!strcmp(sp,"ADDR1"))
        !           347:                return(useron.address);
1.1       root      348: 
1.1.1.2 ! root      349:        if(!strcmp(sp,"FROM"))
        !           350:                return(useron.location);
1.1       root      351: 
1.1.1.2 ! root      352:        if(!strcmp(sp,"CITY")) {
        !           353:                strcpy(str,useron.location);
        !           354:                char* p=strchr(str,',');
1.1       root      355:                if(p) {
                    356:                        *p=0;
1.1.1.2 ! root      357:                        return(str);
        !           358:                }
        !           359:                return(nulstr);
        !           360:        }
1.1       root      361: 
1.1.1.2 ! root      362:        if(!strcmp(sp,"STATE")) {
        !           363:                char* p=strchr(useron.location,',');
1.1       root      364:                if(p) {
                    365:                        p++;
1.1.1.2 ! root      366:                        if(*p==' ')
1.1       root      367:                                p++;
1.1.1.2 ! root      368:                        return(p);
        !           369:                }
        !           370:                return(nulstr);
        !           371:        }
1.1       root      372: 
1.1.1.2 ! root      373:        if(!strcmp(sp,"CPU"))
        !           374:                return(useron.comp);
1.1       root      375: 
1.1.1.2 ! root      376:        if(!strcmp(sp,"HOST"))
        !           377:                return(client_name);
1.1       root      378: 
1.1.1.2 ! root      379:        if(!strcmp(sp,"BDATE"))
        !           380:                return(useron.birth);
1.1       root      381: 
1.1.1.2 ! root      382:        if(!strcmp(sp,"AGE")) {
        !           383:                sprintf(str,"%u",getage(&cfg,useron.birth));
        !           384:                return(str);
        !           385:        }
        !           386: 
        !           387:        if(!strcmp(sp,"CALLS") || !strcmp(sp,"NUMTIMESON")) {
        !           388:                sprintf(str,"%u",useron.logons);
        !           389:                return(str);
        !           390:        }
1.1       root      391: 
1.1.1.2 ! root      392:        if(!strcmp(sp,"MEMO"))
        !           393:                return(unixtodstr(&cfg,useron.pwmod,str));
1.1       root      394: 
1.1.1.2 ! root      395:        if(!strcmp(sp,"SEC") || !strcmp(sp,"SECURITY")) {
        !           396:                sprintf(str,"%u",useron.level);
        !           397:                return(str);
        !           398:        }
        !           399: 
        !           400:        if(!strcmp(sp,"SINCE"))
        !           401:                return(unixtodstr(&cfg,useron.firston,str));
1.1       root      402: 
1.1.1.2 ! root      403:        if(!strcmp(sp,"TIMEON") || !strcmp(sp,"TIMEUSED")) {
1.1       root      404:                now=time(NULL);
1.1.1.2 ! root      405:                sprintf(str,"%lu",(ulong)(now-logontime)/60L);
        !           406:                return(str);
        !           407:        }
1.1       root      408: 
1.1.1.2 ! root      409:        if(!strcmp(sp,"TUSED")) {              /* Synchronet only */
1.1       root      410:                now=time(NULL);
1.1.1.2 ! root      411:                return(sectostr(now-logontime,str)+1);
        !           412:        }
1.1       root      413: 
1.1.1.2 ! root      414:        if(!strcmp(sp,"TLEFT")) {              /* Synchronet only */
1.1       root      415:                gettimeleft();
1.1.1.2 ! root      416:                return(sectostr(timeleft,str)+1);
        !           417:        }
1.1       root      418: 
1.1.1.2 ! root      419:        if(!strcmp(sp,"TPERD"))                /* Synchronet only */
        !           420:                return(sectostr(cfg.level_timeperday[useron.level],str)+1);
1.1       root      421: 
1.1.1.2 ! root      422:        if(!strcmp(sp,"TPERC"))                /* Synchronet only */
        !           423:                return(sectostr(cfg.level_timepercall[useron.level],str)+1);
1.1       root      424: 
1.1.1.2 ! root      425:        if(!strcmp(sp,"TIMELIMIT")) {
        !           426:                sprintf(str,"%u",cfg.level_timepercall[useron.level]);
        !           427:                return(str);
        !           428:        }
1.1       root      429: 
1.1.1.2 ! root      430:        if(!strcmp(sp,"MINLEFT") || !strcmp(sp,"LEFT") || !strcmp(sp,"TIMELEFT")) {
1.1       root      431:                gettimeleft();
1.1.1.2 ! root      432:                sprintf(str,"%lu",timeleft/60);
        !           433:                return(str);
        !           434:        }
1.1       root      435: 
1.1.1.2 ! root      436:        if(!strcmp(sp,"LASTON"))
        !           437:                return(timestr(&useron.laston));
1.1       root      438: 
1.1.1.2 ! root      439:        if(!strcmp(sp,"LASTDATEON"))
        !           440:                return(unixtodstr(&cfg,useron.laston,str));
1.1       root      441: 
1.1.1.2 ! root      442:        if(!strcmp(sp,"LASTTIMEON")) {
        !           443:                memset(&tm,0,sizeof(tm));
        !           444:                localtime_r(&useron.laston,&tm);
        !           445:                sprintf(str,"%02d:%02d %s"
1.1       root      446:                        ,tm.tm_hour==0 ? 12
                    447:                        : tm.tm_hour>12 ? tm.tm_hour-12
1.1.1.2 ! root      448:                        : tm.tm_hour, tm.tm_min, tm.tm_hour>11 ? "pm":"am");
        !           449:                return(str);
1.1       root      450:        }
                    451: 
1.1.1.2 ! root      452:        if(!strcmp(sp,"MSGLEFT") || !strcmp(sp,"MSGSLEFT")) {
        !           453:                sprintf(str,"%u",useron.posts);
        !           454:                return(str);
        !           455:        }
1.1       root      456: 
1.1.1.2 ! root      457:        if(!strcmp(sp,"MSGREAD")) {
        !           458:                sprintf(str,"%lu",posts_read);
        !           459:                return(str);
        !           460:        }
        !           461: 
        !           462:        if(!strcmp(sp,"FREESPACE")) {
        !           463:                sprintf(str,"%lu",getfreediskspace(cfg.temp_dir,0));
        !           464:                return(str);
        !           465:        }
1.1       root      466: 
1.1.1.2 ! root      467:        if(!strcmp(sp,"FREESPACEK")) {
        !           468:                sprintf(str,"%lu",getfreediskspace(cfg.temp_dir,1024));
        !           469:                return(str);
        !           470:        }
1.1       root      471: 
1.1.1.2 ! root      472:        if(!strcmp(sp,"UPBYTES")) {
        !           473:                sprintf(str,"%lu",useron.ulb);
        !           474:                return(str);
        !           475:        }
1.1       root      476: 
1.1.1.2 ! root      477:        if(!strcmp(sp,"UPK")) {
        !           478:                sprintf(str,"%lu",useron.ulb/1024L);
        !           479:                return(str);
        !           480:        }
1.1       root      481: 
1.1.1.2 ! root      482:        if(!strcmp(sp,"UPS") || !strcmp(sp,"UPFILES")) {
        !           483:                sprintf(str,"%u",useron.uls);
        !           484:                return(str);
        !           485:        }
1.1       root      486: 
1.1.1.2 ! root      487:        if(!strcmp(sp,"DLBYTES")) {
        !           488:                sprintf(str,"%lu",useron.dlb);
        !           489:                return(str);
        !           490:        }
1.1       root      491: 
1.1.1.2 ! root      492:        if(!strcmp(sp,"DOWNK")) {
        !           493:                sprintf(str,"%lu",useron.dlb/1024L);
        !           494:                return(str);
        !           495:        }
1.1       root      496: 
1.1.1.2 ! root      497:        if(!strcmp(sp,"DOWNS") || !strcmp(sp,"DLFILES")) {
        !           498:                sprintf(str,"%u",useron.dls);
        !           499:                return(str);
        !           500:        }
1.1       root      501: 
1.1.1.2 ! root      502:        if(!strcmp(sp,"LASTNEW"))
        !           503:                return(unixtodstr(&cfg,ns_time,str));
1.1       root      504: 
1.1.1.2 ! root      505:        if(!strcmp(sp,"NEWFILETIME"))
        !           506:                return(timestr(&ns_time));
1.1       root      507: 
                    508:        /* MAXDL */
                    509: 
1.1.1.2 ! root      510:        if(!strcmp(sp,"MAXDK") || !strcmp(sp,"DLKLIMIT") || !strcmp(sp,"KBLIMIT")) {
        !           511:                sprintf(str,"%lu",cfg.level_freecdtperday[useron.level]/1024L);
        !           512:                return(str);
        !           513:        }
1.1       root      514: 
1.1.1.2 ! root      515:        if(!strcmp(sp,"DAYBYTES")) {    /* amt of free cdts used today */
        !           516:                sprintf(str,"%lu",cfg.level_freecdtperday[useron.level]-useron.freecdt);
        !           517:                return(str);
        !           518:        }
1.1       root      519: 
1.1.1.2 ! root      520:        if(!strcmp(sp,"BYTELIMIT")) {
        !           521:                sprintf(str,"%lu",cfg.level_freecdtperday[useron.level]);
        !           522:                return(str);
        !           523:        }
1.1       root      524: 
1.1.1.2 ! root      525:        if(!strcmp(sp,"KBLEFT")) {
        !           526:                sprintf(str,"%lu",(useron.cdt+useron.freecdt)/1024L);
        !           527:                return(str);
        !           528:        }
1.1       root      529: 
1.1.1.2 ! root      530:        if(!strcmp(sp,"BYTESLEFT")) {
        !           531:                sprintf(str,"%lu",useron.cdt+useron.freecdt);
        !           532:                return(str);
        !           533:        }
1.1       root      534: 
1.1.1.2 ! root      535:        if(!strcmp(sp,"CONF")) {
        !           536:                sprintf(str,"%s %s"
1.1       root      537:                        ,usrgrps ? cfg.grp[usrgrp[curgrp]]->sname :nulstr
                    538:                        ,usrgrps ? cfg.sub[usrsub[curgrp][cursub[curgrp]]]->sname : nulstr);
1.1.1.2 ! root      539:                return(str);
        !           540:        }
1.1       root      541: 
1.1.1.2 ! root      542:        if(!strcmp(sp,"CONFNUM")) {
        !           543:                sprintf(str,"%u %u",curgrp+1,cursub[curgrp]+1);
        !           544:                return(str);
        !           545:        }
1.1       root      546: 
1.1.1.2 ! root      547:        if(!strcmp(sp,"NUMDIR")) {
        !           548:                sprintf(str,"%u %u",usrlibs ? curlib+1 : 0,usrlibs ? curdir[curlib]+1 : 0);
        !           549:                return(str);
        !           550:        }
1.1       root      551: 
1.1.1.2 ! root      552:        if(!strcmp(sp,"EXDATE") || !strcmp(sp,"EXPDATE"))
        !           553:                return(unixtodstr(&cfg,useron.expire,str));
1.1       root      554: 
1.1.1.2 ! root      555:        if(!strcmp(sp,"EXPDAYS")) {
1.1       root      556:                now=time(NULL);
                    557:                l=useron.expire-now;
                    558:                if(l<0)
                    559:                        l=0;
1.1.1.2 ! root      560:                sprintf(str,"%lu",l/(1440L*60L));
        !           561:                return(str);
        !           562:        }
1.1       root      563: 
1.1.1.2 ! root      564:        if(!strcmp(sp,"MEMO1"))
        !           565:                return(useron.note);
1.1       root      566: 
1.1.1.2 ! root      567:        if(!strcmp(sp,"MEMO2") || !strcmp(sp,"COMPANY"))
        !           568:                return(useron.name);
1.1       root      569: 
1.1.1.2 ! root      570:        if(!strcmp(sp,"ZIP"))
        !           571:                return(useron.zipcode);
1.1       root      572: 
1.1.1.2 ! root      573:        if(!strcmp(sp,"HANGUP")) {
1.1       root      574:                hangup();
1.1.1.2 ! root      575:                return(nulstr);
        !           576:        }
1.1       root      577: 
                    578:        /* Synchronet Specific */
                    579: 
1.1.1.2 ! root      580:        if(!strncmp(sp,"SETSTR:",7)) {
1.1       root      581:                strcpy(main_csi.str,sp+7);
1.1.1.2 ! root      582:                return(nulstr);
        !           583:        }
1.1       root      584: 
1.1.1.2 ! root      585:        if(!strncmp(sp,"EXEC:",5)) {
1.1       root      586:                exec_bin(sp+5,&main_csi);
1.1.1.2 ! root      587:                return(nulstr);
        !           588:        }
1.1       root      589: 
1.1.1.2 ! root      590:        if(!strncmp(sp,"MENU:",5)) {
1.1       root      591:                menu(sp+5);
1.1.1.2 ! root      592:                return(nulstr);
        !           593:        }
1.1       root      594: 
1.1.1.2 ! root      595:        if(!strncmp(sp,"TYPE:",5)) {
        !           596:                printfile(cmdstr(sp+5,nulstr,nulstr,str),0);
        !           597:                return(nulstr);
        !           598:        }
1.1       root      599: 
1.1.1.2 ! root      600:        if(!strcmp(sp,"QUESTION"))
        !           601:                return(question);
1.1       root      602: 
1.1.1.2 ! root      603:        if(!strcmp(sp,"HANDLE"))
        !           604:                return(useron.handle);
1.1       root      605: 
1.1.1.2 ! root      606:        if(!strcmp(sp,"CID") || !strcmp(sp,"IP"))
        !           607:                return(cid);
1.1       root      608: 
1.1.1.2 ! root      609:        if(!strcmp(sp,"LOCAL-IP")) {
1.1       root      610:                struct in_addr in_addr;
                    611:                in_addr.s_addr=local_addr;
1.1.1.2 ! root      612:                return(inet_ntoa(in_addr));
1.1       root      613:        }
                    614: 
1.1.1.2 ! root      615:        if(!strcmp(sp,"CRLF"))
        !           616:                return("\r\n");
1.1       root      617: 
1.1.1.2 ! root      618:        if(!strcmp(sp,"PUSHXY")) {
1.1       root      619:                ANSI_SAVE();
1.1.1.2 ! root      620:                return(nulstr);
        !           621:        }
1.1       root      622: 
1.1.1.2 ! root      623:        if(!strcmp(sp,"POPXY")) {
1.1       root      624:                ANSI_RESTORE();
1.1.1.2 ! root      625:                return(nulstr);
        !           626:        }
1.1       root      627: 
1.1.1.2 ! root      628:        if(!strcmp(sp,"UP"))
        !           629:                return("\x1b[A");
1.1       root      630: 
1.1.1.2 ! root      631:        if(!strcmp(sp,"DOWN"))
        !           632:                return("\x1b[B");
1.1       root      633: 
1.1.1.2 ! root      634:        if(!strcmp(sp,"RIGHT"))
        !           635:                return("\x1b[C");
1.1       root      636: 
1.1.1.2 ! root      637:        if(!strcmp(sp,"LEFT"))
        !           638:                return("\x1b[D");
1.1       root      639: 
1.1.1.2 ! root      640:        if(!strncmp(sp,"UP:",3)) {
        !           641:                sprintf(str,"\x1b[%dA",atoi(sp+3));
        !           642:                return(str);
        !           643:        }
1.1       root      644: 
1.1.1.2 ! root      645:        if(!strncmp(sp,"DOWN:",5)) {
        !           646:                sprintf(str,"\x1b[%dB",atoi(sp+5));
        !           647:                return(str);
        !           648:        }
1.1       root      649: 
1.1.1.2 ! root      650:        if(!strncmp(sp,"LEFT:",5)) {
        !           651:                sprintf(str,"\x1b[%dC",atoi(sp+5));
        !           652:                return(str);
        !           653:        }
1.1       root      654: 
1.1.1.2 ! root      655:        if(!strncmp(sp,"RIGHT:",6)) {
        !           656:                sprintf(str,"\x1b[%dD",atoi(sp+6));
        !           657:                return(str);
        !           658:        }
1.1       root      659: 
1.1.1.2 ! root      660:        if(!strncmp(sp,"GOTOXY:",7)) {
1.1       root      661:                tp=strchr(sp,',');
                    662:                if(tp!=NULL) {
                    663:                        tp++;
                    664:                        GOTOXY(atoi(sp+7),atoi(tp));
                    665:                }
1.1.1.2 ! root      666:                return(nulstr);
1.1       root      667:        }
                    668: 
1.1.1.2 ! root      669:        if(!strcmp(sp,"GRP")) {
        !           670:                if(SMB_IS_OPEN(&smb)) {
        !           671:                        if(smb.subnum==INVALID_SUB)
        !           672:                                return("Local");
        !           673:                        if(smb.subnum<cfg.total_subs)
        !           674:                                return(cfg.grp[cfg.sub[smb.subnum]->grp]->sname);
        !           675:                }
        !           676:                return(usrgrps ? cfg.grp[usrgrp[curgrp]]->sname : nulstr);
        !           677:        }
1.1       root      678: 
1.1.1.2 ! root      679:        if(!strcmp(sp,"GRPL")) {
        !           680:                if(SMB_IS_OPEN(&smb)) {
        !           681:                        if(smb.subnum==INVALID_SUB)
        !           682:                                return("Local");
        !           683:                        if(smb.subnum<cfg.total_subs)
        !           684:                                return(cfg.grp[cfg.sub[smb.subnum]->grp]->lname);
        !           685:                }
        !           686:                return(usrgrps ? cfg.grp[usrgrp[curgrp]]->lname : nulstr);
        !           687:        }
1.1       root      688: 
1.1.1.2 ! root      689:        if(!strcmp(sp,"GN")) {
        !           690:                if(SMB_IS_OPEN(&smb))
        !           691:                        ugrp=getusrgrp(smb.subnum);
        !           692:                else
        !           693:                        ugrp=usrgrps ? curgrp+1 : 0;
        !           694:                sprintf(str,"%u",ugrp);
        !           695:                return(str);
        !           696:        }
1.1       root      697: 
1.1.1.2 ! root      698:        if(!strcmp(sp,"GL")) {
        !           699:                if(SMB_IS_OPEN(&smb))
        !           700:                        ugrp=getusrgrp(smb.subnum);
        !           701:                else
        !           702:                        ugrp=usrgrps ? curgrp+1 : 0;
        !           703:                sprintf(str,"%-4u",ugrp);
        !           704:                return(str);
        !           705:        }
1.1       root      706: 
1.1.1.2 ! root      707:        if(!strcmp(sp,"GR")) {
        !           708:                if(SMB_IS_OPEN(&smb))
        !           709:                        ugrp=getusrgrp(smb.subnum);
        !           710:                else
        !           711:                        ugrp=usrgrps ? curgrp+1 : 0;
        !           712:                sprintf(str,"%4u",ugrp);
        !           713:                return(str);
        !           714:        }
1.1       root      715: 
1.1.1.2 ! root      716:        if(!strcmp(sp,"SUB")) {
        !           717:                if(SMB_IS_OPEN(&smb)) {
        !           718:                        if(smb.subnum==INVALID_SUB)
        !           719:                                return("Mail");
        !           720:                        else if(smb.subnum<cfg.total_subs)
        !           721:                                return(cfg.sub[smb.subnum]->sname);
        !           722:                }
        !           723:                return(usrgrps ? cfg.sub[usrsub[curgrp][cursub[curgrp]]]->sname : nulstr);
        !           724:        }
1.1       root      725: 
1.1.1.2 ! root      726:        if(!strcmp(sp,"SUBL")) {
        !           727:                if(SMB_IS_OPEN(&smb)) {
        !           728:                        if(smb.subnum==INVALID_SUB)
        !           729:                                return("Mail");
        !           730:                        else if(smb.subnum<cfg.total_subs)
        !           731:                                return(cfg.sub[smb.subnum]->lname);
        !           732:                }
        !           733:                return(usrgrps  ? cfg.sub[usrsub[curgrp][cursub[curgrp]]]->lname : nulstr);
        !           734:        }
1.1       root      735: 
1.1.1.2 ! root      736:        if(!strcmp(sp,"SN")) {
        !           737:                if(SMB_IS_OPEN(&smb))
        !           738:                        usub=getusrsub(smb.subnum);
        !           739:                else
        !           740:                        usub=usrgrps ? cursub[curgrp]+1 : 0;
        !           741:                sprintf(str,"%u",usub);
        !           742:                return(str);
        !           743:        }
1.1       root      744: 
1.1.1.2 ! root      745:        if(!strcmp(sp,"SL")) {
        !           746:                if(SMB_IS_OPEN(&smb))
        !           747:                        usub=getusrsub(smb.subnum);
        !           748:                else
        !           749:                        usub=usrgrps ? cursub[curgrp]+1 : 0;
        !           750:                sprintf(str,"%-4u",usub);
        !           751:                return(str);
        !           752:        }
1.1       root      753: 
1.1.1.2 ! root      754:        if(!strcmp(sp,"SR")) {
        !           755:                if(SMB_IS_OPEN(&smb))
        !           756:                        usub=getusrsub(smb.subnum);
        !           757:                else
        !           758:                        usub=usrgrps ? cursub[curgrp]+1 : 0;
        !           759:                sprintf(str,"%4u",usub);
        !           760:                return(str);
        !           761:        }
1.1       root      762: 
1.1.1.2 ! root      763:        if(!strcmp(sp,"LIB"))
        !           764:                return(usrlibs ? cfg.lib[usrlib[curlib]]->sname : nulstr);
1.1       root      765: 
1.1.1.2 ! root      766:        if(!strcmp(sp,"LIBL"))
        !           767:                return(usrlibs ? cfg.lib[usrlib[curlib]]->lname : nulstr);
1.1       root      768: 
1.1.1.2 ! root      769:        if(!strcmp(sp,"LN")) {
        !           770:                sprintf(str,"%u",usrlibs ? curlib+1 : 0);
        !           771:                return(str);
        !           772:        }
1.1       root      773: 
1.1.1.2 ! root      774:        if(!strcmp(sp,"LL")) {
        !           775:                sprintf(str,"%-4u",usrlibs ? curlib+1 : 0);
        !           776:                return(str);
        !           777:        }
1.1       root      778: 
1.1.1.2 ! root      779:        if(!strcmp(sp,"LR")) {
        !           780:                sprintf(str,"%4u",usrlibs  ? curlib+1 : 0);
        !           781:                return(str);
        !           782:        }
1.1       root      783: 
1.1.1.2 ! root      784:        if(!strcmp(sp,"DIR"))
        !           785:                return(usrlibs ? cfg.dir[usrdir[curlib][curdir[curlib]]]->sname :nulstr);
1.1       root      786: 
1.1.1.2 ! root      787:        if(!strcmp(sp,"DIRL"))
        !           788:                return(usrlibs ? cfg.dir[usrdir[curlib][curdir[curlib]]]->lname : nulstr);
1.1       root      789: 
1.1.1.2 ! root      790:        if(!strcmp(sp,"DN")) {
        !           791:                sprintf(str,"%u",usrlibs ? curdir[curlib]+1 : 0);
        !           792:                return(str);
        !           793:        }
1.1       root      794: 
1.1.1.2 ! root      795:        if(!strcmp(sp,"DL")) {
        !           796:                sprintf(str,"%-4u",usrlibs ? curdir[curlib]+1 : 0);
        !           797:                return(str);
        !           798:        }
1.1       root      799: 
1.1.1.2 ! root      800:        if(!strcmp(sp,"DR")) {
        !           801:                sprintf(str,"%4u",usrlibs ? curdir[curlib]+1 : 0);
        !           802:                return(str);
        !           803:        }
1.1       root      804: 
1.1.1.2 ! root      805:        if(!strcmp(sp,"NOACCESS")) {
1.1       root      806:                if(noaccess_str==text[NoAccessTime])
1.1.1.2 ! root      807:                        sprintf(str,noaccess_str,noaccess_val/60,noaccess_val%60);
1.1       root      808:                else if(noaccess_str==text[NoAccessDay])
1.1.1.2 ! root      809:                        sprintf(str,noaccess_str,wday[noaccess_val]);
1.1       root      810:                else
1.1.1.2 ! root      811:                        sprintf(str,noaccess_str,noaccess_val);
        !           812:                return(str);
        !           813:        }
1.1       root      814: 
1.1.1.2 ! root      815:        if(!strcmp(sp,"LAST")) {
        !           816:                tp=strrchr(useron.alias,' ');
1.1       root      817:                if(tp) tp++;
                    818:                else tp=useron.alias;
1.1.1.2 ! root      819:                return(tp);
        !           820:        }
1.1       root      821: 
1.1.1.2 ! root      822:        if(!strcmp(sp,"REAL")) {
        !           823:                strcpy(str,useron.name);
        !           824:                tp=strchr(str,' ');
1.1       root      825:                if(tp) *tp=0;
1.1.1.2 ! root      826:                return(str);
        !           827:        }
1.1       root      828: 
1.1.1.2 ! root      829:        if(!strcmp(sp,"FIRSTREAL")) {
        !           830:                strcpy(str,useron.name);
        !           831:                tp=strchr(str,' ');
1.1       root      832:                if(tp) *tp=0;
1.1.1.2 ! root      833:                return(str);
        !           834:        }
1.1       root      835: 
1.1.1.2 ! root      836:        if(!strcmp(sp,"LASTREAL")) {
        !           837:                tp=strrchr(useron.name,' ');
1.1       root      838:                if(tp) tp++;
                    839:                else tp=useron.name;
1.1.1.2 ! root      840:                return(tp);
        !           841:        }
1.1       root      842: 
1.1.1.2 ! root      843:        if(!strcmp(sp,"MAILW")) {
        !           844:                sprintf(str,"%u",getmail(&cfg,useron.number,0));
        !           845:                return(str);
        !           846:        }
1.1       root      847: 
1.1.1.2 ! root      848:        if(!strcmp(sp,"MAILP")) {
        !           849:                sprintf(str,"%u",getmail(&cfg,useron.number,1));
        !           850:                return(str);
        !           851:        }
1.1       root      852: 
1.1.1.2 ! root      853:        if(!strncmp(sp,"MAILW:",6)) {
        !           854:                sprintf(str,"%u",getmail(&cfg,atoi(sp+6),0));
        !           855:                return(str);
        !           856:        }
1.1       root      857: 
1.1.1.2 ! root      858:        if(!strncmp(sp,"MAILP:",6)) {
        !           859:                sprintf(str,"%u",getmail(&cfg,atoi(sp+6),1));
        !           860:                return(str);
        !           861:        }
1.1       root      862: 
1.1.1.2 ! root      863:        if(!strcmp(sp,"MSGREPLY")) {
        !           864:                sprintf(str,"%c",cfg.sys_misc&SM_RA_EMU ? 'R' : 'A');
        !           865:                return(str);
        !           866:        }
1.1       root      867: 
1.1.1.2 ! root      868:        if(!strcmp(sp,"MSGREREAD")) {
        !           869:                sprintf(str,"%c",cfg.sys_misc&SM_RA_EMU ? 'A' : 'R');
        !           870:                return(str);
        !           871:        }
1.1       root      872: 
1.1.1.2 ! root      873:        if(!strncmp(sp,"STATS.",6)) {
1.1       root      874:                getstats(&cfg,0,&stats);
                    875:                sp+=6;
1.1.1.2 ! root      876:                if(!strcmp(sp,"LOGONS"))
        !           877:                        sprintf(str,"%lu",stats.logons);
        !           878:                else if(!strcmp(sp,"LTODAY"))
        !           879:                        sprintf(str,"%lu",stats.ltoday);
        !           880:                else if(!strcmp(sp,"TIMEON"))
        !           881:                        sprintf(str,"%lu",stats.timeon);
        !           882:                else if(!strcmp(sp,"TTODAY"))
        !           883:                        sprintf(str,"%lu",stats.ttoday);
        !           884:                else if(!strcmp(sp,"ULS"))
        !           885:                        sprintf(str,"%lu",stats.uls);
        !           886:                else if(!strcmp(sp,"ULB"))
        !           887:                        sprintf(str,"%lu",stats.ulb);
        !           888:                else if(!strcmp(sp,"DLS"))
        !           889:                        sprintf(str,"%lu",stats.dls);
        !           890:                else if(!strcmp(sp,"DLB"))
        !           891:                        sprintf(str,"%lu",stats.dlb);
        !           892:                else if(!strcmp(sp,"PTODAY"))
        !           893:                        sprintf(str,"%lu",stats.ptoday);
        !           894:                else if(!strcmp(sp,"ETODAY"))
        !           895:                        sprintf(str,"%lu",stats.etoday);
        !           896:                else if(!strcmp(sp,"FTODAY"))
        !           897:                        sprintf(str,"%lu",stats.ftoday);
        !           898:                else if(!strcmp(sp,"NUSERS"))
        !           899:                        sprintf(str,"%u",stats.nusers);
        !           900:                return(str);
1.1       root      901:        }
                    902: 
1.1.1.2 ! root      903:        /* Message header codes */
        !           904:        if(!strcmp(sp,"MSG_TO") && current_msg!=NULL) {
        !           905:                if(current_msg->to==NULL)
        !           906:                        return(nulstr);
        !           907:                if(current_msg->to_ext!=NULL)
        !           908:                        sprintf(str,"%s #%s",current_msg->to,current_msg->to_ext);
        !           909:                else if(current_msg->to_net.type!=NET_NONE)
        !           910:                        sprintf(str,"%s (%s)",current_msg->to
        !           911:                                ,smb_netaddr(&current_msg->to_net));
        !           912:                else
        !           913:                        strcpy(str,current_msg->to);
        !           914:                return(str);
        !           915:        }
        !           916:        if(!strcmp(sp,"MSG_TO_NAME") && current_msg!=NULL)
        !           917:                return(current_msg->to==NULL ? nulstr : current_msg->to);
        !           918:        if(!strcmp(sp,"MSG_TO_EXT") && current_msg!=NULL) {
        !           919:                if(current_msg->to_ext==NULL)
        !           920:                        return(nulstr);
        !           921:                return(current_msg->to_ext);
        !           922:        }
        !           923:        if(!strcmp(sp,"MSG_TO_NET") && current_msg!=NULL)
        !           924:                return(smb_netaddr(&current_msg->to_net));
        !           925:        if(!strcmp(sp,"MSG_FROM") && current_msg!=NULL) {
        !           926:                if(current_msg->from==NULL)
        !           927:                        return(nulstr);
        !           928:                if(current_msg->hdr.attr&MSG_ANONYMOUS && !SYSOP)
        !           929:                        return(text[Anonymous]);
        !           930:                if(current_msg->from_ext!=NULL)
        !           931:                        sprintf(str,"%s #%s",current_msg->from,current_msg->from_ext);
        !           932:                else if(current_msg->from_net.type!=NET_NONE)
        !           933:                        sprintf(str,"%s (%s)",current_msg->from
        !           934:                                ,smb_netaddr(&current_msg->from_net));
        !           935:                else
        !           936:                        strcpy(str,current_msg->from);
        !           937:                return(str);
        !           938:        }
        !           939:        if(!strcmp(sp,"MSG_FROM_NAME") && current_msg!=NULL) {
        !           940:                if(current_msg->from==NULL)
        !           941:                        return(nulstr);
        !           942:                if(current_msg->hdr.attr&MSG_ANONYMOUS && !SYSOP)
        !           943:                        return(text[Anonymous]);
        !           944:                return(current_msg->from);
        !           945:        }
        !           946:        if(!strcmp(sp,"MSG_FROM_EXT") && current_msg!=NULL) {
        !           947:                if(!(current_msg->hdr.attr&MSG_ANONYMOUS) || SYSOP)
        !           948:                        if(current_msg->from_ext!=NULL)
        !           949:                                return(current_msg->from_ext);
        !           950:                return(nulstr);
        !           951:        }
        !           952:        if(!strcmp(sp,"MSG_FROM_NET") && current_msg!=NULL) {
        !           953:                if(current_msg->from_net.type!=NET_NONE
        !           954:                        && (!(current_msg->hdr.attr&MSG_ANONYMOUS) || SYSOP))
        !           955:                        return(smb_netaddr(&current_msg->from_net));
        !           956:                return(nulstr);
        !           957:        }
        !           958:        if(!strcmp(sp,"MSG_SUBJECT") && current_msg!=NULL)
        !           959:                return(current_msg->subj==NULL ? nulstr : current_msg->subj);
        !           960:        if(!strcmp(sp,"MSG_DATE") && current_msg!=NULL)
        !           961:                return(timestr((time_t *)&current_msg->hdr.when_written.time));
        !           962:        if(!strcmp(sp,"MSG_TIMEZONE") && current_msg!=NULL)
        !           963:                return(smb_zonestr(current_msg->hdr.when_written.zone,NULL));
        !           964:        if(!strcmp(sp,"MSG_ATTR") && current_msg!=NULL) {
        !           965:                sprintf(str,"%s%s%s%s%s%s%s%s%s%s"
        !           966:                        ,current_msg->hdr.attr&MSG_PRIVATE              ? "Private  "   :nulstr
        !           967:                        ,current_msg->hdr.attr&MSG_READ                 ? "Read  "      :nulstr
        !           968:                        ,current_msg->hdr.attr&MSG_DELETE               ? "Deleted  "   :nulstr
        !           969:                        ,current_msg->hdr.attr&MSG_KILLREAD             ? "Kill  "      :nulstr
        !           970:                        ,current_msg->hdr.attr&MSG_ANONYMOUS    ? "Anonymous  " :nulstr
        !           971:                        ,current_msg->hdr.attr&MSG_LOCKED               ? "Locked  "    :nulstr
        !           972:                        ,current_msg->hdr.attr&MSG_PERMANENT    ? "Permanent  " :nulstr
        !           973:                        ,current_msg->hdr.attr&MSG_MODERATED    ? "Moderated  " :nulstr
        !           974:                        ,current_msg->hdr.attr&MSG_VALIDATED    ? "Validated  " :nulstr
        !           975:                        ,current_msg->hdr.attr&MSG_REPLIED              ? "Replied  "   :nulstr
        !           976:                        );
        !           977:                return(str);
        !           978:        }
        !           979:        if(!strcmp(sp,"MSG_ID") && current_msg!=NULL)
        !           980:                return(current_msg->id==NULL ? nulstr : current_msg->id);
        !           981:        if(!strcmp(sp,"MSG_REPLY_ID") && current_msg!=NULL)
        !           982:                return(current_msg->reply_id==NULL ? nulstr : current_msg->reply_id);
        !           983:        if(!strcmp(sp,"MSG_NUM") && current_msg!=NULL) {
        !           984:                sprintf(str,"%lu",current_msg->hdr.number);
        !           985:                return(str);
        !           986:        }
1.1       root      987: 
1.1.1.2 ! root      988:        if(!strcmp(sp,"SMB_AREA")) {
        !           989:                if(smb.subnum!=INVALID_SUB && smb.subnum<cfg.total_subs)
        !           990:                        sprintf(str,"%s %s"
        !           991:                                ,cfg.grp[cfg.sub[smb.subnum]->grp]->sname
        !           992:                                ,cfg.sub[smb.subnum]->sname);
        !           993:                return(str);
        !           994:        }
        !           995:        if(!strcmp(sp,"SMB_AREA_DESC")) {
        !           996:                if(smb.subnum!=INVALID_SUB && smb.subnum<cfg.total_subs)
        !           997:                        sprintf(str,"%s %s"
        !           998:                                ,cfg.grp[cfg.sub[smb.subnum]->grp]->lname
        !           999:                                ,cfg.sub[smb.subnum]->lname);
        !          1000:                return(str);
        !          1001:        }
        !          1002:        if(!strcmp(sp,"SMB_GROUP")) {
        !          1003:                if(smb.subnum!=INVALID_SUB && smb.subnum<cfg.total_subs)
        !          1004:                        return(cfg.grp[cfg.sub[smb.subnum]->grp]->sname);
        !          1005:                return(nulstr);
        !          1006:        }
        !          1007:        if(!strcmp(sp,"SMB_GROUP_DESC")) {
        !          1008:                if(smb.subnum!=INVALID_SUB && smb.subnum<cfg.total_subs)
        !          1009:                        return(cfg.grp[cfg.sub[smb.subnum]->grp]->lname);
        !          1010:                return(nulstr);
        !          1011:        }
        !          1012:        if(!strcmp(sp,"SMB_GROUP_NUM")) {
        !          1013:                if(smb.subnum!=INVALID_SUB && smb.subnum<cfg.total_subs)
        !          1014:                        sprintf(str,"%u",getusrgrp(smb.subnum));
        !          1015:                return(str);
        !          1016:        }
        !          1017:        if(!strcmp(sp,"SMB_SUB")) {
        !          1018:                if(smb.subnum==INVALID_SUB)
        !          1019:                        return("Mail");
        !          1020:                else if(smb.subnum<cfg.total_subs)
        !          1021:                        return(cfg.sub[smb.subnum]->sname);
        !          1022:                return(nulstr);
        !          1023:        }
        !          1024:        if(!strcmp(sp,"SMB_SUB_DESC")) {
        !          1025:                if(smb.subnum==INVALID_SUB)
        !          1026:                        return("Mail");
        !          1027:                else if(smb.subnum<cfg.total_subs)
        !          1028:                        return(cfg.sub[smb.subnum]->lname);
        !          1029:                return(nulstr);
        !          1030:        }
        !          1031:        if(!strcmp(sp,"SMB_SUB_CODE")) {
        !          1032:                if(smb.subnum==INVALID_SUB)
        !          1033:                        return("MAIL");
        !          1034:                else if(smb.subnum<cfg.total_subs)
        !          1035:                        return(cfg.sub[smb.subnum]->code);
        !          1036:                return(nulstr);
        !          1037:        }
        !          1038:        if(!strcmp(sp,"SMB_SUB_NUM")) {
        !          1039:                if(smb.subnum!=INVALID_SUB && smb.subnum<cfg.total_subs)
        !          1040:                        sprintf(str,"%u",getusrsub(smb.subnum));
        !          1041:                return(str);
        !          1042:        }
        !          1043:        if(!strcmp(sp,"SMB_MSGS")) {
        !          1044:                sprintf(str,"%ld",smb.msgs);
        !          1045:                return(str);
        !          1046:        }
        !          1047:        if(!strcmp(sp,"SMB_CURMSG")) {
        !          1048:                sprintf(str,"%ld",smb.curmsg+1);
        !          1049:                return(str);
        !          1050:        }
        !          1051:        if(!strcmp(sp,"SMB_LAST_MSG")) {
        !          1052:                sprintf(str,"%lu",smb.status.last_msg);
        !          1053:                return(str);
        !          1054:        }
        !          1055:        if(!strcmp(sp,"SMB_MAX_MSGS")) {
        !          1056:                sprintf(str,"%lu",smb.status.max_msgs);
        !          1057:                return(str);
        !          1058:        }
        !          1059:        if(!strcmp(sp,"SMB_MAX_CRCS")) {
        !          1060:                sprintf(str,"%lu",smb.status.max_crcs);
        !          1061:                return(str);
        !          1062:        }
        !          1063:        if(!strcmp(sp,"SMB_MAX_AGE")) {
        !          1064:                sprintf(str,"%hu",smb.status.max_age);
        !          1065:                return(str);
        !          1066:        }
        !          1067:        if(!strcmp(sp,"SMB_TOTAL_MSGS")) {
        !          1068:                sprintf(str,"%lu",smb.status.total_msgs);
        !          1069:                return(str);
        !          1070:        }
        !          1071: 
        !          1072:        return(NULL);
1.1       root     1073: }
                   1074: 

unix.superglobalmegacorp.com

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