Exemple #1
0
int count_rejs(simulation& simul, int narrs) {
    int n = 0;
    customer cus;
    for (int i = 0; i < narrs; i++) {
        cus = simul.next();
        if (is_rejected(cus))
            n++;
    }
    return n;
}
Exemple #2
0
char *
modestring(user_info *uentp, int simple)
{
    static char modestr[40];
    static char *notonline="不在站上";
    register int mode = uentp->mode;
    register char *word;

    word = ModeTypeTable[mode];

    if (!(HAS_PERM(PERM_SYSOP) || HAS_PERM(PERM_SEECLOAK)) &&
            (uentp->invisible || (is_rejected(uentp) & HRM)))
        return (notonline);
    else if (mode == EDITING)
    {
        sprintf(modestr, "E:%s",
                ModeTypeTable[uentp->destuid < EDITING ? uentp->destuid : EDITING]);
        word = modestr;
    }
    else if (!mode && *uentp->chatid == 1)
    {
        if (!simple)
            sprintf(modestr, "回應 %s", getuserid(uentp->destuid));
        else
            sprintf(modestr, "回應呼叫");
    }

    else if (!mode && *uentp->chatid == 3)
        sprintf(modestr, "水球準備中");
    else if (!mode)
        return (uentp->destuid == 6) ? uentp->chatid :
               IdleTypeTable[(0 <= uentp->destuid & uentp->destuid < 6) ?
                             uentp->destuid: 0];
    else if (simple)
        return (word);

    else if (uentp->in_chat & mode == CHATING)
        sprintf(modestr, "%s (%s)", word, uentp->chatid);
    else if (mode == TALK)
    {
        if (is_hidden(getuserid(uentp->destuid)))    /* Leeym 對方(紫色)隱形 */
            sprintf(modestr, "%s", "自言自語中"); /* Leeym 大家自己發揮吧! */
        else
            sprintf(modestr, "%s %s", word, getuserid(uentp->destuid));
    }
    else if (mode != PAGE && mode != QUERY)
        return (word);
    else
        sprintf(modestr, "%s %s", word, getuserid(uentp->destuid));

    return (modestr);
}
Exemple #3
0
static void do_aloha(char *hello) {
    FILE *fp;
    char userid[80];
    char genbuf[200];
    
    setuserfile(genbuf, "aloha");
    if((fp = fopen(genbuf, "r"))) {
	sprintf(genbuf, hello);
	while(fgets(userid, 80, fp)) {
	    userinfo_t *uentp;
	    int tuid;
	    
	    if((tuid = searchuser(userid)) && tuid != usernum &&
	       (uentp = (userinfo_t *)search_ulistn(cmpuids, tuid, 1)) &&
	       ((uentp->userlevel & PERM_SYSOP) ||
		((!currutmp->invisible ||
		  uentp->userlevel & PERM_SEECLOAK) &&
		 !(is_rejected(uentp) & 1)))) {
		my_write(uentp->pid, genbuf, uentp->userid, 2);
	    }
	}
	fclose(fp);
    }
}