Exemple #1
0
int bbsfdel_main(void)
{
	if (!session_get_id())
		return BBS_ELGNREQ;

	const char *uname = web_get_param("u");
	if (*uname) {
		user_id_t uid = get_user_id(uname);
		if (uid > 0)
			unfollow(session_get_user_id(), uid);
	}
	printf("Location: fall\n\n");
	return 0;
}
Exemple #2
0
void process(int cmd, int connfd, std::vector<std::string> &tokens){
    // std::unique_lock<std::mutex> lck(mtx1);
    switch(cmd){
    case 1:{
        msg_all(connfd);
        break;
    }
    case 2:{
        msg_flw(connfd, tokens);
        break;
    }
    case 3:{
        login(connfd, tokens);
        break;
    }
    case 4:{
        user_register(connfd, tokens);
        break;
    }
    case 5:{
        compose(connfd, tokens);
        break;
    }
    case 6:{
        follow(connfd, tokens);
        break;
    }
    case 7:{
        unfollow(connfd, tokens);
        break;
    }
    default:{
        write(connfd, "error", 5);
        break;
    }
    }
}
Exemple #3
0
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;
	}
}
Exemple #4
0
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;
}
int main()
{
	unsigned long nMsg = 0;
	char *cmnd, *uname1, *uname2;
	int k;
	user *users = NULL;
	
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	
	cmnd = (char*)malloc(sizeof(char)*10);
	while(scanf("%s", cmnd)!=EOF)
	{
		if(DEBUG)
			printf("cmnd read: %s\n", cmnd);
			
		if(!strcmp(cmnd, "ADD"))
		{
			uname1 = getUser();
			if(users==NULL)
				init(uname1, &users);
			else
				addUser(uname1, users);
		}
		else if(!strcmp(cmnd, "FOLLOW"))
		{
			uname1 = getUser(), uname2 = getUser();
			follow(uname1, uname2, users);
		}
		else if(!strcmp(cmnd, "SEND"))
		{
			uname1 = getUser();
			sendMsg(uname1, ++nMsg, users);
		}
		else if(!strcmp(cmnd, "RESEND"))
		{
			uname1 = getUser();
			scanf("%d", &k);
			resendMsg(uname1, k, users);
		}
		else if(!strcmp(cmnd, "INACTIVE"))
		{
			uname1 = getUser();
			inactivate(uname1, users);
		}
		else if(!strcmp(cmnd, "ACTIVE"))
		{
			uname1 = getUser();
			activate(uname1, users);
		}
		else //UNFOLLOW
		{
			uname1 = getUser(), uname2 = getUser();
			unfollow(uname1, uname2, users);
		}
	}
	
	user *cur = users;
	do
	{
		print(*cur);
		cur = cur->next;
	}
	while(cur!=users);
	
	return 0;
}
 void Camera::unfollow(Entity* inEntity, bool inCopyEntityPosition)
 {
     if (mFollow == inEntity) unfollow(inEntity, inCopyEntityPosition);
 }