Example #1
0
int msgmorebar(char *filename) {
	extern int showansi;
	char title[256];
	int ch;
	showansi = 1;
	move(t_lines - 1, 0);
	clrtoeol();

	prints("ѶϢä¯ÀÀÆ÷   ±£Áô <r>    Çå³ý <c>   ¼Ä»ØÐÅÏä<m>                                ");
	move(t_lines - 1, 0);

	ch = morekey();
	if (ch == 'C') {
		if (askyn("È·¶¨ÒªÇå³ýÂð£¿", NA, YEA) == YEA) {
			unlink(filename);
		}
		return ch;
	} else if (ch == 'M') {
		if (askyn("È·¶¨Òª¼Ä»ØÂð£¿", NA, YEA) == YEA) {
			sprintf(title, "[%s] ËùÓÐѶϢ±¸·Ý", getdatestring(time(NULL), DATE_ZH));
			mail_file(filename, currentuser.userid, title);
			unlink(filename);
		}
		return ch;
	} else if (ch == 'H') {
		show_help("help/msghelp");
	}
	clrtoeol();
	refresh();
	return ch;
}
Example #2
0
int tst(int type,char *spec)
{
  int i,j;
  for(i=0;i<dtcnt;i++){
    if(strstr(spec,dts[i].spec)){ 
      if(have[i]==-2) continue;
      if(have[i]>=0){
/* 	printf("auto: %s == %s\n",dts[i].spec,nt[have[i]]); */
	dt[type]=i;
	nt[type]=nt[have[i]];
	cnv[type]=-1;
	return 1;
      }else{
	printf("Does your system/compiler support a type implemented as\n%s?\n",dts[i].descr);
	if(askyn(yndefault(dts[i].spec,1))){
	  dt[type]=i;
	  nt[type]=asktype(yndefault(dts[i].spec,0));
	  have[i]=type;
	  cnv[type]=-1;
	  return 1;
	}else{
	  have[i]=-2;
	}
      }
    }
  }
  for(j=0;j<cnvcnt;j++){
    char *s=0;
    if(strstr(spec,cnvs[j].from)) s=cnvs[j].to;
/*     if(strstr(spec,cnvs[j].to)) s=cnvs[j].from; */
    if(s){
      for(i=0;i<dtcnt;i++){
	if(!strcmp(s,dts[i].spec)){
	  if(have[i]==-2) continue;
	  if(have[i]>=0){
	    dt[type]=i;
	    nt[type]=nt[have[i]];
	    cnv[type]=j;
	    return 2;
	  }else{
	    printf("Does your system/compiler support a type implemented as\n%s?\n",dts[i].descr);
	    if(askyn(yndefault(dts[i].spec,1))){
	      dt[type]=i;
	      nt[type]=asktype(yndefault(dts[i].spec,0));
	      have[i]=type;
	      cnv[type]=j;
	      return 2;
	    }else{
	      have[i]=-2;
	    }
	  }
	}
      }
    }
  }
  return 0;
}
Example #3
0
/**
 * Remove board/directory from favorites.
 * @param cp browsing status.
 * @return update status.
 */
static int tui_goodbrd_rm(choose_t *cp)
{
	choose_board_t *cbrd = cp->data;

	if (cbrd->goodbrd && cbrd->num > 0) {
		char buf[STRLEN];
		snprintf(buf, sizeof(buf), "要把 %s 从收藏夹中去掉?",
				cbrd->brds[cp->cur].name);
		if (askyn(buf, false, true)) {
			if (cbrd->brds[cp->cur].flag & BOARD_CUSTOM_FLAG) {
				goodbrd_rmdir(cbrd, cbrd->brds[cp->cur].pos);
			} else {
				int pos = inGoodBrds(cbrd, cbrd->brds[cp->cur].pos);
				if (pos) {
					memmove(cbrd->gbrds + pos - 1, cbrd->gbrds + pos,
							sizeof(gbrdh_t) * (cbrd->gnum - pos));
					cbrd->gnum--;
					goodbrd_save(cbrd);
				}
			}
			cp->valid = false;
			return PARTUPDATE;
		}
		return MINIUPDATE;
	}
	return DONOTHING;
}
Example #4
0
File: online.c Project: fbbs/fbbs
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;
	}
}
Example #5
0
int b_notes_edit() {
	char buf[STRLEN], buf2[STRLEN];
	char ans[4];
	int aborted;
	int notetype;
	if (!chkBM(currbp, &currentuser))
		return 0;
	clear();
	move(1, 0);
	prints("�༭/ɾ������¼"); //ѯ�ʱ༭���ֱ���¼
	while (1) {
		getdata(3, 0, "�༭��ɾ������������ (0) �뿪  (1) һ�㱸��¼  (2) ���ܱ���¼? [1] ",
				ans, 2, DOECHO, YEA);
		if (ans[0] == '0')
			return FULLUPDATE;
		if (ans[0] == '\0')
			strcpy(ans, "1");
		if (ans[0] == '1' || ans[0] == '2')
			break;
	}
	makevdir(currboard); //��������¼Ŀ¼
	if (ans[0] == '2') {
		setvfile(buf, currboard, "secnotes");
		notetype = 2;
	} else {
		setvfile(buf, currboard, "notes");
		notetype = 1;
	}
	sprintf(buf2, "(E)�༭ (D)ɾ�� %4s����¼? [E]: ", (notetype == 1) ? "һ��"
			: "����");
	getdata(5, 0, buf2, ans, 2, DOECHO, YEA); //ѯ�ʱ༭����ɾ��
	if (ans[0] == 'D' || ans[0] == 'd') { //ɾ������¼
		move(6, 0);
		sprintf(buf2, "���Ҫɾ��%4s����¼", (notetype == 1) ? "һ��" : "����");
		if (askyn(buf2, NA, NA)) {
			move(7, 0);
			prints("����¼�Ѿ�ɾ��...\n");
			pressanykey();
			unlink(buf);
			aborted = 1;
		} else
			aborted = -1;
	} else
		aborted = vedit(buf, NA, YEA); //�༭����¼
	if (aborted == -1) {
		pressreturn();
	} else {
		if (notetype == 1)
			setvfile(buf, currboard, "noterec");
		else
			setvfile(buf, currboard, "notespasswd");
		unlink(buf);
	}

	return FULLUPDATE;
}
Example #6
0
//  ---------------------------   警署     --------------------------  //
static int
cop_accuse()
{
    char uident[IDLEN + 1], buf[256];
    mcUserInfo *mcuInfo;
    time_t currTime;

    move(4, 4);
    prints("如果您遭遇抢劫或偷窃,如果您有任何线索,请向警方报告。");
    move(5, 4);
    prints("\033[1;32m警民合作,共创安定大好局面!\033[0m");
    if (!getOkUser("举报谁?", uident, 7, 4))
        return 0;
    move(8, 4);
    sethomefile(buf, uident, "mc.save");
    if (!file_exist(buf))
        initData(1, buf);
    if((mcuInfo = loadData(buf, sizeof (mcUserInfo))) == (void*)-1)
        return 0;
    if (seek_in_file(DIR_MC "policemen", uident)) {
        showAt(8, 4, "大胆!想诬陷警务人员吗?!", YEA);
        goto UNMAP;
    }
    if (mcuInfo->freeTime > 0) {
        showAt(8, 4, "这个人已经被警署监禁了。", YEA);
        goto UNMAP;
    }
    currTime = time(NULL);
    if ((mcuInfo->robExp == 0) || (mcuInfo->begExp == 0)
            || (mcuInfo->lastActiveTime + 7200 < currTime) || !(mcuInfo->BeIn)) {
        showAt(8, 4, "这个人最近很安分啊!你不要诽谤别人哦!", YEA);
        goto UNMAP;
    }
    if (seek_in_file(DIR_MC "criminals_list", uident)) {
        showAt(8, 4, "此人已经被警署通缉了,警署仍然向你表示感谢。",
               YEA);
        goto UNMAP;
    }
    getdata(8, 4, "简述案情[\033[1;33mENTER\033[0m放弃]:",
            genbuf, 40, DOECHO, YEA);
    if (genbuf[0] == '\0')
        goto UNMAP;
    move(9, 4);
    if (askyn("\033[1;33m你向警方提供的上述信息真实吗\033[0m", NA, NA) ==
            NA)
        goto UNMAP;
    snprintf(buf, STRLEN - 1, "%s %s", uident, genbuf);
    addtofile(DIR_MC "criminals_list", buf);
    showAt(10, 4, "警方非常感谢您提供的线索,我们将尽力尽快破案。", YEA);
    return 1;

UNMAP:
    unloadData(mcuInfo, 1);
    return 0;
}
Example #7
0
// Prevent too many logins of same account.
static int multi_user_check(void)
{
	int max = get_login_quota(&currentuser);
	if (max == INT_MAX)
		return 0;

	int logins = INT_MAX;
	session_basic_info_t *res = get_my_sessions();
	if (res) {
		logins = session_basic_info_count(res);
	}

	if (strcaseeq("guest", currentuser.userid) && logins >= max) {
		//% prints("\033[1;33m抱歉, 目前已有太多 \033[1;36mguest\033[33m, "
		prints("\033[1;33m\xb1\xa7\xc7\xb8, \xc4\xbf\xc7\xb0\xd2\xd1\xd3\xd0\xcc\xab\xb6\xe0 \033[1;36mguest\033[33m, "
				//% "请稍后再试。\033[m\n");
				"\xc7\xeb\xc9\xd4\xba\xf3\xd4\xd9\xca\xd4\xa1\xa3\033[m\n");
		session_basic_info_clear(res);
		return -1;
	}

	if (logins >= max) {
		//% prints("\033[1;32m为确保他人上站权益, "
		prints("\033[1;32m\xce\xaa\xc8\xb7\xb1\xa3\xcb\xfb\xc8\xcb\xc9\xcf\xd5\xbe\xc8\xa8\xd2\xe6, "
				//% "本站仅允许您用该帐号登录 %d 个。\n\033[m"
				"\xb1\xbe\xd5\xbe\xbd\xf6\xd4\xca\xd0\xed\xc4\xfa\xd3\xc3\xb8\xc3\xd5\xca\xba\xc5\xb5\xc7\xc2\xbc %d \xb8\xf6\xa1\xa3\n\033[m"
				//% "\033[1;36m您目前已经使用该帐号登录了 %d 个,"
				"\033[1;36m\xc4\xfa\xc4\xbf\xc7\xb0\xd2\xd1\xbe\xad\xca\xb9\xd3\xc3\xb8\xc3\xd5\xca\xba\xc5\xb5\xc7\xc2\xbc\xc1\xcb %d \xb8\xf6\xa3\xac"
				//% "您必须断开其他的连接方能进入本站!\n\033[m", max, logins);
				"\xc4\xfa\xb1\xd8\xd0\xeb\xb6\xcf\xbf\xaa\xc6\xe4\xcb\xfb\xb5\xc4\xc1\xac\xbd\xd3\xb7\xbd\xc4\xdc\xbd\xf8\xc8\xeb\xb1\xbe\xd5\xbe\xa3\xa1\n\033[m", max, logins);
		//% bool kick = askyn("您想删除重复的连接吗", false, false);
		bool kick = askyn("\xc4\xfa\xcf\xeb\xc9\xbe\xb3\xfd\xd6\xd8\xb8\xb4\xb5\xc4\xc1\xac\xbd\xd3\xc2\xf0", false, false);
		if (kick) {
			bbs_kill(session_basic_info_sid(res, 0),
					session_basic_info_pid(res, 0), SIGHUP);
			report("kicked (multi-login)", currentuser.userid);
			session_basic_info_clear(res);

			sleep(2);
			res = get_my_sessions();
			logins = session_basic_info_count(res);
		}

		session_basic_info_clear(res);
		if (logins >= max) {
			//% prints("\033[33m很抱歉,您已经用该帐号登录 %d 个,"
			prints("\033[33m\xba\xdc\xb1\xa7\xc7\xb8\xa3\xac\xc4\xfa\xd2\xd1\xbe\xad\xd3\xc3\xb8\xc3\xd5\xca\xba\xc5\xb5\xc7\xc2\xbc %d \xb8\xf6\xa3\xac"
					//% "所以,此连线将被取消。\033[m\n", logins);
					"\xcb\xf9\xd2\xd4\xa3\xac\xb4\xcb\xc1\xac\xcf\xdf\xbd\xab\xb1\xbb\xc8\xa1\xcf\xfb\xa1\xa3\033[m\n", logins);
			return -1;
		}
	}
	return 0;
}
Example #8
0
static int
cop_arrange(int type)
{
    int found;
    char uident[IDLEN + 1], buf[STRLEN], title[STRLEN];
    char *actionDesc[] = { "-", "任命", "解职", NULL };
    mcUserInfo *mcuInfo;

    if (!getOkUser("请输入ID: ", uident, 12, 4))
        return 0;
    found = seek_in_file(DIR_MC "policemen", uident);
    move(13, 4);
    if (type == 1 && found) {
        showAt(13, 4, "该ID已经是警员了。", YEA);
        return 0;
    } else if (type == 2 && !found) {
        showAt(13, 4, "该ID不是警署警员。", YEA);
        return 0;
    }
    if (type == 1 && (clubtest(ROBUNION) || clubtest(BEGGAR))) {
        showAt(13, 4, "此人社会关系不明,不宜雇用为警员。", YEA);
        return 0;
    }

    sprintf(buf, "%s确定%s吗?",
            type == 2 ? "被解雇警员会损失一半胆识跟身法," : "",
            actionDesc[type]);
    if (askyn(buf, NA, NA) == NA)
        return 0;
    if (type == 1)
        addtofile(DIR_MC "policemen", uident);
    else {
        sethomefile(buf, uident, "mc.save");
        if (!file_exist(buf))
            initData(1, buf);
        if((mcuInfo = loadData(buf, sizeof (mcUserInfo))) == (void*)-1)
            return 0;
        mcuInfo->robExp /= 2;
        mcuInfo->begExp /= 2;
        mcuInfo->luck = -100;
        del_from_file(DIR_MC "policemen", uident);
        unloadData(mcuInfo, sizeof (mcUserInfo));
    }
    sprintf(title, "【警署】%s警员 %s", actionDesc[type], uident);
    sprintf(buf, "警署署长%s %s警员 %s", currentuser->userid,
            actionDesc[type], uident);
    deliverreport(title, buf);
    system_mail_buf(buf, strlen(buf), uident, title, currentuser->userid);
    showAt(14, 4, "操作成功。", YEA);
    return 1;
}
Example #9
0
File: online.c Project: fbbs/fbbs
int tui_follow_uname(const char *uname)
{
	if (streq(currentuser.userid, "guest"))
		return DONOTHING;
	char buf[STRLEN];
	//% snprintf(buf, sizeof(buf), "确定关注 %s 吗?", uname);
	snprintf(buf, sizeof(buf), "\xc8\xb7\xb6\xa8\xb9\xd8\xd7\xa2 %s \xc2\xf0?", uname);
	if (!askyn(buf, false, true))
		return MINIUPDATE;
	if (follow(session_get_user_id(), uname, NULL)) {
		//% snprintf(buf, sizeof(buf), "成功关注 %s", uname);
		snprintf(buf, sizeof(buf), "\xb3\xc9\xb9\xa6\xb9\xd8\xd7\xa2 %s", uname);
		presskeyfor(buf, -1);
	}
	return MINIUPDATE;
}
Example #10
0
static int tui_goodbrd_add(choose_t *cp)
{
	choose_board_t *cbrd = cp->data;

	if (!HAS_PERM(PERM_LOGIN))
		return DONOTHING;

	if (cbrd->goodbrd && (cbrd->parent == -1))
		return DONOTHING;

	if (cbrd->goodbrd) {
		if (cbrd->parent == -1)
			return DONOTHING;

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

		int pos;
		char bname[STRLEN];
		struct boardheader fh;
		if (gettheboardname(1, "输入讨论区名 (按空白键自动搜寻): ",
				&pos, &fh, bname, 1)) {
			if (goodbrd_add(cbrd, pos, cbrd->parent) == 0)
				cp->valid = false;
		}
		return FULLUPDATE;
	} else {
		goodbrd_load(cbrd);
		if (cbrd->gnum >= GOOD_BRC_NUM) {
			presskeyfor("收藏夹已满", t_lines - 1);
			return MINIUPDATE;
		} else {
			char buf[STRLEN];
			snprintf(buf, sizeof(buf), "您确定要添加 %s 到收藏夹吗?",
					cbrd->brds[cp->cur].name);
			if (askyn(buf, false, true)) {
				if (goodbrd_add(cbrd, cbrd->brds[cp->cur].pos + 1, 0) == 0) {
					cp->valid = false;
					return PARTUPDATE;
				}
			}
			return MINIUPDATE;
		}
	}
}
Example #11
0
static void user_login(void)
{
	char fname[STRLEN];

	// SYSOP gets all permission bits when login.
	if (strcmp(currentuser.userid, "SYSOP") == 0) {
		currentuser.userlevel = ~0;
		substitut_record(PASSFILE, &currentuser, sizeof(currentuser),
				usernum);
	}
	fromhost[sizeof(fromhost) - 1] = 0; //added by iamfat 2004.01.05 to avoid overflow
	log_usies("ENTER", fromhost, &currentuser);

	SpecialID(currentuser.userid, fromhost, sizeof(fromhost));

	u_enter();
	report("Enter", currentuser.userid);

#ifdef USE_NOTEPAD
	notepad_init();
	if (strcmp(currentuser.userid, "guest") != 0) {
		if (DEFINE(DEF_NOTEPAD)) {
			int noteln;

			if (lastnote> currentuser.notedate)
			currentuser.noteline = 0;
			noteln = countln("etc/notepad");
			if (currentuser.noteline == 0) {
				shownotepad();
			} else if ((noteln - currentuser.noteline)> 0) {
				screen_move(0, 0);
				ansimore2("etc/notepad", NA, 0, noteln - currentuser.noteline + 1);
				terminal_getchar();
				screen_clear();
			}
			currentuser.noteline = noteln;
			write_defnotepad();
		}
	}
#endif

	if (show_statshm("etc/hotspot", 0)) {
		screen_flush();
		pressanykey();
	}

	if ((vote_flag(NULL, '\0', 2 /* 检查读过新的Welcome 没 */) == 0)) {
		if (dashf("Welcome")) {
			ansimore("Welcome", YEA);
			vote_flag(NULL, 'R', 2 /* 写入读过新的Welcome */);
		}
	} else {
		ansimore("Welcome2", YEA);
	}
	show_statshm("0Announce/bbslist/day", 1);
	screen_flush();
	screen_move_clear(-2);
	if (currentuser.numlogins < 1) {
		currentuser.numlogins = 0;
		//% prints("\033[1;36m☆ 这是您第 \033[33m1\033[36m 次拜访本站,请记住今天吧。\n");
		prints("\033[1;36m\xa1\xee \xd5\xe2\xca\xc7\xc4\xfa\xb5\xda \033[33m1\033[36m \xb4\xce\xb0\xdd\xb7\xc3\xb1\xbe\xd5\xbe\xa3\xac\xc7\xeb\xbc\xc7\xd7\xa1\xbd\xf1\xcc\xec\xb0\xc9\xa1\xa3\n");
		//% prints("☆ 您第一次连入本站的时间为 \033[33m%s\033[m ", format_time(time(NULL), TIME_FORMAT_ZH));
		prints("\xa1\xee \xc4\xfa\xb5\xda\xd2\xbb\xb4\xce\xc1\xac\xc8\xeb\xb1\xbe\xd5\xbe\xb5\xc4\xca\xb1\xbc\xe4\xce\xaa \033[33m%s\033[m ", format_time(fb_time(), TIME_FORMAT_ZH));
	} else {
		prints(
				//% "\033[1;36m☆ 这是您第 \033[33m%d\033[36m 次拜访本站,上次您是从 \033[33m%s\033[36m 连往本站。\n",
				"\033[1;36m\xa1\xee \xd5\xe2\xca\xc7\xc4\xfa\xb5\xda \033[33m%d\033[36m \xb4\xce\xb0\xdd\xb7\xc3\xb1\xbe\xd5\xbe\xa3\xac\xc9\xcf\xb4\xce\xc4\xfa\xca\xc7\xb4\xd3 \033[33m%s\033[36m \xc1\xac\xcd\xf9\xb1\xbe\xd5\xbe\xa1\xa3\n",
				currentuser.numlogins + 1, currentuser.lasthost);
		//% prints("☆ 上次连线时间为 \033[33m%s\033[m ", format_time(currentuser.lastlogin, TIME_FORMAT_ZH));
		prints("\xa1\xee \xc9\xcf\xb4\xce\xc1\xac\xcf\xdf\xca\xb1\xbc\xe4\xce\xaa \033[33m%s\033[m ", format_time(currentuser.lastlogin, TIME_FORMAT_ZH));
	}
	terminal_getchar();
	setuserfile(fname, BADLOGINFILE);
	if (ansimore(fname, NA) != -1) {
		//% if (askyn("您要删除以上密码输入错误的记录吗", NA, NA) == YEA)
		if (askyn("\xc4\xfa\xd2\xaa\xc9\xbe\xb3\xfd\xd2\xd4\xc9\xcf\xc3\xdc\xc2\xeb\xca\xe4\xc8\xeb\xb4\xed\xce\xf3\xb5\xc4\xbc\xc7\xc2\xbc\xc2\xf0", NA, NA) == YEA)
			unlink(fname);
	}

	set_safe_record();
	tui_check_uinfo(&currentuser);
	strlcpy(currentuser.lasthost, fromhost, sizeof(currentuser.lasthost));
	if (login_start_time - currentuser.lastlogin >= 20 * 60
			|| !strcmp(currentuser.userid, "guest")
			|| currentuser.numlogins < 100) {
		currentuser.numlogins++;
	}

	session_basic_info_t *res = get_my_sessions();
	update_user_stay(&currentuser, true, session_basic_info_count(res) > 1);
	session_basic_info_clear(res);

#ifdef ALLOWGAME
	if (currentuser.money> 1000000) {
		currentuser.nummedals += currentuser.money / 10000;
		currentuser.money %= 1000000;
	}
	if ((signed int) (currentuser.money - currentuser.bet) < -4990
			&& currentuser.numlogins < 10 && currentuser.numposts < 10
			&& currentuser.nummedals == 0)
	currentuser.money += 1000;
#endif
	if (currentuser.firstlogin == 0) {
		currentuser.firstlogin = time(NULL) - 7 * 86400;
	}
	substitut_record(PASSFILE, &currentuser, sizeof(currentuser), usernum);
	extern char currmaildir[];
	setmdir(currmaildir, currentuser.userid);
	check_register_info();
}
Example #12
0
File: online.c Project: fbbs/fbbs
static tui_list_handler_t online_users_handler(tui_list_t *p, int ch)
{
	online_users_t *up = p->data;
	online_user_info_t *ip = up->users + p->cur;
	p->valid = false;

	char buf[STRLEN];
	switch (ch) {
		case 'h': case 'H':
			show_help("help/userlisthelp");
			return FULLUPDATE;
		case 'm': case 'M':
			if (!HAS_PERM(PERM_MAIL))
				return DONOTHING;
			m_send(ip->name);
			return FULLUPDATE;
		case 's': case 'S':
			if (streq(currentuser.userid, "guest") || !HAS_PERM(PERM_TALK)
					|| !session_msgable(ip))
				return DONOTHING;
			tui_send_msg(ip->name);
			return FULLUPDATE;
		case 'o': case 'O':
			return tui_follow_uname(ip->name);
		case 'd': case 'D':
			if (streq(currentuser.userid, "guest"))
				return DONOTHING;
			//% "确定不再关注 %s 吗?"
			snprintf(buf, sizeof(buf), "\xc8\xb7\xb6\xa8\xb2\xbb\xd4\xd9"
					"\xb9\xd8\xd7\xa2 %s \xc2\xf0?", ip->name);
			if (!askyn(buf, false, true))
				return MINIUPDATE;
			{
				user_id_t uid = get_user_id(ip->name);
				if (uid > 0 && unfollow(session_get_user_id(), uid)) {
					//% "已取消关注 %s"
					snprintf(buf, sizeof(buf), "\xd2\xd1\xc8\xa1\xcf\xfb"
							"\xb9\xd8\xd7\xa2 %s", ip->name);
					presskeyfor(buf, -1);
					return PARTUPDATE;
				}
			}		
			return MINIUPDATE;
	}
	if (p->in_query)
		return READ_AGAIN;

	switch (ch) {
		case 'Y':
			if (HAS_PERM(PERM_CLOAK)) {
				x_cloak();
				up->uptime = 0;
				return PARTUPDATE;
			}
			return DONOTHING;
		case 'C': case 'c':
			return alter_nick(up);
		case 'k': case 'K':
			return kick_out(up, ip);
		case 'f': case 'F':
			up->follow = !up->follow;
			if (up->follow)
				set_user_status(ST_FRIEND);
			else
				set_user_status(ST_LUSERS);
			up->uptime = 0;
			return FULLUPDATE;
		case 'W': case 'w':
			if (streq(currentuser.userid, "guest"))
				return DONOTHING;
			up->show_note = !up->show_note;
			return PARTUPDATE;
#if 0
		case KEY_TAB:	
			if (HAS_PERM(PERM_OCHAT)) {
				if (++(up->sort) > USRSORT_STATUS)
					up->sort = USRSORT_USERID;
				up->uptime = 0;
				return FULLUPDATE;
			}
			return DONOTHING;
#endif
		case '\r': case '\n': case KEY_RIGHT:
			online_users_query(p);
			return DONOTHING;
		default:
			return READ_AGAIN;
	}
}
Example #13
0
int main(int argc,char **argv)
{
  char type[128],spec[128];
  int i,r;
  if(argc!=4){ printf("Usage: dtgen <config-file> <output-file.h> <output-file.c>\n");exit(EXIT_FAILURE);}
/*   printf("%d datatypes, %d conversions\n",dtcnt,cnvcnt); */
  have=mymalloc(dtcnt*sizeof(*have));
  memset(have,-1,sizeof(*have)*dtcnt);
  fin=fopen(argv[1],"r");
  if(!fin){ printf("Could not open <%s> for input!\n",argv[1]);exit(EXIT_FAILURE);}
  hout=fopen(argv[2],"w");
  if(!hout){ printf("Could not open <%s> for output!\n",argv[2]);exit(EXIT_FAILURE);}
  cout=fopen(argv[3],"w");
  if(!hout){ printf("Could not open <%s> for output!\n",argv[3]);exit(EXIT_FAILURE);}
  printf("Are you building a cross-compiler?\n");
  crosscompiler=askyn("y");
  for(i=1;i<=TYPECNT;i++){
    fgets(spec,127,fin);
/*     printf("Specs for z%s:\n%s\n",typen[i],spec); */
    if(!crosscompiler){
      dt[i]=i;
      nt[i]=ftypen[i];
      have[i]=i;
      cnv[i]=-1;
    }else{
      if(!tst(i,spec)){
	printf("Problem! Your system does not seem to provide all of the data types\n"
	       "this version of vbcc needs.\nWrite to [email protected]!\n");
	exit(EXIT_FAILURE);
      }
    }
  }
  fprintf(hout,"\n\n/* Machine generated file. DON'T TOUCH ME! */\n\n\n");
  fprintf(cout,"\n\n/* Machine generated file. DON'T TOUCH ME! */\n\n\n");
  fprintf(hout,"#ifndef DT_H\n");
  fprintf(hout,"#define DT_H 1\n");
  fprintf(cout,"#include \"dt.h\"\n\n");
  for(i=1;i<=TYPECNT;i++){
    if(cnv[i]>=0){
      fprintf(hout,"typedef struct {char a[%d];} dt%df;\n",cnvs[cnv[i]].size,i);
      fprintf(hout,"typedef dt%df z%s;\n",i,typen[i]);
      fprintf(hout,"typedef %s dt%dt;\n",nt[i],i);
      fprintf(hout,"dt%dt dtcnv%df(dt%df);\n",i,i,i);
      fprintf(hout,"dt%df dtcnv%dt(dt%dt);\n",i,i,i);
      fprintf(cout,"#undef DTTTYPE\n#define DTTTYPE dt%dt\n",i);
      fprintf(cout,"#undef DTFTYPE\n#define DTFTYPE dt%df\n",i);
      fprintf(cout,"dt%dt dtcnv%df(dt%df\n",i,i,i);
      fprintf(cout,"#include \"%s\"\n",cnvs[cnv[i]].filef);
      fprintf(cout,"dt%df dtcnv%dt(dt%dt\n",i,i,i);
      fprintf(cout,"#include \"%s\"\n",cnvs[cnv[i]].filet);
    }else{
      fprintf(hout,"typedef %s z%s;\n",nt[i],typen[i]);
    }
  }

  gen_cast("zc2zm",CHAR,LLONG);
  gen_cast("zs2zm",SHORT,LLONG);
  gen_cast("zi2zm",INT,LLONG);
  gen_cast("zl2zm",LONG,LLONG);
  gen_cast("zll2zm",LLONG,LLONG);
  gen_cast("zm2zc",LLONG,CHAR);
  gen_cast("zm2zs",LLONG,SHORT);
  gen_cast("zm2zi",LLONG,INT);
  gen_cast("zm2zl",LLONG,LONG);
  gen_cast("zm2zll",LLONG,LLONG);

  gen_cast("zuc2zum",UCHAR,ULLONG);
  gen_cast("zus2zum",USHORT,ULLONG);
  gen_cast("zui2zum",UINT,ULLONG);
  gen_cast("zul2zum",ULONG,ULLONG);
  gen_cast("zull2zum",ULLONG,ULLONG);
  gen_cast("zum2zuc",ULLONG,UCHAR);
  gen_cast("zum2zus",ULLONG,USHORT);
  gen_cast("zum2zui",ULLONG,UINT);
  gen_cast("zum2zul",ULLONG,ULONG);
  gen_cast("zum2zull",ULLONG,ULLONG);

  gen_cast("zum2zm",ULLONG,LLONG);
  gen_cast("zm2zum",LLONG,ULLONG);
  gen_cast("zf2zld",FLOAT,LDOUBLE);
  gen_cast("zd2zld",DOUBLE,LDOUBLE);
  gen_cast("zld2zf",LDOUBLE,FLOAT);
  gen_cast("zld2zd",LDOUBLE,DOUBLE);
  gen_cast("zld2zm",LDOUBLE,LLONG);
  gen_cast("zm2zld",LLONG,LDOUBLE);
  gen_cast("zld2zum",LDOUBLE,ULLONG);
  gen_cast("zum2zld",ULLONG,LDOUBLE);
  gen_cast("zp2zum",POINTER,ULLONG);
  gen_cast("zum2zp",ULLONG,POINTER);
 
  fprintf(hout,"#define l2zm(x) %s((%s)(x))\n",castto(LLONG),nt[LLONG]);
  fprintf(hout,"#define ul2zum(x) %s((%s)(x))\n",castto(ULLONG),nt[ULLONG]);
  fprintf(hout,"#define d2zld(x) %s((%s)(x))\n",castto(LDOUBLE),nt[LDOUBLE]);
  fprintf(hout,"#define zm2l(x) ((long)%s(x))\n",castfrom(LLONG));
  fprintf(hout,"#define zum2ul(x) ((unsigned long)%s(x))\n",castfrom(ULLONG));
  fprintf(hout,"#define zld2d(x) ((double)%s(x))\n",castfrom(LDOUBLE));

  gen_2op("zmadd","+",LLONG);
  gen_2op("zumadd","+",ULLONG);
  gen_2op("zldadd","+",LDOUBLE);
  gen_2op("zmsub","-",LLONG);
  gen_2op("zumsub","-",ULLONG);
  gen_2op("zldsub","-",LDOUBLE);
  gen_2op("zmmult","*",LLONG);
  gen_2op("zummult","*",ULLONG);
  gen_2op("zldmult","*",LDOUBLE);
  gen_2op("zmdiv","/",LLONG);
  gen_2op("zumdiv","/",ULLONG);
  gen_2op("zlddiv","/",LDOUBLE);
  gen_2op("zmmod","%",LLONG);
  gen_2op("zummod","%",ULLONG);
  gen_2op("zmlshift","<<",LLONG);
  gen_2op("zumlshift","<<",ULLONG);
  gen_2op("zmrshift",">>",LLONG);
  gen_2op("zumrshift",">>",ULLONG);
  gen_2op("zmand","&",LLONG);
  gen_2op("zumand","&",ULLONG);
  gen_2op("zmor","|",LLONG);
  gen_2op("zumor","|",ULLONG);
  gen_2op("zmxor","^",LLONG);
  gen_2op("zumxor","^",ULLONG);
  gen_2op("zmmod","%",LLONG);
  gen_2op("zummod","%",ULLONG);

  gen_1op("zmkompl","~",LLONG);
  gen_1op("zumkompl","~",ULLONG);

  gen_cmp("zmleq","<=",LLONG);
  gen_cmp("zumleq","<=",ULLONG);
  gen_cmp("zldleq","<=",LDOUBLE);
  gen_cmp("zmeqto","==",LLONG);
  gen_cmp("zumeqto","==",ULLONG);
  gen_cmp("zldeqto","==",LDOUBLE);

  fprintf(hout,"#endif\n");

  fclose(fin);
  fclose(hout);
  fclose(cout);
  free(have);  
  return 0;
}
Example #14
0
void new_register(void)
{
	char userid[IDLEN + 1], passwd[PASSLEN], passbuf[PASSLEN], log[STRLEN];
#ifndef FDQUAN
	char code[IDLEN+1];
	const char *verify_num;
	int sec;
#endif

	if (dashf("NOREGISTER")) {
		ansimore("NOREGISTER", NA);
		pressreturn();
		return;
	}

	ansimore("etc/register", NA);

#ifndef FDQUAN
	if (!askyn("���Ƿ�ͬ�ⱾվAnnounce�澫����x-3Ŀ¼����վ��?", false, false))
		return 0;
#endif

	int tried = 0;
	prints("\n");
	while (1) {
		if (++tried >= 9) {
			prints("\n�ݰݣ���̫����  <Enter> ��...\n");
			refresh();
			return;
		}

#ifndef FDQUAN
		verify_num = generate_verify_num();
		getdata(0, 0, "������������ʾ������: ", code, IDLEN + 1, DOECHO, YEA);
#endif

		getdata(0, 0, "�������ʺ����� (Enter User ID, \"0\" to abort): ",
				userid, sizeof(userid), DOECHO, YEA);
		if (userid[0] == '0')
			return;
		const char *errmsg = invalid_userid(userid);
		if (errmsg != NULL) {
			outs(errmsg);
			continue;
		}

#ifndef FDQUAN
		sec = random() % 5;
		prints("Ϊ����������ע���߳�ͻ...�����ĵȺ� %d ��...\n", sec);
		oflush();
		sleep(sec);

		if (strcmp(verify_num, code)) {
			snprintf(log, sizeof(log), "verify '%s' error with code %s!=%s from %s",
					userid, verify_num, code, fromhost);
			report(log, currentuser.userid);
			prints("��Ǹ, ���������֤�벻��ȷ.\n");
			continue;
		}

		snprintf(log, sizeof(log), "verify '%s' with code %s from %s ", userid,
				code, fromhost);
		report(log, currentuser.userid);
#endif

		char path[HOMELEN];
		sethomepath(path, userid);
		if (dosearchuser(userid, &currentuser, &usernum) || dashd(path))
			prints("���ʺ��Ѿ�����ʹ��\n");
		else
			break;
	}

	for (tried = 0; tried <= MAX_SET_PASSWD_TRIES; ++tried) {
		passbuf[0] = '\0';
		getdata(0, 0, "���趨�������� (Setup Password): ", passbuf,
				sizeof(passbuf), NOECHO, YEA);
		if (strlen(passbuf) < 4 || !strcmp(passbuf, userid)) {
			prints("����̫�̻���ʹ���ߴ�����ͬ, ����������\n");
			continue;
		}
		strlcpy(passwd, passbuf, PASSLEN);
		getdata(0, 0, "��������һ���������� (Reconfirm Password): ", passbuf,
				PASSLEN, NOECHO, YEA);
		if (strncmp(passbuf, passwd, PASSLEN) != 0) {
			prints("�����������, ��������������.\n");
			continue;
		}
		passwd[8] = '\0';
		break;
	}
	if (tried > MAX_SET_PASSWD_TRIES)
		return;

	struct userec newuser;
#ifdef ALLOWSWITCHCODE
	fill_new_userec(&newuser, userid, passwd, !convcode);
#else
	fill_new_userec(&newuser, userid, passwd, true);
#endif

	/* added by roly */
	sprintf(genbuf, "/bin/rm -fr %s/mail/%c/%s", BBSHOME,
			toupper(newuser.userid[0]), newuser.userid) ;
	system(genbuf);
	sprintf(genbuf, "/bin/rm -fr %s/home/%c/%s", BBSHOME,
			toupper(newuser.userid[0]), newuser.userid) ;
	system(genbuf);
	/* add end */

	int allocid = getnewuserid();
	if (allocid > MAXUSERS || allocid <= 0) {
		prints("No space for new users on the system!\n\r");
		return;
	}
	setuserid(allocid, newuser.userid);
	if (substitut_record(PASSFILE, &newuser, sizeof(newuser), allocid) == -1) {
		prints("too much, good bye!\n");
		return;
	}
	if (!dosearchuser(newuser.userid, &currentuser, &usernum)) {
		prints("User failed to create\n");
		return;
	}

	snprintf(log, sizeof(log), "new account from %s", fromhost);
	report(log, currentuser.userid);

	prints("�����µ�¼ %s ����дע����Ϣ\n", newuser.userid);
	pressanykey();
	return;
}
Example #15
0
int kick_user( struct user_info *userinfo )
{
    int     id, ind;
    struct user_info uin;
    struct userec kuinfo;
    char    kickuser[40], buffer[40];

    if (uinfo.mode != LUSERS && uinfo.mode != OFFLINE && uinfo.mode != FRIEND)
    {
        modify_user_mode(ADMIN);
        stand_title("踢使用者下站");
        move(1, 0);
        usercomplete("输入使用者帐号: ", kickuser);
        if (*kickuser == '\0')
        {
            clear();
            return 0;
        }
        if (!(id = getuser(kickuser)))
        {
            move(3, 0);
            prints("无效的用户 ID!");
            clrtoeol();
            pressreturn();
            clear();
            return 0;
        }
        move(1, 0);
        clrtoeol();
        sprintf(genbuf,"踢掉使用者 : [%s].", kickuser);
        move(2, 0);
        if (askyn(genbuf, NA, NA) == NA)
        {
            move(2, 0);
            prints("取消踢使用者..\n");
            pressreturn();
            clear();
            return 0;
        }
        search_record(PASSFILE, &kuinfo, sizeof(kuinfo), cmpuids, kickuser);
        ind = search_ulist(&uin, t_cmpuids, id);
    }
    else
    {
        uin = *userinfo;
        strcpy(kickuser, uin.userid);
        ind = YEA;
    }
    if (!ind||!uin.active||(uin.pid && kill(uin.pid, 0)==-1))
    {
        if(uinfo.mode!=LUSERS&&uinfo.mode!=OFFLINE&&uinfo.mode!=FRIEND)
        {
            move(3, 0);
            prints("用户 [%s] 不在线上",kickuser);
            clrtoeol();
            pressreturn();
            clear();
        }
        return 0;
    }
    kill(uin.pid, SIGHUP);
    //sprintf(buffer, "kicked %s", kickuser);
    //report(buffer);
    if(strcmp(currentuser.userid , kickuser))
    {
        char    secu[STRLEN];
        sprintf(secu, "将用户[%s]踢下站", kickuser);
        securityreport(secu);
    }
    sprintf(genbuf, "%s (%s)", kuinfo.userid, kuinfo.username);
    log_usies("KICK ", genbuf);
    move(2, 0);
    if(uinfo.mode!=LUSERS&&uinfo.mode!=OFFLINE&&uinfo.mode!=FRIEND)
    {
        prints("用户 [%s] 已经被踢下站.\n",kickuser);
        pressreturn();
        clear();
    }
    return 1;
}
Example #16
0
File: friend.c Project: fbbs/fbbs
static int tui_unfollow(user_id_t uid)
{
	screen_move(-1, 0);
	//% return askyn("确定取消关注?", false, true) ? unfollow(session_get_user_id(), uid) : 0;
	return askyn("\xc8\xb7\xb6\xa8\xc8\xa1\xcf\xfb\xb9\xd8\xd7\xa2?", false, true) ? unfollow(session_get_user_id(), uid) : 0;
}
Example #17
0
File: xyz.c Project: fbbs/fbbs
//修改用户的档案
void x_edits() {
	char ans[7], buf[STRLEN];
	int ch, num, confirm;

	const char *e_file[] = {
		"plans", "signatures", "notes", "logout", NULL
	};

	//% "个人说明档", "签名档", "自己的备忘录", "离站的画面",
	//% "底部流动信息"
	const char *explain_file[] = {
		"\xb8\xf6\xc8\xcb\xcb\xb5\xc3\xf7\xb5\xb5",
		"\xc7\xa9\xc3\xfb\xb5\xb5",
		"\xd7\xd4\xbc\xba\xb5\xc4\xb1\xb8\xcd\xfc\xc2\xbc",
		"\xc0\xeb\xd5\xbe\xb5\xc4\xbb\xad\xc3\xe6",
		"\xb5\xd7\xb2\xbf\xc1\xf7\xb6\xaf\xd0\xc5\xcf\xa2",
		NULL
	};

	set_user_status(ST_GMENU);
	screen_clear();
	screen_move(1, 0);
	//% prints("编修个人档案\n\n");
	prints("\xb1\xe0\xd0\xde\xb8\xf6\xc8\xcb\xb5\xb5\xb0\xb8\n\n");
	for (num = 0; e_file[num] != NULL && explain_file[num] != NULL; num++) {
		prints("[%d] %s\n", num + 1, explain_file[num]);
	}
	//% prints("[%d] 都不想改\n", num + 1);
	prints("[%d] \xb6\xbc\xb2\xbb\xcf\xeb\xb8\xc4\n", num + 1);

	//% getdata(num + 5, 0, "您要编修哪一项个人档案: ", ans, 2, DOECHO, YEA);
	getdata(num + 5, 0, "\xc4\xfa\xd2\xaa\xb1\xe0\xd0\xde\xc4\xc4\xd2\xbb\xcf\xee\xb8\xf6\xc8\xcb\xb5\xb5\xb0\xb8: ", ans, 2, DOECHO, YEA);
	if (ans[0] - '0' <= 0 || ans[0] - '0' > num || ans[0] == '\n'
			|| ans[0] == '\0')
		return;

	ch = ans[0] - '0' - 1;
	setuserfile(genbuf, e_file[ch]);
	screen_move(3, 0);
	screen_clrtobot();
	//% sprintf(buf, "(E)编辑 (D)删除 %s? [E]: ", explain_file[ch]);
	sprintf(buf, "(E)\xb1\xe0\xbc\xad (D)\xc9\xbe\xb3\xfd %s? [E]: ", explain_file[ch]);
	getdata(3, 0, buf, ans, 2, DOECHO, YEA);
	if (ans[0] == 'D' || ans[0] == 'd') {
		//% confirm = askyn("您确定要删除这个档案", NA, NA);
		confirm = askyn("\xc4\xfa\xc8\xb7\xb6\xa8\xd2\xaa\xc9\xbe\xb3\xfd\xd5\xe2\xb8\xf6\xb5\xb5\xb0\xb8", NA, NA);
		if (confirm != 1) {
			screen_move(5, 0);
			//% prints("取消删除行动\n");
			prints("\xc8\xa1\xcf\xfb\xc9\xbe\xb3\xfd\xd0\xd0\xb6\xaf\n");
			pressreturn();
			screen_clear();
			return;
		}
		unlink(genbuf);
		screen_move(5, 0);
		//% prints("%s 已删除\n", explain_file[ch]);
		prints("%s \xd2\xd1\xc9\xbe\xb3\xfd\n", explain_file[ch]);
		sprintf(buf, "delete %s", explain_file[ch]);
		report(buf, currentuser.userid);
		pressreturn();
		screen_clear();
		return;
	}
	set_user_status(ST_EDITUFILE);
	editor_e status = editor(genbuf, false, false, true, NULL);
	screen_clear();
	if (status == EDITOR_SAVE) {
		//% prints("%s 更新过\n", explain_file[ch]);
		prints("%s \xb8\xfc\xd0\xc2\xb9\xfd\n", explain_file[ch]);
		sprintf(buf, "edit %s", explain_file[ch]);
		if (!strcmp(e_file[ch], "signatures")) {
			set_numofsig();
			//% prints("系统重新设定以及读入您的签名档...");
			prints("\xcf\xb5\xcd\xb3\xd6\xd8\xd0\xc2\xc9\xe8\xb6\xa8\xd2\xd4\xbc\xb0\xb6\xc1\xc8\xeb\xc4\xfa\xb5\xc4\xc7\xa9\xc3\xfb\xb5\xb5...");
		}
		report(buf, currentuser.userid);
	} else {
		//% prints("%s 取消修改\n", explain_file[ch]);
		prints("%s \xc8\xa1\xcf\xfb\xd0\xde\xb8\xc4\n", explain_file[ch]);
	}
	pressreturn();
}
Example #18
0
void check_register_info(void)
{
	struct userec *urec = &currentuser;
	FILE *fout;
	char buf[192], buf2[STRLEN];
	if (!(urec->userlevel & PERM_LOGIN)) {
		urec->userlevel = 0;
		return;
	}
#ifdef NEWCOMERREPORT
	if (urec->numlogins == 1) {
		screen_clear();
		file_temp_name(buf, sizeof(buf));
		if ((fout = fopen(buf, "w")) != NULL) {
			//% fprintf(fout, "大家好,\n\n");
			fprintf(fout, "\xb4\xf3\xbc\xd2\xba\xc3,\n\n");
			//% fprintf(fout, "我是 %s (%s), 来自 %s\n",
			fprintf(fout, "\xce\xd2\xca\xc7 %s (%s), \xc0\xb4\xd7\xd4 %s\n",
					currentuser.userid, urec->username, fromhost);
			//% fprintf(fout, "今天%s初来此站报到, 请大家多多指教。\n",
			fprintf(fout, "\xbd\xf1\xcc\xec%s\xb3\xf5\xc0\xb4\xb4\xcb\xd5\xbe\xb1\xa8\xb5\xbd, \xc7\xeb\xb4\xf3\xbc\xd2\xb6\xe0\xb6\xe0\xd6\xb8\xbd\xcc\xa1\xa3\n",
					//% (urec->gender == 'M') ? "小弟" : "小女子");
					(urec->gender == 'M') ? "\xd0\xa1\xb5\xdc" : "\xd0\xa1\xc5\xae\xd7\xd3");
			screen_move(2, 0);
			//% prints("非常欢迎 %s 光临本站,希望您能在本站找到属于自己的一片天空!\n\n", currentuser.userid);
			prints("\xb7\xc7\xb3\xa3\xbb\xb6\xd3\xad %s \xb9\xe2\xc1\xd9\xb1\xbe\xd5\xbe\xa3\xac\xcf\xa3\xcd\xfb\xc4\xfa\xc4\xdc\xd4\xda\xb1\xbe\xd5\xbe\xd5\xd2\xb5\xbd\xca\xf4\xd3\xda\xd7\xd4\xbc\xba\xb5\xc4\xd2\xbb\xc6\xac\xcc\xec\xbf\xd5\xa3\xa1\n\n", currentuser.userid);
			//% prints("请您作个简短的个人简介, 向本站其他使用者打个招呼\n");
			prints("\xc7\xeb\xc4\xfa\xd7\xf7\xb8\xf6\xbc\xf2\xb6\xcc\xb5\xc4\xb8\xf6\xc8\xcb\xbc\xf2\xbd\xe9, \xcf\xf2\xb1\xbe\xd5\xbe\xc6\xe4\xcb\xfb\xca\xb9\xd3\xc3\xd5\xdf\xb4\xf2\xb8\xf6\xd5\xd0\xba\xf4\n");
			//% prints("(简介最多三行, 写完可直接按 <Enter> 跳离)....");
			prints("(\xbc\xf2\xbd\xe9\xd7\xee\xb6\xe0\xc8\xfd\xd0\xd0, \xd0\xb4\xcd\xea\xbf\xc9\xd6\xb1\xbd\xd3\xb0\xb4 <Enter> \xcc\xf8\xc0\xeb)....");
			getdata(6, 0, ":", buf2, 75, DOECHO, YEA);
			if (buf2[0] != '\0') {
				//% fprintf(fout, "\n\n自我介绍:\n\n");
				fprintf(fout, "\n\n\xd7\xd4\xce\xd2\xbd\xe9\xc9\xdc:\n\n");
				fprintf(fout, "%s\n", buf2);
				getdata(7, 0, ":", buf2, 75, DOECHO, YEA);
				if (buf2[0] != '\0') {
					fprintf(fout, "%s\n", buf2);
					getdata(8, 0, ":", buf2, 75, DOECHO, YEA);
					if (buf2[0] != '\0') {
						fprintf(fout, "%s\n", buf2);
					}
				}
			}
			fclose(fout);
			//% sprintf(buf2, "新手上路: %s", urec->username);
			sprintf(buf2, "\xd0\xc2\xca\xd6\xc9\xcf\xc2\xb7: %s", urec->username);
			Postfile(buf, "newcomers", buf2, 2);
			unlink(buf);
		}
		pressanykey();
	}
#endif
#ifndef FDQUAN
	//检查邮箱
	while (!HAS_PERM(PERM_BINDMAIL)) {
		screen_clear();
		if (HAS_PERM(PERM_REGISTER)) {
			//% while (askyn("是否绑定复旦邮箱", NA, NA)== NA)
			while (askyn("\xca\xc7\xb7\xf1\xb0\xf3\xb6\xa8\xb8\xb4\xb5\xa9\xd3\xca\xcf\xe4", NA, NA)== NA)
			//add  by eefree.06.7.20
			{
				//% if (askyn("是否填写校友信息", NA, NA) == NA) {
				if (askyn("\xca\xc7\xb7\xf1\xcc\xee\xd0\xb4\xd0\xa3\xd3\xd1\xd0\xc5\xcf\xa2", NA, NA) == NA) {
					screen_clear();
					continue;
				}
				check_reg_extra();
				return;
			}
			//add end.
		}
		tui_check_reg_mail();
	}
#endif

	screen_clear();
	if (HAS_PERM(PERM_REGISTER))
		return;
#ifndef AUTOGETPERM

	if (check_register_ok()) {
#endif
		set_safe_record();
		urec->userlevel |= PERM_DEFAULT;
		substitut_record(PASSFILE, urec, sizeof(struct userec), usernum);
		return;
#ifndef AUTOGETPERM

	}
#endif

	if (!chkmail())
		fill_reg_form();
}
Example #19
0
/**
 * Telnet register interface.
 */
void new_register(void)
{
	char userid[IDLEN + 1], passwd[PASSLEN], passbuf[PASSLEN], log[STRLEN];
	const char *errmsg;

	if (register_closed()) {
		ansimore("NOREGISTER", NA);
		pressreturn();
		return;
	}

	ansimore("etc/register", NA);
#ifndef FDQUAN
	//% if (!askyn("您是否同意本站Announce版精华区x-3目录所列站规?", false, false))
	if (!askyn("\xc4\xfa\xca\xc7\xb7\xf1\xcd\xac\xd2\xe2\xb1\xbe\xd5\xbe""Announce\xb0\xe6\xbe\xab\xbb\xaa\xc7\xf8x-3\xc4\xbf\xc2\xbc\xcb\xf9\xc1\xd0\xd5\xbe\xb9\xe6?", false, false))
		return;
#endif

	int tried = 0;
	prints("\n");
	while (1) {
		if (++tried >= MAX_NEW_TRIES) {
			//% outs("\n拜拜,按太多下  <Enter> 了...\n");
			outs("\n\xb0\xdd\xb0\xdd\xa3\xac\xb0\xb4\xcc\xab\xb6\xe0\xcf\xc2  <Enter> \xc1\xcb...\n");
			screen_flush();
			return;
		}

		//% getdata(0, 0, "请输入帐号名称 (Enter User ID, \"0\" to abort): ",
		getdata(0, 0, "\xc7\xeb\xca\xe4\xc8\xeb\xd5\xca\xba\xc5\xc3\xfb\xb3\xc6 (Enter User ID, \"0\" to abort): ",
				userid, sizeof(userid), DOECHO, YEA);
		if (userid[0] == '0')
			return;
		errmsg = register_invalid_user_name(userid);
		if (errmsg != NULL) {
			outs(errmsg);
			continue;
		}

		char path[HOMELEN];
		sethomepath(path, userid);
		if (dosearchuser(userid, &currentuser, &usernum) || dashd(path)) {
			//% outs("此帐号已经有人使用\n");
			outs("\xb4\xcb\xd5\xca\xba\xc5\xd2\xd1\xbe\xad\xd3\xd0\xc8\xcb\xca\xb9\xd3\xc3\n");
			continue;
		}
#ifndef REG_CAPTCHA
		break;
#else
		char link[STRLEN], attempt[CAPTCHA_LEN + 1], answer[CAPTCHA_LEN + 1];
		int lnum;
		int pos = gen_captcha_link(link, sizeof(link), &lnum);
		if (pos < 0)
			return;

		prints("http://"BBSHOST"/captcha/%d.gif\n", lnum);
		//% getdata(0, 0, "请输入上图所包含的英文字母: ", attempt, sizeof(attempt),
		getdata(0, 0, "\xc7\xeb\xca\xe4\xc8\xeb\xc9\xcf\xcd\xbc\xcb\xf9\xb0\xfc\xba\xac\xb5\xc4\xd3\xa2\xce\xc4\xd7\xd6\xc4\xb8: ", attempt, sizeof(attempt),
				DOECHO, YEA);
		unlink(link);

		get_captcha_answer(pos, answer, sizeof(answer));
		if (strcasecmp(answer, attempt) != 0) {
			//% outs("验证码输入错误...\n");
			outs("\xd1\xe9\xd6\xa4\xc2\xeb\xca\xe4\xc8\xeb\xb4\xed\xce\xf3...\n");
			continue;
		} else {
			break;
		}
#endif // REG_CAPTCHA
	}

	for (tried = 0; tried <= MAX_SET_PASSWD_TRIES; ++tried) {
		passbuf[0] = '\0';
		//% getdata(0, 0, "请设定您的密码 (Setup Password): ", passbuf,
		getdata(0, 0, "\xc7\xeb\xc9\xe8\xb6\xa8\xc4\xfa\xb5\xc4\xc3\xdc\xc2\xeb (Setup Password): ", passbuf,
				sizeof(passbuf), NOECHO, YEA);
		errmsg = register_invalid_password(passbuf, userid);
		if (errmsg) {
			outs(errmsg);
			continue;
		}
		strlcpy(passwd, passbuf, PASSLEN);
		//% getdata(0, 0, "请再输入一次您的密码 (Confirm Password): ", passbuf,
		getdata(0, 0, "\xc7\xeb\xd4\xd9\xca\xe4\xc8\xeb\xd2\xbb\xb4\xce\xc4\xfa\xb5\xc4\xc3\xdc\xc2\xeb (Confirm Password): ", passbuf,
				PASSLEN, NOECHO, YEA);
		if (strncmp(passbuf, passwd, PASSLEN) != 0) {
			//% prints("密码输入错误, 请重新输入密码\n");
			prints("\xc3\xdc\xc2\xeb\xca\xe4\xc8\xeb\xb4\xed\xce\xf3, \xc7\xeb\xd6\xd8\xd0\xc2\xca\xe4\xc8\xeb\xc3\xdc\xc2\xeb\n");
			continue;
		}
		passwd[8] = '\0';
		break;
	}
	if (tried > MAX_SET_PASSWD_TRIES)
		return;

	struct userec user;
	init_userec(&user, userid, passwd, true);
	strlcpy(user.lasthost, fromhost, sizeof(user.lasthost));

	if (create_user(&user) < 0) {
		outs("Failed to create user.\n");
		return;
	}

	snprintf(log, sizeof(log), "new account from %s", fromhost);
	report(log, currentuser.userid);

	//% prints("请重新登录 %s 并填写注册信息\n", user.userid);
	prints("\xc7\xeb\xd6\xd8\xd0\xc2\xb5\xc7\xc2\xbc %s \xb2\xa2\xcc\xee\xd0\xb4\xd7\xa2\xb2\xe1\xd0\xc5\xcf\xa2\n", user.userid);
	pressanykey();
	return;
}
Example #20
0
void tui_check_reg_mail(void)
{
	//% char email[EMAIL_LEN] = "您的邮箱", file[HOMELEN], buf[RNDPASSLEN + 1];
	char email[EMAIL_LEN] = "\xc4\xfa\xb5\xc4\xd3\xca\xcf\xe4", file[HOMELEN], buf[RNDPASSLEN + 1];
	int i = 0;

	sethomefile(file, currentuser.userid, REG_CODE_FILE);
	if (!dashf(file)) {
		screen_move(1, 0);
		//% outs("    请输入您的复旦邮箱([email protected]/alu.fudan.edu.cn)\n"
		outs("    \xc7\xeb\xca\xe4\xc8\xeb\xc4\xfa\xb5\xc4\xb8\xb4\xb5\xa9\xd3\xca\xcf\xe4([email protected]/alu.fudan.edu.cn)\n"
				//% "    \033[1;32m本站采用复旦邮箱绑定认证,将发送认证码至您的复旦邮箱\033[m");
				"    \033[1;32m\xb1\xbe\xd5\xbe\xb2\xc9\xd3\xc3\xb8\xb4\xb5\xa9\xd3\xca\xcf\xe4\xb0\xf3\xb6\xa8\xc8\xcf\xd6\xa4\xa3\xac\xbd\xab\xb7\xa2\xcb\xcd\xc8\xcf\xd6\xa4\xc2\xeb\xd6\xc1\xc4\xfa\xb5\xc4\xb8\xb4\xb5\xa9\xd3\xca\xcf\xe4\033[m");
		do {
			getdata(3, 0, "    E-Mail:> ", email, sizeof(email), DOECHO, YEA);
			if (!valid_addr(email) || !register_domain_allowed(email)
					|| !register_email_allowed(email)) {
				//% prints("    对不起, 该email地址无效, 请重新输入 \n");
				prints("    \xb6\xd4\xb2\xbb\xc6\xf0, \xb8\xc3""email\xb5\xd8\xd6\xb7\xce\xde\xd0\xa7, \xc7\xeb\xd6\xd8\xd0\xc2\xca\xe4\xc8\xeb \n");
				continue;
			} else
				break;
		} while (1);

		register_send_email(&currentuser, email);
	}

	screen_move_clear(4);
	screen_move(5, 0);
	//% prints(" \033[1;33m   认证码已发送到 %s ,请查收\033[m\n", email);
	prints(" \033[1;33m   \xc8\xcf\xd6\xa4\xc2\xeb\xd2\xd1\xb7\xa2\xcb\xcd\xb5\xbd %s \xa3\xac\xc7\xeb\xb2\xe9\xca\xd5\033[m\n", email);

	screen_move(7, 0);
	//% if (askyn("    现在输入认证码么?", true, false)) {
	if (askyn("    \xcf\xd6\xd4\xda\xca\xe4\xc8\xeb\xc8\xcf\xd6\xa4\xc2\xeb\xc3\xb4\xa3\xbf", true, false)) {
		screen_move(9, 0);
		//% outs("请输入注册确认信里, \"认证码\"来做为身份确认\n");
		outs("\xc7\xeb\xca\xe4\xc8\xeb\xd7\xa2\xb2\xe1\xc8\xb7\xc8\xcf\xd0\xc5\xc0\xef, \"\xc8\xcf\xd6\xa4\xc2\xeb\"\xc0\xb4\xd7\xf6\xce\xaa\xc9\xed\xb7\xdd\xc8\xb7\xc8\xcf\n");
		//% prints("一共是 %d 个字符, 大小写是有差别的, 请注意.\n", RNDPASSLEN);
		prints("\xd2\xbb\xb9\xb2\xca\xc7 %d \xb8\xf6\xd7\xd6\xb7\xfb, \xb4\xf3\xd0\xa1\xd0\xb4\xca\xc7\xd3\xd0\xb2\xee\xb1\xf0\xb5\xc4, \xc7\xeb\xd7\xa2\xd2\xe2.\n", RNDPASSLEN);
		//% outs("请注意, 请输入最新一封认证信中所包含的乱数密码!\n\n"
		outs("\xc7\xeb\xd7\xa2\xd2\xe2, \xc7\xeb\xca\xe4\xc8\xeb\xd7\xee\xd0\xc2\xd2\xbb\xb7\xe2\xc8\xcf\xd6\xa4\xd0\xc5\xd6\xd0\xcb\xf9\xb0\xfc\xba\xac\xb5\xc4\xc2\xd2\xca\xfd\xc3\xdc\xc2\xeb\xa3\xa1\n\n"
				//% "\033[1;31m提示:注册码输错 3次后系统将要求您重填需绑定的邮箱。\033[m\n");
				"\033[1;31m\xcc\xe1\xca\xbe\xa3\xba\xd7\xa2\xb2\xe1\xc2\xeb\xca\xe4\xb4\xed 3\xb4\xce\xba\xf3\xcf\xb5\xcd\xb3\xbd\xab\xd2\xaa\xc7\xf3\xc4\xfa\xd6\xd8\xcc\xee\xd0\xe8\xb0\xf3\xb6\xa8\xb5\xc4\xd3\xca\xcf\xe4\xa1\xa3\033[m\n");

		for (i = 0; i < 3; i++) {
			screen_move(15, 0);
			//% prints("您还有 %d 次机会\n", 3 - i);
			prints("\xc4\xfa\xbb\xb9\xd3\xd0 %d \xb4\xce\xbb\xfa\xbb\xe1\n", 3 - i);
			//% getdata(16, 0, "请输入认证码: ", buf, sizeof(buf), DOECHO, YEA);
			getdata(16, 0, "\xc7\xeb\xca\xe4\xc8\xeb\xc8\xcf\xd6\xa4\xc2\xeb: ", buf, sizeof(buf), DOECHO, YEA);
			if (register_activate_email(currentuser.userid, buf))
				break;
		}
	}

	if (i == 3) {
		unlink(file);
		//% prints("认证失败! 请重填邮箱。\n");
		prints("\xc8\xcf\xd6\xa4\xca\xa7\xb0\xdc! \xc7\xeb\xd6\xd8\xcc\xee\xd3\xca\xcf\xe4\xa1\xa3\n");
		sethomefile(file, currentuser.userid, ".regextra");
		if (dashf(file))
			unlink(file);
		pressanykey();
	} else {
		//% prints("认证成功!\n");
		prints("\xc8\xcf\xd6\xa4\xb3\xc9\xb9\xa6!\n");
		sethomefile(file, currentuser.userid, ".regextra");
		if (dashf(file)) {
			//% prints("我们将暂时保留您的正常使用权限,如果核对您输入的个人信息有误将停止您的发文权限,\n");
			prints("\xce\xd2\xc3\xc7\xbd\xab\xd4\xdd\xca\xb1\xb1\xa3\xc1\xf4\xc4\xfa\xb5\xc4\xd5\xfd\xb3\xa3\xca\xb9\xd3\xc3\xc8\xa8\xcf\xde,\xc8\xe7\xb9\xfb\xba\xcb\xb6\xd4\xc4\xfa\xca\xe4\xc8\xeb\xb5\xc4\xb8\xf6\xc8\xcb\xd0\xc5\xcf\xa2\xd3\xd0\xce\xf3\xbd\xab\xcd\xa3\xd6\xb9\xc4\xfa\xb5\xc4\xb7\xa2\xce\xc4\xc8\xa8\xcf\xde,\n");
			//% prints("因此请确保您输入的是个人真实信息.\n");
			prints("\xd2\xf2\xb4\xcb\xc7\xeb\xc8\xb7\xb1\xa3\xc4\xfa\xca\xe4\xc8\xeb\xb5\xc4\xca\xc7\xb8\xf6\xc8\xcb\xd5\xe6\xca\xb5\xd0\xc5\xcf\xa2.\n");
		}
		if (!HAS_PERM(PERM_REGISTER)) {
			//% prints("请继续填写注册单。\n");
			prints("\xc7\xeb\xbc\xcc\xd0\xf8\xcc\xee\xd0\xb4\xd7\xa2\xb2\xe1\xb5\xa5\xa1\xa3\n");
		}
		pressanykey();
	}
}
Example #21
0
int b_notes_edit()
{
	char buf[STRLEN], buf2[STRLEN];
	char ans[4];
	int aborted;
	int notetype;

	if (!chkBM(currbp, &currentuser))
		return 0;
	clear();
	move(0, 0);
	prints("�趨��\n\n  (1)һ�㱸��¼\n  (2)���ܱ���¼\n");
	prints("  (3)����ǰ׺��\n  (4)�Ƿ�ǿ��ʹ��ǰ׺\n");
	while (1) {
		getdata(7, 0,"��ǰѡ��[1](0~4): ", ans, 2, DOECHO, YEA);
		if (ans[0] == '0')
		return FULLUPDATE;
		if (ans[0] == '\0')
		strcpy(ans, "1");
		if (ans[0] >= '1' && ans[0] <= '4' )
		break;
	}
	makevdir(currboard); //��������¼Ŀ¼
	notetype = ans[0] - '0';
	if (notetype == 2) {
		setvfile(buf, currboard, "secnotes");
	} else if (notetype == 3) {
		setvfile(buf, currboard, "prefix");
	} else if (notetype == 1) {
		setvfile(buf, currboard, "notes");
	} else if (notetype == 4 ) {
		int pos;
		struct boardheader fh;
		pos = search_record(BOARDS, &fh, sizeof(fh), cmpbnames, currboard);

		if (askyn("�Ƿ�ǿ��ʹ��ǰ׺��", (fh.flag & BOARD_PREFIX_FLAG)?YEA:NA,NA)) {
			fh.flag |= BOARD_PREFIX_FLAG;
		} else {
			fh.flag &= ~BOARD_PREFIX_FLAG;
		}
		substitute_record(BOARDS, &fh, sizeof(fh), pos);
		return FULLUPDATE;
	}
	sprintf(buf2, "(E)�༭ (D)ɾ�� %4s? [E]: ",
			(notetype == 3)?"����ǰ׺��":(notetype == 1) ? "һ�㱸��¼" : "���ܱ���¼");
	getdata(8, 0, buf2, ans, 2, DOECHO, YEA); //ѯ�ʱ༭����ɾ��
	if (ans[0] == 'D' || ans[0] == 'd') { //ɾ������¼
		move(9, 0);
		sprintf(buf2, "���Ҫɾ��ô��");
		if (askyn(buf2, NA, NA)) {
			move(10, 0);
			prints("�Ѿ�ɾ��...\n");
			pressanykey();
			unlink(buf);
			aborted = 1;
		} else
		aborted = -1;
	} else
	aborted = vedit(buf, NA, YEA); //�༭����¼
	if (aborted == -1) {
		pressreturn();
	} else {
		if (notetype == 1)
		setvfile(buf, currboard, "noterec");
		else
		setvfile(buf, currboard, "notespasswd");
		unlink(buf);
	}

	return FULLUPDATE;
}
Example #22
0
void check_register_info() {
	struct userec *urec = &currentuser;
	FILE *fout;
	char buf[192], buf2[STRLEN];
#ifdef MAILCHECK

	char ans[4];
#ifdef CODE_VALID

	int i;
#endif
#endif

	if (!(urec->userlevel & PERM_LOGIN)) {
		urec->userlevel = 0;
		return;
	}
#ifdef NEWCOMERREPORT
	if (urec->numlogins == 1) {
		clear();
		sprintf(buf, "tmp/newcomer.%s", currentuser.userid);
		if ((fout = fopen(buf, "w")) != NULL) {
			fprintf(fout, "��Һ�,\n\n");
			fprintf(fout, "���� %s (%s), ���� %s\n",
					currentuser.userid, urec->username, fromhost);
			fprintf(fout, "����%s������վ����, ���Ҷ��ָ�̡�\n",
					(urec->gender == 'M') ? "С��" : "СŮ��");
			move(2, 0);
			prints("�dz���ӭ %s ���ٱ�վ��ϣ�������ڱ�վ�ҵ������Լ���һƬ��գ�\n\n", currentuser.userid);
			prints("����������̵ĸ��˼��, ��վ����ʹ���ߴ���к�\n");
			prints("(����������, д���ֱ�Ӱ� <Enter> ����)....");
			getdata(6, 0, ":", buf2, 75, DOECHO, YEA);
			if (buf2[0] != '\0') {
				fprintf(fout, "\n\n���ҽ���:\n\n");
				fprintf(fout, "%s\n", buf2);
				getdata(7, 0, ":", buf2, 75, DOECHO, YEA);
				if (buf2[0] != '\0') {
					fprintf(fout, "%s\n", buf2);
					getdata(8, 0, ":", buf2, 75, DOECHO, YEA);
					if (buf2[0] != '\0') {
						fprintf(fout, "%s\n", buf2);
					}
				}
			}
			fclose(fout);
			sprintf(buf2, "������·: %s", urec->username);
			Postfile(buf, "newcomers", buf2, 2);
			unlink(buf);
		}
		pressanykey();
	}
#endif
#ifdef PASSAFTERTHREEDAYS
	if (urec->lastlogin - urec->firstlogin < 3 * 86400) {
		if (!HAS_PERM(PERM_SYSOP)) {
			set_safe_record();
			urec->userlevel &= ~(PERM_DEFAULT);
			urec->userlevel |= PERM_LOGIN;
			substitut_record(PASSFILE, urec, sizeof(struct userec), usernum);
			ansimore("etc/newregister", YEA);
			return;
		}
	}
#endif
#ifndef FDQUAN
	//�������
	while (!HAS_PERM(PERM_BINDMAIL)) {
		clear();
		if (HAS_PERM(PERM_REGISTER)) {
			while (askyn("�Ƿ�󶨸�������", NA, NA)== NA)
			//add  by eefree.06.7.20
			{
				if (askyn("�Ƿ���дУ����Ϣ", NA, NA) == NA) {
					clear();
					continue;
				}
				check_reg_extra();
				return;
			}
			//add end.
		}
		check_reg_mail();
	}

#endif

	clear();
	if (HAS_PERM(PERM_REGISTER))
		return;
#ifndef AUTOGETPERM

	if (check_register_ok()) {
#endif
		set_safe_record();
		urec->userlevel |= PERM_DEFAULT;
		substitut_record(PASSFILE, urec, sizeof(struct userec), usernum);
		return;
#ifndef AUTOGETPERM

	}
#endif

#ifdef MAILCHECK
#ifdef CODE_VALID
	sethomefile(buf, currentuser.userid, ".regpass");
	if (dashf(buf)) {
		move(13, 0);
		prints("����δͨ�����ȷ��... \n");
		prints("�����ڱ�������ע��ȷ������, \"��֤����\"����Ϊ���ȷ��\n");
		prints("һ���� %d ���ַ�, ��Сд���в���, ��ע��.\n", RNDPASSLEN);
		prints("����ȡ�������������� [Enter] ��.\n");
		prints("��ע��, ����������һ����֤�������������������룡\n");
		if ((fout = fopen(buf, "r")) != NULL) {
			fscanf(fout, "%s", buf2);
			fclose(fout);
			for (i = 0; i < 3; i++) {
				move(18, 0);
				prints("������ %d ���\n", 3 - i);
				getdata(19,0,"��������֤����: ",genbuf,(RNDPASSLEN+1),DOECHO,YEA);
				if (strcmp(genbuf, "") != 0) {
					if (strcmp(genbuf, buf2) != 0)
					continue;
					else
					break;
				}
			}
		} else
		i = 3;
		if (i == 3) {
			prints("������֤ʧ��! ����Ҫ��дע�ᵥ�����ȷ������ȷ���������\n");
			getdata(22,0,"��ѡ��1.��ע�ᵥ 2.����ȷ���� [1]:",ans,2,DOECHO,YEA);
			if(ans[0] == '2') {
				send_regmail(&currentuser);
				pressanykey();
			} else
			x_fillform();
		} else {
			set_safe_record();
			urec->userlevel |= PERM_DEFAULT;
			substitut_record(PASSFILE, urec,sizeof(struct userec), usernum);
			prints("������!! ����˳����ɱ�վ��ʹ����ע������,\n");
			prints("������������ӵ��һ��ʹ���ߵ�Ȩ��������...\n");
			unlink(buf);
			mail_file("etc/smail", "SYSOP", "��ӭ���뱾վ����");
			pressanykey();
		}
		return;
	}
#endif
	if ( (!strstr(urec->email, BBSHOST)) && (!invalidaddr(urec->email)) &&
			(!invalid_email(urec->email))) {
		move(13, 0);
		prints("���ĵ������� ����ͨ��������֤...  \n");
		prints("    ��վ�����ϼ�һ����֤�Ÿ���,\n");
		prints("    ��ֻҪ�� %s ����, �Ϳ��Գ�Ϊ��վ�ϸ���.\n\n", urec->email);
		prints("    ��Ϊ��վ�ϸ���, �������и����Ȩ���!\n");
		prints("    ��Ҳ����ֱ����дע�ᵥ��Ȼ��ȴ�վ�����ֹ���֤��\n");
		getdata(21,0,"��ѡ��1.��ע�ᵥ 2.��ȷ���� [1]: ",ans,2,DOECHO,YEA);
		if(ans[0] == '2') {
			send_regmail(&currentuser);
			getdata(21,0,"ȷ�����Ѽij�, ��������Ŷ!! ",ans, 2, DOECHO, YEA);
			return;
		}
	}
#endif
	/* Following line modified by Amigo 2002.04.23. Fill form only when no new letter. */
	/*   x_fillform();*/
	if (!chkmail())
		x_fillform();
}
Example #23
0
int deal_gopherkey(char ch, int allnum, int pagenum)
{
	char    fname[STRLEN], fpath[STRLEN];
#ifdef INTERNET_EMAIL

	struct shortfile fhdr;
#endif

	switch (ch)
	{
	case 'h':
	case 'H':
		show_help("help/announcereadhelp");
		g_refresh();
		break;
	case 'E':
	case 'e':
		tmpitem = nth_item(allnum - pagenum);
		setuserfile(fname, "gopher.tmp");
		if (tmpitem->title[0] != '0')
		{
			return 1;
		}
		if (get_con(tmpitem->server, tmpitem->port) == -1)
			return 1;
		enterdir(tmpitem->file);
		savetmpfile(fname);
		if (dashf(fname))
		{
			vedit(fname, NA, YEA);
			unlink(fname);
			g_refresh();
		}
		show_message(NULL);
		break;
	case '=':
		{
			tmpitem = nth_item(allnum - pagenum);
			move(2, 0);
			clrtobot();
			prints("");
			printdash("BBS Gopher Îï¼þ»ù±¾×ÊÁÏ");
			prints("");
			prints("ÀàÐÍ£º%c (%s)\n", tmpitem->title[0], (tmpitem->title[0] == '0') ? "Îļþ" : "Ŀ¼");
			prints("±êÌ⣺%s\n", tmpitem->title + 1);
			prints("·¾¶£º%s\n", tmpitem->file);
			prints("λÖãº%s\n", tmpitem->server);
			prints("ʹÓãº%d²º\n", tmpitem->port);
			pressanykey();
			g_refresh();
		}
		break;
	case Ctrl('P'):
					tmpitem = nth_item(allnum - pagenum);
		if (!HAS_PERM(PERM_POST))
			break;
		setuserfile(fname, "gopher.tmp");
		if (tmpitem->title[0] != '0')
{
			return 1;
		}
		if (get_con(tmpitem->server, tmpitem->port) == -1)
			return 1;
		enterdir(tmpitem->file);
		savetmpfile(fname);
		if (dashf(fname))
		{
			char    bname[30];
			clear();
			if (get_a_boardname(bname, "ÇëÊäÈëҪתÌùµÄÌÖÂÛÇøÃû³Æ: "))
			{
				move(1, 0);
				sprintf(fpath, "ÄãÈ·¶¨Òª×ªÌùµ½ %s °åÂð", bname);
				if (askyn(fpath, NA, NA) == 1)
				{
					move(2, 0);
					Postfile(fname, bname, tmpitem->title + 1, 2);
					sprintf(fpath, "ÒѾ­°ïÄãתÌùµ½ %s °åÁË...", bname);
					prints(fpath);
					refresh();
					sleep(1);
				}
			}
		}
		unlink(fname);
		g_refresh();
		return 1;
#ifdef INTERNET_EMAIL

	case 'U':
	case 'F':
	case 'u':
	case 'f':
	case 'z':
	case 'Z':
		tmpitem = nth_item(allnum - pagenum);
		setuserfile(fname, "gopher.tmp");
		if (tmpitem->title[0] != '0')
		{
			return 1;
		}
		if (get_con(tmpitem->server, tmpitem->port) == -1)
			return 1;
		enterdir(tmpitem->file);
		savetmpfile(fname);
		if (dashf(fname))
		{
			strncpy(fhdr.title, tmpitem->title + 1, 70);
			strncpy(fhdr.filename, "gopher.tmp", STRLEN);
			sethomepath(fpath, currentuser.userid);
			//			if (ch == 'Z' || ch == 'z')
			//				a_download(fname);
			//			else {
			switch (doforward(fpath, &fhdr, (ch == 'u' || ch == 'U') ? 1 : 0))
			{
			case 0:
				show_message("ÎÄÕÂת¼ÄÍê³É!");
				break;
			case -1:
				show_message("system error!!.");
				break;
			case -2:
				show_message("invalid address.");
				break;
			default:
				show_message("È¡Ïûת¼Ä¶¯×÷.");
			}
			//			}
			refresh();
			pressanykey();
			g_refresh();
			unlink(fname);
			return 1;
		}
		else
			return 1;
		break;
#endif

	default:
		return 0;
	}
	return 1;
}
Example #24
0
int uinfo_query(struct userec *u, int real, int unum)
{
	struct userec newinfo;
	char    ans[3], buf[STRLEN], genbuf[128];
	char    src[STRLEN], dst[STRLEN];
	int     i, fail = 0 ;
#ifdef MAILCHANGED

	int    netty_check = 0;
#endif

	time_t  now;
	struct tm *tmnow;
	memcpy(&newinfo, u, sizeof(currentuser));
	getdata(t_lines - 1, 0, real ?
	        "��ѡ�� (0)���� (1)�޸����� (2)�趨���� (3) �� ID ==> [0]" :
	        "��ѡ�� (0)���� (1)�޸����� (2)�趨���� (3) ѡǩ���� ==> [0]",
	        ans, 2, DOECHO, YEA);
	clear();
	refresh();
	now = time(0);
	tmnow = localtime(&now);

	i = 3;
	move(i++, 0);
	if (ans[0] != '3' || real)
		prints("ʹ���ߴ���: %s\n", u->userid);
	switch (ans[0])
	{
	case '1':
		move(1, 0);
		prints("�������޸�,ֱ�Ӱ� <ENTER> ����ʹ�� [] �ڵ����ϡ�\n");
		sprintf(genbuf, "�dz� [%s]: ", u->username);
		getdata(i++, 0, genbuf, buf, NAMELEN, DOECHO, YEA);
		if (buf[0])
			strncpy(newinfo.username, buf, NAMELEN);

		sprintf(genbuf, "��ʵ���� [%s]: ", u->realname);
		getdata(i++, 0, genbuf, buf, NAMELEN, DOECHO, YEA);
		if (buf[0])
			strncpy(newinfo.realname, buf, NAMELEN);

		sprintf(genbuf, "��ס��ַ [%s]: ", u->address);
		getdata(i++, 0, genbuf, buf, STRLEN - 10, DOECHO, YEA);
		if (buf[0])
			strncpy(newinfo.address, buf, NAMELEN);

		sprintf(genbuf, "�������� [%s]: ", u->email);
		getdata(i++, 0, genbuf, buf, 48, DOECHO, YEA);
		if (buf[0])
		{
#ifdef MAILCHECK
#ifdef MAILCHANGED
			if(u->uid == usernum)
				netty_check = 1;
#endif
#endif

			strncpy(newinfo.email, buf, 48);
		}

		sprintf(genbuf, "�ն˻���̬ [%s]: ", u->termtype);
		getdata(i++, 0, genbuf, buf, 16, DOECHO, YEA);
		if (buf[0])
			strncpy(newinfo.termtype, buf, 16);

		sprintf(genbuf, "������ [%d]: ", u->birthyear + 1900);
		getdata(i++, 0, genbuf, buf, 5, DOECHO, YEA);
		if (   buf[0] && atoi(buf) > 1920 && atoi(buf) < 1998)
			newinfo.birthyear = atoi(buf) - 1900;

		sprintf(genbuf, "������ [%d]: ", u->birthmonth);
		getdata(i++, 0, genbuf, buf, 3, DOECHO, YEA);
		if (buf[0] && atoi(buf) >= 1 && atoi(buf) <= 12)
			newinfo.birthmonth = atoi(buf);

		sprintf(genbuf, "������ [%d]: ", u->birthday);
		getdata(i++, 0, genbuf, buf, 3, DOECHO, YEA);
		if (buf[0] && atoi(buf) >= 1 && atoi(buf) <= 31)
			newinfo.birthday = atoi(buf);

		sprintf(genbuf, "�Ա�(M.��)(F.Ů) [%c]: ", u->gender);
		getdata(i++, 0, genbuf, buf, 2, DOECHO, YEA);
		if (buf[0])
		{
			if (strchr("MmFf", buf[0]))
				newinfo.gender = toupper(buf[0]);
		}

		if (real)
			uinfo_change1(i,u,&newinfo);
		break;
	case '2':
		if (!real)
		{
			getdata(i++, 0, "������ԭ����: ", buf, PASSLEN, NOECHO, YEA);
			if (*buf == '\0' || !checkpasswd(u->passwd, buf))
			{
				prints("\n\n�ܱ�Ǹ, ����������벻��ȷ��\n");
				fail++;
				break;
			}
		}
		getdata(i++, 0, "���趨������: ", buf, PASSLEN, NOECHO, YEA);
		if (buf[0] == '\0')
		{
			prints("\n\n�����趨ȡ��, ����ʹ�þ�����\n");
			fail++;
			break;
		}
		strncpy(genbuf, buf, PASSLEN);
		getdata(i++, 0, "����������������: ", buf, PASSLEN, NOECHO, YEA);
		if (strncmp(buf, genbuf, PASSLEN))
		{
			prints("\n\n������ȷ��ʧ��, �޷��趨�����롣\n");
			fail++;
			break;
		}
		buf[8] = '\0';
		strncpy(newinfo.passwd, genpasswd(buf), ENCPASSLEN);
		break;
	case '3':
		if (!real)
		{
			sprintf(genbuf, "Ŀǰʹ��ǩ���� [%d]: ", u->signature);
			getdata(i++, 0, genbuf, buf, 16, DOECHO, YEA);
			if (atoi(buf) > 0)
				newinfo.signature = atoi(buf);
		}
		else
		{
			struct user_info uin;
			extern int t_cmpuids();
			if(t_search_ulist(&uin, t_cmpuids, unum, NA, NA)!=0)
			{
				prints("\n�Բ��𣬸��û�Ŀǰ�������ϡ�");
				fail++;
			}
			else if(!strcmp(lookupuser.userid,"SYSOP"))
			{
				prints("\n�Բ����㲻�����޸� SYSOP �� ID��");
				fail++;
			}
			else
			{
				getdata(i++,0,"�µ�ʹ���ߴ���: ",genbuf,IDLEN+1,DOECHO, YEA);
				if (*genbuf != '\0')
				{
					if (getuser(genbuf))
					{
						prints("\n�Բ���! �Ѿ���ͬ�� ID ��ʹ����\n");
						fail++;
					}
					else
					{
						strncpy(newinfo.userid, genbuf, IDLEN + 2);
					}
				}
				else
					fail ++;
			}
		}
		break;
	default:
		clear();
		return 0;
	}
	if (fail != 0)
	{
		pressreturn();
		clear();
		return 0;
	}
	if (askyn("ȷ��Ҫ�ı���", NA, YEA) == YEA)
	{
		if (real)
		{
			char    secu[STRLEN];
			sprintf(secu, "�޸� %s �Ļ������ϻ����롣", u->userid);
			securityreport1(secu);
		}
		if (strcmp(u->userid, newinfo.userid))
		{
			sprintf(src, "mail/%c/%s", toupper(u->userid[0]), u->userid);
			sprintf(dst, "mail/%c/%s", toupper(newinfo.userid[0]), newinfo.userid);
			rename(src, dst);
			sethomepath(src, u->userid);
			sethomepath(dst, newinfo.userid);
			rename(src, dst);
			sethomefile(src, u->userid, "register");
			unlink(src);
			sethomefile(src, u->userid, "register.old");
			unlink(src);
			setuserid(unum, newinfo.userid);
		}
		if(!strcmp(u->userid, currentuser.userid))
		{
			extern int WishNum;
			strncpy(uinfo.username,newinfo.username,NAMELEN);
			WishNum = 9999;
		}
#ifdef MAILCHECK
#ifdef MAILCHANGED
		if ((netty_check == 1)&&!HAS_PERM(PERM_SYSOP))
		{
			sprintf(genbuf, "%s", BBSHOST);
			if ( (!strstr(newinfo.email, genbuf)) &&
			        (!invalidaddr(newinfo.email)) &&
			        (!invalid_email(newinfo.email)))
			{
				strcpy(u->email, newinfo.email);
				send_regmail(u);
			}
			else
			{
				move(t_lines - 5, 0);
				prints("\n������ĵ����ʼ���ַ ��%s��\n",newinfo.email);
				prints("ˡ���ܱ�վ���ϣ�ϵͳ����Ͷ��ע���ţ������������...\n");
				pressanykey();
				return 0;
			}
		}
#endif
#endif
		memcpy(u, &newinfo, (size_t)sizeof(currentuser));
#ifdef MAILCHECK
#ifdef MAILCHANGED

		if ((netty_check == 1)&&!HAS_PERM(PERM_SYSOP))
		{
			newinfo.userlevel &= ~(PERM_LOGINOK | PERM_PAGE | PERM_MESSAGE);
			sethomefile(src, newinfo.userid, "register");
			sethomefile(dst, newinfo.userid, "register.old");
			rename(src, dst);
		}
#endif
#endif
		substitute_record(PASSFILE, &newinfo, sizeof(newinfo), unum);
	}
	clear();
	return 0;
}