• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ HAS_PERM函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中HAS_PERM函数的典型用法代码示例。如果您正苦于以下问题:C++ HAS_PERM函数的具体用法?C++ HAS_PERM怎么用?C++ HAS_PERM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了HAS_PERM函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: full_user_list

static int full_user_list(struct user_info *uentp, struct fulluserlistarg* arg,int count)
{
    struct user_info userinfo=*uentp;
    struct userec *lookupuser;
    zval* element;
    if (!userinfo.active || !userinfo.pid) {
        return 0;
    }
    if (!HAS_PERM(getCurrentUser(), PERM_SEECLOAK) && userinfo.invisible && strcmp(userinfo.userid, getCurrentUser()->userid)) {
        /*Haohmaru.99.4.24.让隐身者能看见自己 */
        return 0;
    }
    if (count+1<arg->start)
        return COUNT;
    if (count+1-arg->start>=arg->num)
        return QUIT;
    MAKE_STD_ZVAL ( element );
    array_init ( element );

    add_assoc_bool ( element, "invisible", userinfo.invisible );
    add_assoc_long ( element, "pid", userinfo.pid );
    add_assoc_bool ( element, "isfriend", isfriend(userinfo.userid) );
    add_assoc_string ( element, "userid", userinfo.userid, 1 );
    add_assoc_string ( element, "username", userinfo.username, 1 );
    if( getuser(userinfo.userid, &lookupuser) == 0 ) lookupuser=NULL;
    add_assoc_string ( element, "userfrom", HAS_PERM(getCurrentUser(), PERM_SYSOP)? userinfo.from: SHOW_USERIP(lookupuser, userinfo.from), 1 );
    add_assoc_string ( element, "mode", ModeType(userinfo.mode), 1 );
    add_assoc_long ( element, "idle", (long)(time(0) - userinfo.freshtime)/60 );
    
    zend_hash_index_update(Z_ARRVAL_P(arg->return_value), count+1-arg->start, (void *) &element, sizeof(zval *), NULL);
    return COUNT;
}
开发者ID:marvelliu,项目名称:lilacsrc,代码行数:32,代码来源:phpbbs.session.c


示例2: u_exit

void u_exit(char *mode) {
    userec_t xuser;
    int diff = (time(0) - login_start_time) / 60;

    passwd_query(usernum, &xuser);
    
    auto_backup();
    
    setflags(PAGER_FLAG, currutmp->pager != 1);
    setflags(CLOAK_FLAG, currutmp->invisible);
    
    xuser.invisible = currutmp->invisible % 2;
    xuser.pager = currutmp->pager % 5;
    
    if(!(HAS_PERM(PERM_SYSOP) && HAS_PERM(PERM_DENYPOST)))
	do_aloha("<<下站通知>> -- 我走囉!");
    
    purge_utmp(currutmp);
    if((cuser.uflag != enter_uflag) || (currmode & MODE_DIRTY) || !diff) {
	xuser.uflag = cuser.uflag;
	xuser.numposts = cuser.numposts;
	if(!diff && cuser.numlogins)
	    xuser.numlogins = --cuser.numlogins; /* Leeym 上站停留時間限制式 */
	reload_money();
	passwd_update(usernum, &xuser);
    }
    log_usies(mode, NULL);
}
开发者ID:YanlongLai,项目名称:Program,代码行数:28,代码来源:mbbsd.c


示例3: main

int main()
{
        FILE *fp;
        char board[80], dir[80], *ptr, flag[80];
        struct shortfile *x1;
        struct fileheader x;
        int i, start, total, my_t_lines=0, chart=0, showhead=0;
        init_all();
        strsncpy(board, getparm("board"), 32);
        my_t_lines=atoi(getparm("my_t_lines"));
        if(my_t_lines<10 || my_t_lines>40)
                my_t_lines=20;
        x1=getbcache(board);
        if(x1==0)
                http_fatal("错误的讨论区");
        strcpy(board, x1->filename);
        board_ban_ip(board);
        if (!canenterboard (currentuser.userid, board) && !HAS_PERM(PERM_SYSOP))
                http_fatal ("您已经被取消进入本板的权限");
        if(!has_read_perm(&currentuser, board) && !HAS_PERM(PERM_SYSOP))
                http_fatal("错误的讨论区");
        if(!has_BM_perm(&currentuser, board))
                http_fatal("您没有权限访问本页");

        modify_mode(u_info,READING);	//bluetent
        sprintf(dir, "boards/%s/.DIR", board);
        fp=fopen(dir, "r");
        if(fp==0)
                http_fatal("错误的讨论区目录");
        total=file_size(dir)/sizeof(struct fileheader);
        start=atoi(getparm("start"));
        if(strlen(getparm("start"))==0 || start>total-my_t_lines)
                start=total-my_t_lines;
        if(start<0)
                start=0;
        printf("<nobr><center>\n");
        strcpy(u_info->board, board);
        /*	printf("%s -- [讨论区: %s] 板主[%s] 文章数[%d]<hr color=green>\n",
        		BBSNAME, board, userid_str(x1->BM), total);
        	if(total<=0) http_fatal("本讨论区目前没有文章");
        	printf("<form name=form1 method=post action=bbsman>\n");
              	printf("<table width=613>\n");
              	printf("<tr><td>序号<td>管理<td>状态<td>作者<td>日期<td>标题\n");
        	fseek(fp, start*sizeof(struct fileheader), SEEK_SET);*/
        printf("<script language=JavaScript>\
               \
               function MM_jumpMenu(selObj){\
               eval(\"window.location='\"+selObj.options[selObj.selectedIndex].value+\"'\");\
       }\
               function SubmitFlag(flagmode){\
               document.form1.mode.value=flagmode;\
               document.form1.submit();\
       }\
       function selrange(x)\
       {if(event.shiftKey){var min=x;var max=document.getElementById('lastsel').value;if(min>max){var tmp=min;min=max;max=tmp;}var stt=document.getElementById('chk'+x).checked;for(var i=min;i<=max;i++)document.getElementById('chk'+i).checked=stt;}document.getElementById('lastsel').value=x;}\
               </script>\
开发者ID:madoldman,项目名称:inankai_bbs,代码行数:56,代码来源:bbsmdoc.c


示例4: user_switchcase

int user_switchcase()
{
        char newuserid[IDLEN+2];
        modify_user_mode(USERDEF);
        clear();
        if (count_user( )>1)
        {
                move(1,0);
                prints("��Ŀǰ��login��ֹһ��,���˳�����login������һ��\n");
                pressreturn();
                clear();
                return 1;
        }
        if(HAS_PERM(PERM_BOARDS)){
                move(1,0);
                prints("�Բ���Ŀǰ��֧�ְ����޸��û�����Сд��������ϵ����������Ա,\n");
                prints("�������а���Ȼ������޸ģ���������������");
                pressreturn();
                clear();
                return 1;
        }
        getdata(0, 0, "�������µ��ʺ����� (Enter User ID): ",
                        newuserid, IDLEN + 1, DOECHO, YEA);
        if(newuserid[0] == '\0'){
                clear();
                return 0;
        }
        if(!strcmp(currentuser.userid, newuserid)){
                clear();
                return 0;
        }
        if(strcasecmp(currentuser.userid, newuserid)){
               move(1,0);
                prints("�µ��ʺ����ƺ�ԭ���ʺŲ�ͬ������ܸı��ʺŵĴ�Сд��");
                pressreturn();
                clear();
                return 1;
        }
		if(HAS_PERM(PERM_PERSONAL))
	        dig_user_switchcase(newuserid);
		sprintf(genbuf,"mv %s/home/%C/%s %s/home/%C/%s",
				BBSHOME, toupper(currentuser.userid[0]),currentuser.userid,
				BBSHOME, toupper(newuserid[0]), newuserid);
		system(genbuf);
		sprintf(genbuf,"mv %s/mail/%C/%s %s/mail/%C/%s",
				BBSHOME, toupper(currentuser.userid[0]),currentuser.userid,
				BBSHOME, toupper(newuserid[0]), newuserid);
		system(genbuf);
        strcpy(currentuser.userid, newuserid);
        strcpy(uinfo.userid, newuserid);
        substitute_record(PASSFILE, &currentuser, sizeof(currentuser), usernum);
        move(5,10);
        prints("�޸��ʺŴ�Сд�ɹ���");
        pressreturn();
        return 0;
}
开发者ID:madoldman,项目名称:inankai_bbs,代码行数:56,代码来源:userinfo.c


示例5: modestring

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);
}
开发者ID:yrchen,项目名称:Athena,代码行数:52,代码来源:talk.c


示例6: u_exit

void 
u_exit(char *mode)
{
	extern void	auto_backup();	/* 編輯器自動備份 */
	userec		xuser;
	int		diff = (time(0) - login_start_time) / 60;

	rec_get(fn_passwd, &xuser, sizeof(xuser), usernum);
	auto_backup();
	setflags(PAGER_FLAG, currutmp->pager != 1);
	setflags(CLOAK_FLAG, currutmp->invisible);
	xuser.pager = currutmp->pager;	/* 記錄pager狀態, add by wisely */
	xuser.invisible = currutmp->invisible;	/* 紀錄隱形狀態 by wildcat */
	xuser.totaltime += time(0) - update_time;
	xuser.numposts = cuser.numposts;
	xuser.feeling[4] = '\0';

	if (!HAS_PERM(PERM_DENYPOST) && !currutmp->invisible) {
		char		buf       [256];
		time_t		now;

		time(&now);
		sprintf(buf, "<<下站通知>> -- 我走囉! - %s", Etime(&now));
		do_aloha(buf);
	}
	purge_utmp(currutmp);
	if (!diff && cuser.numlogins > 1 && strcmp(cuser.userid, STR_GUEST))
		xuser.numlogins = --cuser.numlogins;	/* Leeym 上站停留時間限制式 */
	substitute_record(fn_passwd, &xuser, sizeof(userec), usernum);
	log_usies(mode, NULL);
}
开发者ID:yrchen,项目名称:Athena,代码行数:31,代码来源:mbbsd.c


示例7: show_statuses

static void show_statuses(session_basic_info_t *res)
{
	if (session_basic_info_count(res) > 0)
		//% prints("目前状态如下:\n");
		prints("\xc4\xbf\xc7\xb0\xd7\xb4\xcc\xac\xc8\xe7\xcf\xc2\xa3\xba\n");

	for (int i = 0; i < session_basic_info_count(res); ++i) {
		bool visible = session_basic_info_visible(res, i);
		if (!visible && !HAS_PERM(PERM_SEECLOAK))
			continue;

		session_id_t sid = session_basic_info_sid(res, i);
		bool web = session_basic_info_web(res, i);
		int status = get_user_status(sid);
		int idle = (time(NULL) - session_get_idle(sid)) / 60;

		const char *color = session_status_color(status, visible, web);
		prints("\033[1m%s%s\033[m", color, session_status_descr(status));

		if (idle >= 1 && status != ST_BBSNET)
			prints("[%d] ", idle);
		else
			prints("    ");

		if ((i + 1) % 5 == 0)
			outc('\n');
	}
	outc('\n');
}
开发者ID:icewwn,项目名称:fbbs-1,代码行数:29,代码来源:talk.c


示例8: call_kickoff

void call_kickoff(chatcontext * pthis, const char *arg)
{                               /* kick ID off BBS, by Luzi, 97.11.1 */
    char msg[STRLEN];
    struct user_info *uin;

    if (!HAS_PERM(getCurrentUser(), PERM_SYSOP)) {
        printchatline(pthis, "*** 你不是站长 ***");
        return;
    }
    if (!*arg) {
        printchatline(pthis, "*** 请输入你要踢下站的 ID ***");
        return;
    } else if (!strcasecmp(arg, getCurrentUser()->userid))
        sprintf(msg, "*** Faint!你要把自己踢下站啊?***");
    else {
        uin = t_search(arg, false);
        if (uin == NULL) {
            sprintf(msg, "%s 并没有上站", arg);
        } else {
            bbslog("user", "kick %s out of bbs", uin->userid);
            kill(uin->pid, SIGHUP);
            return;
        }
    }
    printchatline(pthis, msg);
}
开发者ID:wyat,项目名称:kbs,代码行数:26,代码来源:chat.c


示例9: printuserent

/*
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;
}
开发者ID:wyat,项目名称:kbs,代码行数:68,代码来源:chat.c


示例10: tui_goodbrd_mkdir

/**
 * Create directory when browsing favorites.
 * @param cp browsing status.
 * @return update status.
 */
static int tui_goodbrd_mkdir(choose_t *cp)
{
	choose_board_t *cbrd = cp->data;

	if (!HAS_PERM(PERM_LOGIN) || !cbrd->goodbrd)
		return DONOTHING;

	if (cbrd->parent == 0) {
		if (cbrd->gnum >= GOOD_BRC_NUM) {
			presskeyfor("收藏夹已满", t_lines - 1);
			return MINIUPDATE;
		}

		char name[STRLEN];
		char title[STRLEN];
		name[0] = '\0';
		getdata(t_lines - 1, 0, "创建自定义目录: ", name, 17,
				DOECHO, NA);
		if (name[0] != '\0') {
			strlcpy(title, "自定义目录", sizeof(title));
			getdata(t_lines - 1, 0, "自定义目录描述: ", title, 21,
					DOECHO, NA);
			if (goodbrd_mkdir(cbrd, name, title, 0) == 0) {
				cp->valid = false;
				return PARTUPDATE;
			}
		}
		return MINIUPDATE;
	}
	return DONOTHING;
}
开发者ID:phoenixgao,项目名称:fdubbs,代码行数:36,代码来源:boards.c


示例11: kick_out

static int kick_out(online_users_t *up, online_user_info_t *ip)
{
	char buf[STRLEN];
	if (!HAS_PERM(PERM_USER) && !streq(ip->name, currentuser.userid))
		return DONOTHING;
	if (streq(currentuser.userid, "guest"))
		return DONOTHING;
	if (ip->sid == session_get_id())
		//% strlcpy(buf, "您要把【自己】踢出去吗", sizeof(buf));
		strlcpy(buf, "\xc4\xfa\xd2\xaa\xb0\xd1\xa1\xbe\xd7\xd4\xbc\xba\xa1\xbf\xcc\xdf\xb3\xf6\xc8\xa5\xc2\xf0", sizeof(buf));
	else
		//% snprintf(buf, sizeof(buf), "你要把 %s 踢出站外吗", ip->name);
		snprintf(buf, sizeof(buf), "\xc4\xe3\xd2\xaa\xb0\xd1 %s \xcc\xdf\xb3\xf6\xd5\xbe\xcd\xe2\xc2\xf0", ip->name);
	if (!askyn(buf, false, true))
		return MINIUPDATE;

	if (bbs_kill(ip->sid, ip->pid, SIGHUP) == 0) {
		//% snprintf(buf, sizeof(buf), "%s 已被踢出站外", ip->name);
		snprintf(buf, sizeof(buf), "%s \xd2\xd1\xb1\xbb\xcc\xdf\xb3\xf6\xd5\xbe\xcd\xe2", ip->name);
		up->uptime = 0;
		return PARTUPDATE;
	} else {
		//% snprintf(buf, sizeof(buf), "%s 无法踢出站外", ip->name);
		snprintf(buf, sizeof(buf), "%s \xce\xde\xb7\xa8\xcc\xdf\xb3\xf6\xd5\xbe\xcd\xe2", ip->name);
		return MINIUPDATE;
	}
}
开发者ID:fbbs,项目名称:fbbs,代码行数:27,代码来源:online.c


示例12: _fill_session_array

static void _fill_session_array(tui_list_t *p, int i)
{
	online_users_t *up = p->data;
	db_res_t *res = up->res;

	bool visible = db_get_bool(res, i, 3);
	if (!visible && !HAS_PERM(PERM_SEECLOAK))
		return;

	session_id_t sid = db_get_session_id(res, i, 0);
	if (up->bid && session_get_board(sid) != up->bid)
		return;

	online_user_info_t *ip = up->users + up->num;
	memset(ip, 0, sizeof(*ip));

	ip->sid = sid;
	ip->name = db_get_value(res, i, 2);
	ip->host = db_get_value(res, i, 4);
	ip->note = up->follow ? db_get_value(res, i, 6) : NULL;
	ip->uid = db_get_user_id(res, i, 1);
	ip->flag = (db_get_bool(res, i, 5) ? SESSION_FLAG_WEB : 0)
			| (visible ? 0 : SESSION_FLAG_INVISIBLE);

	++up->num;
}
开发者ID:fbbs,项目名称:fbbs,代码行数:26,代码来源:online.c


示例13: help_key

static int help_key(struct _select_def *conf, int key)
{

	switch(key){
	case 's':
	{
		clear();
		move(5,0);
		prints("\033[1;32m提示:\033[m 在帮助主界面中按f可以取消搜索显示当前所有的帮助");
		getdata(6,0, "请输入搜索内容:", help_search, 21, DOECHO, NULL, false);
		if( help_search[0] ){
			conf->pos = 1;
			conf->page_pos = 1;
			return SHOW_DIRCHANGE;
		}
		return SHOW_REFRESH;
	}
	case 'a':
		if( HAS_PERM(getCurrentUser(), PERM_SYSOP) ){
			if( add_help(*((int *)conf->arg), -1) < 0 )
				return SHOW_REFRESH;
			return SHOW_DIRCHANGE;
		}
	case 'e':
		if( HAS_PERM(getCurrentUser(), PERM_SYSOP) ){
			if( add_help(*((int *)conf->arg), conf->pos - conf->page_pos) < 0 )
				return SHOW_REFRESH;
			return SHOW_DIRCHANGE;
		}
	case 'd':
		if( HAS_PERM(getCurrentUser(), PERM_SYSOP) ){
			if( del_help(s_help[conf->pos-conf->page_pos].id) < 0 )
				return SHOW_REFRESH;
			return SHOW_DIRCHANGE;
		}
	case 'f':
		if( help_search[0] ){
			help_search[0]=0;
			return SHOW_DIRCHANGE;
		}
		return SHOW_CONTINUE;
	default:
		break;
	}

	return SHOW_CONTINUE;
}
开发者ID:marvelliu,项目名称:lilacsrc,代码行数:47,代码来源:newhelp.c


示例14: PostArticle

/*******************************************************************
 *	張貼文章
 *
 *	佈告、信件 通用
 *
 *	return:	WebRespondType
 *******************************************************************/
int 
PostArticle(char *pbuf, BOARDHEADER * board, POST_FILE * pf)
{
	BOOL tonews = FALSE;
	char *p;
	unsigned char flag = 0x00;
	FILE *fp;
	int sign_num, URLParaType = request_rec->URLParaType;
	char fname[PATHLEN], post_path[PATHLEN], address[STRLEN], post_source[STRLEN],
	  subject[STRLEN];
	char buffer[STRLEN * 3];


	if (URLParaType == PostSend
	    || URLParaType == TreaSend)
	{
		if (PSCorrect == gLogin)	/* guest */
		{
			if (!strstr(_STR_BOARD_GUEST, board->filename))
				return WEB_GUEST_NOT_ALLOW;
			else
				get_passwd(&curuser, username);
		}

		if ((curuser.userlevel < board->level))
		{
			sprintf(WEBBBS_ERROR_MESSAGE, "%s 無權張貼文章於 %s 一般區<BR>理由: 使用者等級 < %d",
				username, board->filename, board->level);
			return WEB_ERROR;
		}

		if ((board->brdtype & BRD_IDENT) && (curuser.ident != 7))
		{
			sprintf(WEBBBS_ERROR_MESSAGE, "%s 無權張貼文章於 %s 一般區<BR>理由: 未通過身份認證",
				username, board->filename);
			return WEB_ERROR;
		}


#if 0
		make_treasure_folder(direct, title, NULL)
#endif

		/* treapost */
			if (URLParaType == TreaSend)
		{
			if (!HAS_PERM(PERM_SYSOP) && strcmp(username, board->owner))
			{
				sprintf(WEBBBS_ERROR_MESSAGE, "%s 無權張貼文章於 %s 精華區",
					username, board->filename);
				return WEB_ERROR;
			}
			settreafile(post_path, board->filename, pf->POST_NAME);
		}
	}
	else
		/* Send Mail */
	{
开发者ID:wtj,项目名称:formosa,代码行数:65,代码来源:article.c


示例15: haspostperm

int haspostperm(char* bname)
{
    register int i;
    if (digestmode)
        return 0;
    if ( deny_me(bname) && !HAS_PERM(PERM_SYSOP))
        return 0;
    if (strcmp(bname, DEFAULTBOARD) == 0)
        return 1;
    if ( (!strcmp(bname, "Appeal")||(!strcmp(bname,"Complain"))) && strcmp(lookupuser.userid,"guest") && HAS_PERM(PERM_LOGINOK))
        return 1;
    if ((i = getbnum(bname)) == 0)
        return 0;
    set_safe_record();
    if (!HAS_PERM(PERM_POST))
        return 0;
    return (HAS_PERM((bcache[i - 1].level & ~PERM_NOZAP) & ~PERM_POSTMASK));
}
开发者ID:madoldman,项目名称:inankai_bbs,代码行数:18,代码来源:bcache.c


示例16: choose_board_display

static choose_display_t choose_board_display(choose_t *cp)
{
	choose_board_t *cbrd = cp->data;
	board_data_t *ptr;
	char tmpBM[BM_LEN - 1];

	char cate[7], title[STRLEN];

	int n;
	for (n = cp->start; n < cp->start + BBS_PAGESIZE; n++) {
		if (n >= cbrd->num) {
			prints("\n");
			continue;
		}
		ptr = cbrd->brds + n;
		if (ptr->total == -1) {
			refresh();
			check_newpost(ptr);
		}

		if (!cbrd->newflag)
			prints(" %5d", n + 1);
		else if (ptr->flag & BOARD_DIR_FLAG)
			prints("  目录");
		else
			prints(" %5d", ptr->total);

		if (ptr->flag & BOARD_DIR_FLAG)
			prints("  +");
		else
			prints("  %s", ptr->unread ? "◆" : "◇");

		if (!(ptr->flag & BOARD_CUSTOM_FLAG))
			strcpy(tmpBM, ptr->BM);

		strlcpy(cate, ptr->title + 1, sizeof(cate));
		strlcpy(title, ptr->title + 11, sizeof(title));
		ellipsis(title, 20);

		prints("%c%-17s %s%s%6s %-20s %c ",
				(ptr->zap && !(ptr->flag & BOARD_NOZAP_FLAG)) ? '*' : ' ',
				ptr->name,
				(ptr->flag & BOARD_VOTE_FLAG) ? "\033[1;31mV\033[m" : " ",
				(ptr->flag & BOARD_CLUB_FLAG) ? (ptr->flag & BOARD_READ_FLAG)
				? "\033[1;31mc\033[m" : "\033[1;33mc\033[m" : " ",
				cate, title, HAS_PERM (PERM_POST) ? ptr->property : ' ');

		if (ptr->flag & BOARD_DIR_FLAG)
			prints("[目录]\n");
		else
			prints("%-12s %4d\n",
					ptr->BM[0] <= ' ' ? "诚征版主中" : strtok(tmpBM, " "),
					brdshm->bstatus[ptr->pos].inboard);
	}
	return 0;
}
开发者ID:phoenixgao,项目名称:fdubbs,代码行数:56,代码来源:boards.c


示例17: start_client

static void start_client() {
    extern struct commands_t cmdlist[];
    int nreg;
    
    /* system init */
    currmode = 0;
    
    signal(SIGHUP, abort_bbs);
    signal(SIGTERM, abort_bbs);
    signal(SIGPIPE, abort_bbs);

    signal(SIGINT, abort_bbs_debug);
    signal(SIGQUIT, abort_bbs_debug);
    signal(SIGILL, abort_bbs_debug);
    signal(SIGABRT, abort_bbs_debug);
    signal(SIGFPE, abort_bbs_debug);
    signal(SIGBUS, abort_bbs_debug);
    signal(SIGSEGV, abort_bbs_debug);
    
    signal_restart(SIGUSR1, talk_request);
    signal_restart(SIGUSR2, write_request);
    
    dup2(0, 1);
    
    do_term_init();
    signal(SIGALRM, abort_bbs);
    alarm(600);
    login_query();		/* Ptt 加上login time out */
    user_login();
    m_init();

#if FORCE_PROCESS_REGISTER_FORM    
    if (HAS_PERM(PERM_SYSOP) && (nreg = dashs(fn_register)/163) > 100)
    {
    	char cpu_load[30];
    	if(cpuload(cpu_load) > MAX_CPULOAD*2/3)	/* DickG: 根據目前的 load 來 */
	    scan_register_form(fn_register, 1, nreg/20); /* 決定要審核的數目 */
	else
	    scan_register_form(fn_register, 1, nreg/10);
    }
#endif
    if(HAVE_PERM(PERM_SYSOP | PERM_BM))
	b_closepolls();
    if(!(cuser.uflag & COLOR_FLAG))
	showansi = 0;
#ifdef DOTIMEOUT
    /* init_alarm();*/ // cause strange logout with saving post.
    signal(SIGALRM, SIG_IGN);
#else
    signal(SIGALRM, SIG_IGN);
#endif
    if(chkmailbox())
	m_read();
    
    domenu(MMENU, "主功\能表", (chkmail(0) ? 'M' : 'C'), cmdlist);
}
开发者ID:YanlongLai,项目名称:Program,代码行数:56,代码来源:mbbsd.c


示例18: chat_sendmsg

void chat_sendmsg(chatcontext * pthis, const char *arg)
{                               /* send msg in chatroom , by alex, 96.9.5 */
    char userid[IDLEN + 1];
    char msg[STRLEN * 2];
    struct user_info *uin;
    int state;

    nextword(&arg, userid, sizeof(userid));
    if (!userid[0]) {
        printchatline(pthis,
                      "\x1b[37m*** \x1b[32m请输入你要发消息的 ID\x1b[37m ***\x1b[m");
        return;
    } else if (!*arg) {
        printchatline(pthis,
                      "\x1b[37m*** \x1b[32m请输入你要发的消息\x1b[37m ***\x1b[m");
        return;
    } else if (!HAS_PERM(getCurrentUser(), PERM_PAGE)) {     /* Leeward 98.07.30 */
        sprintf(msg, "\x1b[32m你没有发信息的权限\x1b[m");
    } else {
        uin = t_search(userid, false);
        if (uin == NULL) {
            sprintf(msg, "\x1b[32m%s\x1b[37m 并没有上站\x1b[m", userid);
        } else if (LOCKSCREEN == uin->mode)
            /* Leeward 98.02.28 */
            sprintf(msg,
                    "\x1b[32m%s\x1b[37m已经锁定屏幕,请稍候再发或给他(她)写信.\n",
                    uin->userid);
        else {
            if (!canmsg(getCurrentUser(), uin))
                sprintf(msg,
                        "\x1b[32m%s\x1b[37m已经关闭接受讯息的呼叫器.\n",
                        uin->userid);
            else if (false == canIsend2(getCurrentUser(),uin->userid))
                sprintf(msg, "\x1b[32m%s\x1b[37m拒绝接受你的讯息.\n", uin->userid);     /*Haohmaru.99.6.6,检查是否被ignore */
            else {
                if (get_unreadcount(uin->userid) > MAXMESSAGE)
                    sprintf(msg,
                            "对方尚有一些讯息未处理,请稍候再发或给他(她)写信...\n");
                else {
                    /* 保存所发msg的目的uid 1998.7.5 by dong */
                    strcpy(getSession()->MsgDesUid, uin->userid);
                    state = do_sendmsg(uin, arg, 2);
                    if (state == 1)
                        sprintf(msg,
                                "\x1b[37m已经发消息给 \x1b[32m%s\x1b[37m 了\x1b[m",
                                uin->userid);
                    else if (state == -2)
                        sprintf(msg, "\x1b[37m对方已经离线了...\x1b[m");
                    else
                        sprintf(msg, "\033[37对方不接受你的消息...\033[m");
                }
            }
        }
    }
    printchatline(pthis, msg);
}
开发者ID:wyat,项目名称:kbs,代码行数:56,代码来源:chat.c


示例19: apply_boards

int apply_boards(int (*func)())
{
    register int i;
    resolve_boards();
    for (i = 0; i < numboards; i++)
        if (bcache[i].level & PERM_POSTMASK || HAS_PERM(bcache[i].level) || (bcache[i].level & PERM_NOZAP))
            if ((*func) (&bcache[i]) == QUIT)
                return QUIT;
    return 0;
}
开发者ID:madoldman,项目名称:inankai_bbs,代码行数:10,代码来源:bcache.c


示例20: tui_update_status_line

void tui_update_status_line(void)
{
	extern time_t login_start_time; //main.c

	char date[STRLEN];

	screen_move_clear(-1);

	if (!DEFINE(DEF_ENDLINE))
		return;

	fb_time_t now = fb_time();
	int cur_sec = now % 10;

	if (cur_sec < 5) {
		strlcpy(date, format_time(now, TIME_FORMAT_UTF8_ZH), sizeof(date));
	} else {
		if (resolve_boards() >= 0)
			convert_g2u(brdshm->date, date);
		else
			date[0] = '\0';
	}

	if (cur_sec >= 5 && is_birth(&currentuser)) {
		screen_printf("\033[0;1;33;44m[\033[36m                      "
				"啦啦~~生日快乐!记得要请客哟 :P"
				"                       \033[33m]\033[m");
	} else {
		int stay = (now - login_start_time) / 60;
		char stay_str[20];
		describe_stay(stay, stay_str, sizeof(stay_str));

		char notice[128];
		notice_string(notice, sizeof(notice));
		int notice_width = screen_display_width(notice, true);

		screen_printf("\033[1;44;33m[\033[36m%29s\033[33m]"
			"[\033[36m%5d\033[33m人\033[36m%3d\033[33m友]",
			date, session_count_online(),
			session_count_online_followed(!HAS_PERM(PERM_SEECLOAK)));
		// 剩下35列
		if (notice_width) {
			int space = 33 - notice_width;
			if (space > 0)
				tui_repeat_char(' ', space);
			screen_printf("[\033[%d;36m%s\033[m\033[1;33;44m]\033[m",
					_suppress_notice ? 1 : 5, notice);
		} else {
			int space = 27 - strlen(currentuser.userid);
			tui_repeat_char(' ', space);
			prints("[\033[36m%s\033[33m]%s\033[m", currentuser.userid,
					stay_str);
		}
	}
}
开发者ID:fbbs,项目名称:fbbs,代码行数:55,代码来源:tui.c



注:本文中的HAS_PERM函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ HAVE_OPT函数代码示例发布时间:2022-05-30
下一篇:
C++ HAS_PCH_SPLIT函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap