Ejemplo n.º 1
0
void tchatbox::send_message_button_callback()
{
	const std::string& input = chat_input_->get_value();
	if(input.empty()) {
		return;
	}

	if(input[0] == '/') {
		// TODO: refactor do_speak so it uses context information about
		//      opened window, so e.g. /ignore in a whisper session ignores
		//      the other party without having to specify it's nick.
		chat_handler::do_speak(input);
	} else {
		tlobby_chat_window& t = open_windows_[active_window_];

		if(t.whisper) {
			send_whisper(t.name, input);
			add_whisper_sent(t.name, input);
		} else {
			send_chat_room_message(t.name, input);
			add_chat_room_message_sent(t.name, input);
		}
	}

	chat_input_->save_to_history();
	chat_input_->set_value("");
}
Ejemplo n.º 2
0
void tlobby_main::send_message_to_active_window(const std::string& input)
{
	tlobby_chat_window& t = open_windows_[active_window_];
	if(t.whisper) {
		send_whisper(t.name, input);
		add_whisper_sent(t.name, input);
	} else {
		send_chat_room_message(t.name, input);
		add_chat_room_message_sent(t.name, input);
	}
}