示例#1
0
文件: chat.c 项目: wyat/kbs
/*
int printuserent(chatcontext * pthis, struct user_info *uentp)
{
    static char uline[256];
    static int cnt;
    char pline[50];

    if (!uentp) {
        if (cnt)
            printchatline(pthis, uline);
        bzero(uline, 256);
        cnt = 0;
        return 0;
    }
    if (!uentp->active || !uentp->pid)
        return 0;
    if (!HAS_PERM(getCurrentUser(), PERM_SEECLOAK) && uentp->invisible)
        return 0;
#if 0
    if (kill(uentp->pid, 0) == -1)
        return 0;
#endif
    sprintf(pline, " %s%-13s\033[m%c%-10s",
            myfriend(uentp->uid, NULL) ? "\033[32m" : "", uentp->userid,
            uentp->invisible ? '#' : ' ', modestring(uentp->mode,
                                                     uentp->destuid, 0,
                                                     NULL));
    if (cnt < 2)
        strcat(pline, "│");
    strcat(uline, pline);
    if (++cnt == 3) {
        printchatline(pthis, uline);
        memset(uline, 0, 256);
        cnt = 0;
    }
    return 0;
}
*/
int print_friend_ent(struct user_info *uentp, chatcontext * pthis, int pos)
{                               /* print one user & status if he is a friend */
    char pline[50],buf[80];

    if (!uentp->active || !uentp->pid)
        return 0;
    if (!HAS_PERM(getCurrentUser(), PERM_SEECLOAK) && uentp->invisible)
        return 0;
#if 0
    if (kill(uentp->pid, 0) == -1)
        return 0;
#endif                          /* 
    */
    if (!myfriend(uentp->uid, NULL,getSession()))
        return 0;
    sprintf(pline, " %-13s%c%-10s", uentp->userid,
            uentp->invisible ? '#' : ' ', modestring(buf,uentp->mode,
                    uentp->destuid, 0,
                    NULL));
    if (pthis->apply_count < 2)
        strcat(pline, "│");
    strcat(pthis->apply_buf, pline);
    if (pthis->apply_count == 2) {
        printchatline(pthis, pthis->apply_buf);
        memset(pthis->apply_buf, 0, 256);
        pthis->apply_count = 0;
    } else
        pthis->apply_count++;
    return COUNT;
}
示例#2
0
文件: chat.c 项目: wyat/kbs
int chat_status(struct user_info *uentp, chatcontext * pthis)
{
    char tmpstr[31],buf[80],buf2[80];
    char *lpTmp;

    if (strlen(genbuf)>t_columns)
        return QUIT;
    if (uentp->invisible == 1) {
        if (HAS_PERM(getCurrentUser(), PERM_SEECLOAK)) {
            sprintf(genbuf + strlen(genbuf), "\x1b[32m#\x1b[m");
        } else
            return 0;
    }
    lpTmp = (char *) idle_str(buf,uentp);
    if (uentp->in_chat) {       /* add by Luzi 1997.11.18 */
        int res;

        sprintf(tmpstr, "/q %s", uentp->userid);
        chat_send(pthis, tmpstr);
        res = chat_recv(pthis, tmpstr, 30);
        if (res <= 0)
            return -1;
        tmpstr[res] = '\0';
        if (tmpstr[0] == '1') {
            sprintf(genbuf + strlen(genbuf), "'%s' room as '%s'",
                    tmpstr + 1, uentp->chatid);
            if (lpTmp[0] != ' ')
                sprintf(genbuf + strlen(genbuf), "[%s];", lpTmp);
            else
                strcat(genbuf, " ;");
            return COUNT;
        }
    }
    sprintf(genbuf, "%s%-8s", genbuf, modestring(buf2,uentp->mode, uentp->destuid, 0,        /* 1->0 不显示聊天对象等 modified by dong 1996.10.26 */
            (uentp->in_chat ? uentp->
             chatid : NULL)));
    if (lpTmp[0] != ' ')
        sprintf(genbuf + strlen(genbuf), "[%s];", lpTmp);
    else
        strcat(genbuf, " ;");
    return COUNT;
}
示例#3
0
static void printinfo(ICQ_SERVER_REC *server, const char *nick)
{
	const char *uin;
	guint32 ip;
	char *numip;
	const char *mode;
	int code;

	uin = buddy_getuin(nick);
	code = buddy_getmode(uin);
	if (code_restrict >= 0 && code_restrict != code)
		return;
	nick = buddy_getalias(uin);
	ip = buddy_getip(uin);
	numip = g_strdup_printf("%d.%d.%d.%d", ip>>24, (ip>>16)&255, (ip>>8)&255, ip&255);
	mode = modestring(code);

	printformat(server, uin, MSGLEVEL_CRAP, ICQTXT_WHO, nick, uin, numip, mode);

	g_free(numip);
}
示例#4
0
文件: kmp.c 项目: PichuChen/formosa
int ParseKMP(char *cmd, REQUEST_REC *r)
{

	char kmp[STRLEN], proto[STRLEN], data[STRLEN], arg1[STRLEN], arg2[STRLEN], arg3[STRLEN], arg4[STRLEN];
	int result;
	*proto = *data = *arg1 = *arg2 = *arg3 = *arg4 = 0x00;

	sscanf(cmd, "%s\t%s\t%s\t%s\t%s\t%s",
		kmp, proto, arg1, arg2, arg3, arg4);

#if 0
	fprintf(fp_out, "[%s]\r\n", cmd);
	fprintf(fp_out, "arg1=%s, arg2=%s, arg3=%s, arg4=%s\r\n",
		arg1, arg2, arg3, arg4);
	fflush(fp_out);
#endif

	if(!strcmp(proto, "USERNEW"))
	{
		sprintf(data, "ID=%s&PASSWORD=%s&PASSWORD1=%s&NICKNAME=%s&EMAIL=%s",
			arg1, arg2, arg2, arg3, arg4);

		result = NewUser(data, &curuser);

		if(result != WEB_OK)
		{
			if(strstr(WEBBBS_ERROR_MESSAGE, "帳號已存在") != NULL)
				fprintf(fp_out, "622  使用者帳號已存在\r\n");
			else
				fprintf(fp_out, "721  註冊失敗\r\n");
		}
		else
			fprintf(fp_out, "800  OK!!\r\n");
	}
	else if(!strcmp(proto, "USERQUERY"))
	{
		if (!get_passwd(&curuser, arg1))
		{
			bzero(&curuser, sizeof(USEREC));
			fprintf(fp_out, "621  使用者帳號不存在\r\n");
		}
		else
		{
			USER_INFO *quinf;
			char user_status[1024];

			if ((quinf = search_ulist(cmp_userid, curuser.userid)) && !(quinf->invisible))
			{
				sprintf(user_status, "線上狀態: %s, 呼喚鈴: %s.",
					modestring(quinf, 1),
					(quinf->pager != PAGER_QUIET) ? MSG_ON : MSG_OFF);
			}
			else
				sprintf(user_status, "目前不在線上");

			fprintf(fp_out, "800  OK!!\r\n");
			fprintf(fp_out, "%s\t%s\t%d\t%d\t%d\t%d\t%d\t%s\t%s\r\n",
				curuser.userid,
				curuser.username,
				curuser.userlevel,
				curuser.ident,
				curuser.numlogins,
				curuser.numposts,
				(int)curuser.lastlogin,
				curuser.lasthost,
				user_status);
		}
	}
	else if(!strcmp(proto, "USERDATA"))
	{
		if(!get_passwd(&curuser, arg1))
			bzero(&curuser, sizeof(USEREC));
		if(CheckUserPassword(arg1, arg2)!=Correct)
			fprintf(fp_out, "724  密碼錯誤\r\n");
		else
		{
			fprintf(fp_out, "800  OK!!\r\n");
			fprintf(fp_out, "%d\t%s\t%s\t%d\t%d\t%d\t%s\t%d\t%s\r\n",
				curuser.uid,
				curuser.userid,
				curuser.username,
				curuser.userlevel,
				curuser.numlogins,
				curuser.numposts,
				curuser.lasthost,
				curuser.lastctype,
				curuser.email);
		}
	}
	else if(!strcmp(proto, "USERPLAN"))
	{
		if (!get_passwd(&curuser, arg1))
		{
			bzero(&curuser, sizeof(USEREC));
			fprintf(fp_out, "621  使用者帳號不存在\r\n");
		}
		else
		{
			char userfile[PATHLEN];

			sethomefile(userfile, curuser.userid, UFNAME_PLANS);
			if(isfile(userfile))
			{
				fprintf(fp_out, "800  OK!!\r\n");
				ShowArticle(userfile, FALSE, FALSE);
			}
			else
			{
				fprintf(fp_out, "761  使用者無名片檔\r\n");
			}
		}
	}
	else if(!strcmp(proto, "USERLIST"))
	{
		int start = 0, end = 0;

		if(*arg1)
			start = atoi(arg1);
		if(*arg2)
			end = atoi(arg2);

	#if 0
		fprintf(fp_out, "%p %p", post_file, &post_file);
		fflush(fp_out);
	#else
		post_file->list_start = start;
		post_file->list_end = end;
		ShowUserList("KMP", post_file);
	#endif
	}
#if 0
	else if(!strcmp(proto, "USERLOGIN"))
	{
		result = user_login(&cutmp, &curuser, CTYPE_WEBBBS, arg1, arg2,
			       r->fromhost);
		if (result == ULOGIN_OK)
		{
			memcpy(&uinfo, cutmp, sizeof(USER_INFO));
			break;
		}
		else if (result == ULOGIN_PASSFAIL)
		{
			outs(_msg_formosa_27);
			continue;
		}
		outs(_msg_formosa_44);


	}
#endif

	return WEB_OK;

}
示例#5
0
文件: mad.c 项目: mvd7793/RED-SIREN
enum mad_flow read_header(void *data, struct mad_header const * header)
{
    char long_currenttime_str[14]; /* this *will* fill if you're using 100000+ minute mp3s */
    char long_remaintime_str[14];
    static int frames_played = 0;
    
    buffer *playbuf = (buffer *)data;
    mad_timer_t time_remaining;
    char *ao_time;

    if (stop_playing_file)
    {
        stop_playing_file = 0;
        status = MPG321_STOPPED;
        return MAD_FLOW_STOP;
    }
    
    if(options.opt & MPG321_REMOTE_PLAY)
    {
        enum mad_flow mf;

        /* We might have to stop if the user inputs something */
        if ((mf = remote_get_input_nowait(playbuf)))
            return mf;
    }

    /* Stop playing if -n is used, and we're at the frame specified. */
    if ((playbuf->max_frames != -1) && (frames_played++ > playbuf->max_frames))
    {
        frames_played = 0;
        status = MPG321_STOPPED;
	if(options.opt & MPG321_ENABLE_BUFFER) Decoded_Frames->done = 1;
	//fprintf(stderr,"Total D: %d\n",Decoded_Frames->total_decoded_frames);
        return MAD_FLOW_STOP;
    }

    current_frame++;

    mad_timer_add(&current_time, header->duration);

    if(options.opt & MPG321_USE_SCROBBLER && scrobbler_time > 0 && scrobbler_time < current_time.seconds)
    {
	    scrobbler_time = -1;
	    scrobbler_report();
    }

    if(options.opt & (MPG321_VERBOSE_PLAY | MPG321_REMOTE_PLAY))
    {
        mad_timer_string(current_time, long_currenttime_str, "%.2u:%.2u.%.2u", MAD_UNITS_MINUTES,
                            MAD_UNITS_CENTISECONDS, 0);

        if (mad_timer_compare(playbuf->duration, mad_timer_zero) == 0)
            time_remaining = current_time;
        else
            time_remaining = playbuf->duration;


        mad_timer_negate(&current_time);

        mad_timer_add(&time_remaining, current_time);
        mad_timer_negate(&current_time);

        mad_timer_string(time_remaining, long_remaintime_str, "%.2u:%.2u.%.2u", MAD_UNITS_MINUTES,
                            MAD_UNITS_CENTISECONDS, 0);
    }
                        
    /* update cached table of frames & times */
    if (current_frame <= playbuf->num_frames) /* we only allocate enough for our estimate. */
    {
        playbuf->frames[current_frame] = playbuf->frames[current_frame-1] + (header->bitrate / 8 / 1000)
            * mad_timer_count(header->duration, MAD_UNITS_MILLISECONDS);
        playbuf->times[current_frame] = current_time;
    }
    
    if (file_change)
    {
        file_change = 0;
        if (options.opt & MPG321_REMOTE_PLAY)
        {
            printf("@S %s %d %d %s %d %ld %d %d %d %d %ld %d\n",versionstring(header->flags), header->layer, header->samplerate,
                modestringucase(header->mode), header->mode_extension, 
                (header->bitrate / 8 / 100) * mad_timer_count(header->duration, MAD_UNITS_CENTISECONDS),
                MAD_NCHANNELS(header), header->flags & MAD_FLAG_COPYRIGHT ? 1 : 0, 
                header->flags & MAD_FLAG_PROTECTION ? 1 : 0, header->emphasis,
                header->bitrate/1000, header->mode_extension);
        }    

        else if (options.opt & MPG321_VERBOSE_PLAY)/*zip it good*/
        {
            fprintf(stderr, "MPEG %s, Layer: %s, Freq: %d, mode: %s, modext: %d, BPF : %ld\n"
                    "Channels: %d, copyright: %s, original: %s, CRC: %s, emphasis: %d.\n"
                    "Bitrate: %ld Kbits/s, Extension value: %d\n"
                    "Audio: 1:1 conversion, rate: %d, encoding: signed 16 bit, channels: %d\n",
                    versionstring(header->flags),layerstring(header->layer), header->samplerate, modestringucase(header->mode), header->mode_extension, 
                    (header->bitrate / 100) * mad_timer_count(header->duration, MAD_UNITS_CENTISECONDS),
                    MAD_NCHANNELS(header), header->flags & MAD_FLAG_COPYRIGHT ? "Yes" : "No",
                    header->flags & MAD_FLAG_ORIGINAL ? "Yes" : "No", header->flags & MAD_FLAG_PROTECTION ? "Yes" : "No",
                    header->emphasis, header->bitrate/1000, header->mode_extension,
                    header->samplerate, MAD_NCHANNELS(header));
        }

        else if (!(options.opt & MPG321_QUIET_PLAY))/*I love Joey*/
        {
            fprintf(stderr, "MPEG %s layer %s, %ld kbit/s, %d Hz %s\n",
                versionstring(header->flags),layerstring(header->layer), header->bitrate/1000, header->samplerate, modestring(header->mode));
        }
    }
    
    if (status == MPG321_SEEKING && options.seek)
    {
        if (!--options.seek)
            status = MPG321_PLAYING;

        return MAD_FLOW_IGNORE;
    }
    else
    {
        status = MPG321_PLAYING;
    }

    if(!(options.opt & MPG321_ENABLE_BUFFER))
    {
	    if(count > 0)
	    {
		    count++;
		    if(count > 40)
		    {
			    if(!(options.opt & MPG321_VERBOSE_PLAY))
				    fprintf(stderr,"                \r");
			    count = -1;
			    fflush(stderr);
		    }
	    }
    }

    if(options.opt & MPG321_ENABLE_BUFFER)
    {
	    ao_time = (Output_Queue+mad_decoder_position)->time;
	    (Output_Queue+mad_decoder_position)->num_frames = playbuf->num_frames - current_frame;
	    if(Decoded_Frames->is_file) (Output_Queue+mad_decoder_position)->seconds = time_remaining.seconds;
    }

    if (options.opt & MPG321_VERBOSE_PLAY)
    {
        if (!options.skip_printing_frames 
            || (options.skip_printing_frames && !(current_frame % options.skip_printing_frames)))
   
	      	if(count > 0)
		{
/*			if(options.opt & MPG321_ENABLE_BUFFER)
			{	
				sprintf(ao_time, "Frame# %5lu [%5lu], Time: %s [%s], \r", current_frame,
					playbuf->num_frames > 0 ? playbuf->num_frames - current_frame : 0, long_currenttime_str, long_remaintime_str);
				//sprintf(ao_time, "Frame# %5lu [%5lu], Time: %s [%s], \r", current_frame,
				//	playbuf->num_frames > 0 ? playbuf->num_frames - current_frame : 0, long_currenttime_str, long_remaintime_str);
				//sprintf(ao_time, "Volume: %d%%  Frame# %5lu [%5lu], Time: %s [%s], \r",volume, current_frame,
				//	playbuf->num_frames > 0 ? playbuf->num_frames - current_frame : 0, long_currenttime_str, long_remaintime_str);
			}else*/
			{
				fprintf(stderr, "Volume: %d%%  Frame# %5lu [%5lu], Time: %s [%s], \r",volume, current_frame,
					playbuf->num_frames > 0 ? playbuf->num_frames - current_frame : 0, long_currenttime_str, long_remaintime_str);
			}
		}
		else if(count < 0)
		{
			if(options.opt & MPG321_ENABLE_BUFFER)
			{
//				sprintf(ao_time, "Frame# %5lu [%5lu], Time: %s [%s],                     \r", current_frame,
				sprintf(ao_time, "Frame# %5lu [%5lu], Time: %s [%s],                 \r", current_frame,
					playbuf->num_frames > 0 ? playbuf->num_frames - current_frame : 0, long_currenttime_str, long_remaintime_str);
			}
			else
			{
				
				fprintf(stderr, "Frame# %5lu [%5lu], Time: %s [%s],                      \r", current_frame,
					playbuf->num_frames > 0 ? playbuf->num_frames - current_frame : 0, long_currenttime_str, long_remaintime_str);
			}
		}
    }
    else if (options.opt & MPG321_REMOTE_PLAY)
    {
    
	    if (!options.skip_printing_frames 
            || (options.skip_printing_frames && !(current_frame % options.skip_printing_frames)))
	    {
		    if(options.opt & MPG321_ENABLE_BUFFER)
		    {
			    sprintf(ao_time,"@F %ld %ld %.2f %.2f\n", current_frame, playbuf->num_frames - current_frame,
				    	    ((double)mad_timer_count(current_time, MAD_UNITS_CENTISECONDS)/100.0),
			    		    ((double)mad_timer_count(time_remaining, MAD_UNITS_CENTISECONDS)/100.0));
		    }
		    else
		    {

			    fprintf(stderr,"@F %ld %ld %.2f %.2f\n", current_frame, playbuf->num_frames - current_frame,
				    	    ((double)mad_timer_count(current_time, MAD_UNITS_CENTISECONDS)/100.0),
			    		    ((double)mad_timer_count(time_remaining, MAD_UNITS_CENTISECONDS)/100.0));
		    }
	    }
    }
    return MAD_FLOW_CONTINUE;
}        
示例#6
0
文件: io.c 项目: chage/formosa
int igetch()
{
#ifdef _BBS_UTIL_
igetagain:
	if (ibufsize == icurrchar)
	{
		fd_set readfds;
		int sr;

		FD_ZERO(&readfds);
		FD_SET(0, &readfds);
		refresh();
		while ((sr = select(16, &readfds, NULL, NULL, NULL)) < 0)	/* bug fixed */
		{
			if (errno == EINTR)
				continue;
			else
			{
				perror("select");
				fprintf(stderr, "abnormal select conditions\n");
				return -1;
			}
		}
		while ((ibufsize = read(0, inbuf, IBUFSIZE)) <= 0)
		{
			if (ibufsize < 0 && errno == EINTR)
				continue;
			exit(0);
		}
		icurrchar = 0;
	}

	if (inbuf[icurrchar] == CTRL('L'))
	{
#ifdef USE_PFTERM
		redrawwin();
		refresh();
#else
		redoscr();
#endif
		icurrchar++;
		goto igetagain;
	}
/*
	else if (inbuf[icurrchar] == 0x0d)
	{
		icurrchar++;
		return '\n';
	}
*/
	return inbuf[icurrchar++];
#else
      igetagain:
	if (ibufsize == icurrchar)
	{
		int sr;
		struct pollfd pd[2];
		char npd;

#if 1	/* !! TEST !! */
		if (dumb_term)
			oflush();
		else
			refresh();
#endif
		if (flushf)
			(*flushf) ();

		pd[0].fd = 0;
		pd[0].events = POLLIN;
		pd[1].events = POLLIN;
		for (;;)
		{
			pd[0].revents = 0;
			if (i_newfd)
			{
				npd = 2;
				pd[1].fd = i_newfd;
				pd[1].revents = 0;
			}
			else
				npd = 1;
			sr = poll(pd, npd, 60000);
			if (sr < 0)
			{
				if (errno != EINTR)
				{
					perror("select");
					fprintf(stderr, "abnormal select conditions\n");
					return -1;
				}
			}
			else if (sr == 0)
			{
				if (i_top == &i_to)
					return I_TIMEOUT;
				if (uinfo.idle_time++ > IDLE_TIMEOUT)
				{
					if (!HAS_PERM(PERM_SYSOP))	/* lthuang */
					{
#ifdef BBSLOG_IDLEOUT
						bbsd_log_write("IDLEOUT", "%s", modestring(&uinfo, 0));
#endif
						clear();
						show_byebye(TRUE);
						refresh();
						abort_bbs(0);
					}
				}
				update_ulist(cutmp, &uinfo);
			}
			else
				break;
		}	/* for loop */
		if (i_newfd && (pd[1].events & pd[1].revents))
			return I_OTHERDATA;
		if (!(pd[0].events & pd[0].revents))
			goto igetagain;

		int len;
		do {
			len = tty_read(inbuf, IBUFSIZE);
#ifdef DBG_OUTRPT
			// if (0)
			{
				static char xbuf[128];
				sprintf(xbuf, ESC_STR "[s" ESC_STR "[2;1H [%ld] "
					ESC_STR "[u", len);
				write(1, xbuf, strlen(xbuf));
				fsync(1);
			}
#endif

		} while (len <= 0);
		ibufsize = len;

		icurrchar = 0;
	}

	i_top->tv_sec = 60;
	if(uinfo.idle_time)
	{
		uinfo.idle_time &= ~(uinfo.idle_time);
		update_ulist(cutmp, &uinfo);
	}

	if (inbuf[icurrchar] == CTRL('L'))
	{
		redoscr();
		icurrchar++;
		goto igetagain;
	}
	else if (inbuf[icurrchar] == 0x0d)
	{
		icurrchar++;
		if (init_enter)
		{
			if (two_enter)
				press_enter++;
			return KEY_ENTER;
		}
		else
		{
			press_enter++;
			return KEY_ENTER;
		}
	}
	else
	{
		if (press_enter)
		{
			if (init_enter)
			{
				press_enter &= ~press_enter;
				if (inbuf[icurrchar] == '\0' || inbuf[icurrchar] == 0x0a)
				{
					icurrchar++;
					goto igetagain;
				}
			}
			else
			{
				init_enter++;
				press_enter &= ~press_enter;
				if (inbuf[icurrchar] == '\0' || inbuf[icurrchar] == 0x0a)
				{
					two_enter++;
					icurrchar++;
					goto igetagain;
				}
				else
					two_enter &= ~two_enter;
			}
		}
	}
	return inbuf[icurrchar++];
#endif	/* !_BBS_UTIL_ */
}
示例#7
0
文件: user.c 项目: wtj/formosa
/*******************************************************************
 *	顯示 <BBS_User_xxxxx> TAG
 *	目前 UserQuery ,UserData 用的TAG一樣, 靠URLParaType區分 
 *
 *	in UserQuery mode , curuser is target for query, not original userdata
 *******************************************************************/
void 
ShowUser(char *tag, USEREC * curuser)
{
	if (request_rec->URLParaType != UserQuery && PSCorrect != Correct)
		return;

	if (!strcasecmp(tag, "ID"))
	{
		fputs(curuser->userid, fp_out);
	}
	else if (!strcasecmp(tag, "Name"))
	{
		char buf[STRLEN];
#if defined(NSYSUBBS1)
		if (request_rec->URLParaType == UserQuery && curuser->ident != 7)
			fputs("中山遊客", fp_out);
		else
#endif	
		{
			xstrncpy(buf, curuser->username, STRLEN);
			fputs(buf, fp_out);
		}
	}
	else if (!strcasecmp(tag, "Level"))
	{
		fprintf(fp_out, "%d", curuser->userlevel);
	}
	else if (!strcasecmp(tag, "Login"))
	{
		fprintf(fp_out, "%d", curuser->numlogins);
	}
	else if (!strcasecmp(tag, "Post"))
	{
		fprintf(fp_out, "%d", curuser->numposts);
	}
#ifdef USE_IDENT
	else if (!strcasecmp(tag, "Ident"))
		{
		fputs(curuser->ident == 7 ? MSG_HasIdent : MSG_NotIdent, fp_out);
	}
#endif
	else if (!strcasecmp(tag, "LastLogin"))
	{
		fputs(Ctime(&(curuser->lastlogin)), fp_out);
	}
	else if (!strcasecmp(tag, "LastHost"))
	{
		fputs(curuser->lasthost, fp_out);
	}
	else if (!strcasecmp(tag, "NewMail"))
	{
		if (curuser->flags[0] & FORWARD_FLAG)
			fputs(MSG_MailForwardON, fp_out);
		else if (!strcmp(curuser->userid, "guest"))
			fputs(MSG_MailHasRead, fp_out);
		else
		{
			if ((request_rec->URLParaType != UserQuery && PSCorrect != Correct)
				|| !CheckNewmail(curuser->userid, TRUE))
			{
				fputs(MSG_MailHasRead, fp_out);
			}
			else
			{
				fputs(MSG_MailNotRead, fp_out);
			}
		}
	}
	else if (!strcasecmp(tag, "Status"))	/* print user online status */
	{
		USER_INFO *quinf;

		if ((quinf = search_ulist(cmp_userid, curuser->userid)) && !(quinf->invisible))
		{
			fprintf(fp_out, "線上狀態: %s, 呼喚鈴: %s.",
				modestring(quinf, 1),
				(quinf->pager != PAGER_QUIET) ? MSG_ON : MSG_OFF);
		}				
		else
			fprintf(fp_out, "目前不在線上");
	}
	else if (!strcasecmp(tag, "Plan"))
	{
		char userfile[PATHLEN];

		sethomefile(userfile, curuser->userid, UFNAME_PLANS);
		if (request_rec->URLParaType == UserData)
			ShowArticle(userfile, FALSE, FALSE);
		else
			ShowArticle(userfile, FALSE, TRUE);
	}
	else
	{
		if (request_rec->URLParaType == UserQuery)	/* bug fixed */
			return;
			
		if (!strcasecmp(tag, "Email"))
		{
			fputs(curuser->email, fp_out);
		}
		else if (!strcasecmp(tag, "MailForward"))	/* use in UserData only */
		{
			fputs(curuser->flags[0] & FORWARD_FLAG ? "ON" : "OFF", fp_out);
		}
		else if (!strcasecmp(tag, "Friend"))
		{
			char userfile[PATHLEN];

			sethomefile(userfile, curuser->userid, UFNAME_OVERRIDES);
			ShowArticle(userfile, FALSE, TRUE);
		}
		else if (strstr(tag, "Sign"))
		{
			FILE *fp;
			char fname[PATHLEN];

			sethomefile(fname, curuser->userid, UFNAME_SIGNATURES);
			if ((fp = fopen(fname, "r")) != NULL)
			{
				int line = 0, num;			
				char buffer[512];
				
				GetPara3(buffer, "NUM", tag, 3, "-1");
				num = atoi(buffer);

				for (line = 0; line < num * MAX_SIG_LINES 
						&& fgets(buffer, sizeof(buffer), fp); line++)
				{
					if (line < (num - 1) * MAX_SIG_LINES)
						continue;
					fprintf(fp_out, "%s", buffer);
				}

				fclose(fp);
			}
		}
	}
}