Exemple #1
0
static void setup_utmp(int mode) {
    userinfo_t uinfo;
    char buf[80];
    char remotebuf[1024];
    time_t now = time(NULL);
    
    memset(&uinfo, 0, sizeof(uinfo));
    uinfo.pid = currpid = getpid();
    uinfo.uid = usernum;
    uinfo.mode = currstat = mode;
    uinfo.msgcount = 0;
    if(!(cuser.numlogins % 20) &&
       cuser.userlevel & PERM_BM)
	check_BM();	/* Ptt 自動取下離職板主權力 */
    
    uinfo.userlevel = cuser.userlevel;
    uinfo.lastact = time(NULL);
    
    postrecord.times = 0;	/* 計算crosspost數 */
    
    strcpy(uinfo.userid, cuser.userid);
    strcpy(uinfo.realname, cuser.realname);
    strcpy(uinfo.username, cuser.username);
    strncpy(uinfo.from, fromhost, 23);
    
    uinfo.five_win = cuser.five_win;
    uinfo.five_lose = cuser.five_lose;
    uinfo.five_tie = cuser.five_tie;
    
    uinfo.invisible = cuser.invisible % 2;
    uinfo.pager = cuser.pager % 5;
    
    uinfo.brc_id = 0;
#ifdef WHERE
    uinfo.from_alias = where(fromhost);
#else
    uinfo.from_alias = 0;
#endif
    setuserfile(buf, "remoteuser");
    
    strcpy(remotebuf, getenv("RFC931"));
    strcat(remotebuf, ctime(&now));
    remotebuf[strlen(remotebuf)-1] = 0;
    add_distinct(buf, remotebuf);
    
    if(enter_uflag & CLOAK_FLAG)
	uinfo.invisible = YEA;
    getnewutmpent(&uinfo);
#ifndef _BBS_UTIL_C_
    friend_load();
#endif
}
Exemple #2
0
void 
setup_utmp(int mode)
{
	user_info	uinfo;
	char		buf       [80];

	memset(&uinfo, 0, sizeof(uinfo));
	uinfo.pid = currpid = getpid();
	uinfo.uid = searchuser(cuser.userid);
	uinfo.mode = currstat = mode;
	uinfo.msgcount = 0;
	if (cuser.userlevel & PERM_BM)
		check_BM();	/* Ptt 自動取下離職板主權力 */
	uinfo.userlevel = cuser.userlevel;
	uinfo.lastact = time(NULL);

	strcpy(uinfo.userid, cuser.userid);
	strcpy(uinfo.realname, cuser.realname);
	strcpy(uinfo.username, cuser.username);
	strcpy(uinfo.feeling, cuser.feeling);
	strncpy(uinfo.from, fromhost, 23);
	uinfo.invisible = cuser.invisible % 2;
	uinfo.pager = cuser.pager % 5;
	uinfo.brc_id = 0;
	uinfo.sex = cuser.sex;

	/* Ptt WHERE */

#ifdef WHERE
	uinfo.from_alias = where(fromhost);
#else
	uinfo.from_alias = 0;
#endif
	sethomefile(buf, cuser.userid, "remoteuser");

	if (enter_uflag & CLOAK_FLAG)
		uinfo.invisible = YEA;

	getnewutmpent(&uinfo);
	friend_load();
}