예제 #1
0
void tchatbox::add_chat_room_message_received(const std::string& room,
	const std::string& speaker,
	const std::string& message)
{
	room_info* ri = lobby_info().get_room(room);
	if(!ri) {
		LOG_LB << "Discarding message to room " << room << " from " << speaker << " (room not open)\n";
		return;
	}

	t_notify_mode notify_mode = NOTIFY_NONE;
	ri->log().add_message(speaker, message);

	if(room_window_active(room)) {
		add_active_window_message(speaker, message);
		notify_mode = NOTIFY_MESSAGE;
	} else {
		add_room_window_message(room, speaker, message);
		increment_waiting_messages(room);
		notify_mode = NOTIFY_MESSAGE_OTHER_WINDOW;
	}

	if(speaker == "server") {
		notify_mode = NOTIFY_SERVER_MESSAGE;
	} else if (utils::word_match(message, preferences::login())) {
		notify_mode = NOTIFY_OWN_NICK;
	} else if (preferences::is_friend(speaker)) {
		notify_mode = NOTIFY_FRIEND_MESSAGE;
	}

	do_notify(notify_mode, speaker, message);
}
예제 #2
0
void tlobby_main::add_chat_room_message_sent(const std::string& room,
											 const std::string& message)
{
	// do not open room window here, player should be in the room before sending
	// messages yo it should be allowed to happen
	if(tlobby_chat_window* t = room_window_open(room, false)) {
		room_info* ri = lobby_info_.get_room(room);
		assert(ri);
		if(!room_window_active(room)) {
			switch_to_window(t);
		}
		ri->log().add_message(preferences::login(), message);
		add_active_window_message(preferences::login(), message, true);
	} else {
		LOG_LB << "Cannot add sent message to ui for room " << room
			   << ", player not in the room\n";
	}
}
예제 #3
0
void tchatbox::add_chat_room_message_sent(const std::string& room,
	const std::string& message)
{
	tlobby_chat_window* t = room_window_open(room, false);
	if(!t) {
		LOG_LB << "Cannot add sent message to ui for room " << room << ", player not in the room\n";
		return;
	}

	// Do not open room window here. The player should be in the room before sending messages
	room_info* ri = lobby_info().get_room(room);
	assert(ri);

	if(!room_window_active(room)) {
		switch_to_window(t);
	}

	ri->log().add_message(preferences::login(), message);
	add_active_window_message(preferences::login(), message, true);
}