Пример #1
0
void RtsForm::OnMemberNotifyCallback(const std::string& session_id, int channel_type, const std::string& uid, int code)
{
	if (session_id == session_id_)
	{
		switch (channel_type)
		{
		case nim::kNIMRtsChannelTypeTcp:
			if (code == nim::kNIMRtsMemberStatusJoined)
			{
				ShowTip(L"正在会话");
			}
			else
			{
				ShowTip(L"对方离开");
				DelayClose();
			}
			break;
		case nim::kNIMRtsChannelTypeVchat:
			if (code != nim::kNIMRtsMemberStatusJoined)
			{
				SetAudioStatus(false);
			}
			break;
		default:
			break;
		}
	}
}
Пример #2
0
void RtsForm::NoActiveTimer()
{
	if (!talking_)
	{
		ShowTip(L"等待超时");
		DelayClose();
	}
}
Пример #3
0
void RtsForm::OnHangupNotifyCallback(const std::string& session_id, const std::string& uid)
{
	if (session_id == session_id_)
	{
		ShowTip(L"对方挂断");
		DelayClose();
	}
}
Пример #4
0
void RtsForm::StartResult(nim::NIMResCode code, std::string session_id)
{
	session_id_ = session_id;
	if (code == nim::kNIMResSuccess)
	{
		//ShowTip(L"等待对方接受");
		SendCreateMsg();
	} 
	else
	{
		ShowTip(L"发起失败");
		DelayClose();
	}
}
Пример #5
0
void RtsForm::OnSyncAckNotifyCallback(const std::string& session_id, int channel_type, bool accept)
{
	if (session_id == session_id_)
	{
		if (accept)
		{
			ShowTip(L"已在其他端接受");
		} 
		else
		{
			ShowTip(L"已在其他端拒绝");
		}
		DelayClose();
	}
}
Пример #6
0
void RtsForm::OnAckNotifyCallback(const std::string& session_id, int channel_type, bool accept, const std::string& uid)
{
	if (session_id == session_id_)
	{
		if (accept)
		{
			ShowTip(L"正在连接");
			ShowBoardUI();
		} 
		else
		{
			ShowTip(L"对方拒绝");
			DelayClose();
		}
	}
}
Пример #7
0
//callback
void RtsForm::OnAckCallback(nim::NIMResCode res_code, const std::string& session_id, int channel_type, bool accept)
{
	if (session_id == session_id_)
	{
		if (res_code == nim::kNIMResSuccess)
		{
			ShowTip(L"正在连接");
			ShowBoardUI();
		} 
		else
		{
			ShowTip(L"接受失败");
			DelayClose();
		}
	}
}
Пример #8
0
		void HttpServer::HandleTcpSend(const boost::system::error_code& err, size_t bytes_transferred, Buffer buffer)
		{
			if( is_open_ == false )
				return;

			if( ! err )
			{
                LOG(__EVENT, "httpserver", __FUNCTION__ << " notice_window_close_.is_recieved = true ");
                // 发送成功
				assert(send_set_.find(buffer) != send_set_.end() );
				send_set_.erase(buffer);
				sended_bytes_ += bytes_transferred;

				notice_window_close_.is_recieved = true;


				if( handler_ )
				{
					MainThread::IOS().post(
						boost::bind( &IHttpServerListener::OnTcpSendSucced, handler_, bytes_transferred )
					);
				}

				if( send_set_.size() == 0 && will_close_ == true )
				{	
                    LOG(__DEBUG, "httpserver", "HttpServer::HandleTcpSend send_set_.size() == 0 && will_close_ == true");
                    // 在上层关闭后 已经将 所有要发送的发送完成
					DelayClose();
				}
			}
			else
            {
                LOG(__EVENT, "httpserver", "HttpServer::HandleTcpSend: " << socket_.remote_endpoint() << " err: " << err.message());
                // 发送失败
				if( handler_ )
				{
					MainThread::IOS().post(
						boost::bind( &IHttpServerListener::OnTcpSendFailed, handler_ )
					);
				}

				Close();
			}
		}
Пример #9
0
void RtsForm::OnConnectNotifyCallback(const std::string& session_id, int channel_type, int code, const std::string& json)
{
	if (session_id == session_id_)
	{
		if (channel_type == nim::kNIMRtsChannelTypeTcp)
		{
			if (code == nim::kNIMRtsConnectStatusSuccess)
			{
				ShowTip(L"链接成功,等待对方进入");
				talking_ = true;
			}
			else
			{
				ShowTip(L"链接失败");
				DelayClose();
			}
		}
		else if (channel_type == nim::kNIMRtsChannelTypeVchat)
		{
			SetAudioStatus(code == nim::kNIMRtsConnectStatusSuccess);
		}
	}
}
Пример #10
0
bool RtsForm::OnClicked(ui::EventArgs* arg)
{
	std::wstring name = arg->pSender->GetName();		
	if(name == L"btn_accept")
	{
		need_ack_ = false;
		nim::Rts::Ack(session_id_, type_, true, nbase::Bind(&RtsForm::OnAckCallback, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
	}
	else if (name == L"btn_reject")
	{
		need_ack_ = false;
		nim::Rts::Ack(session_id_, type_, false, nim::Rts::AckCallback());
		DelayClose();
	}
	else if (name == L"btn_cancel")
	{
		nim::Rts::Hangup(session_id_, nim::Rts::HangupCallback());
		DelayClose();
	}
	else if (name == L"btn_undo")
	{
		board_->MyUndo();
	}
	else if (name == L"btn_clear")
	{
		DrawOpInfo info;
		info.draw_op_type_ = DrawOpClear;
		info.x_ = 0;
		info.y_ = 0;
		OnDrawCallback(info);
		board_->ReleaseAllDrawUnits(ShowOpMine);
		board_->PaintContent();
	}
	else if (name == L"btn_close")
	{
		OnBtnClose();
	}
	else if (name == L"btn_showtype")
	{
		if (talking_)
		{
			switch (show_type_)
			{
			case ShowOpAll:
				show_type_ = ShowOpMine;
				((Button*)(arg->pSender))->SetText(L"显示自己");
				break;
			case ShowOpMine:
				show_type_ = ShowOpOther;
				((Button*)(arg->pSender))->SetText(L"显示对方");
				break;
			case ShowOpOther:
				show_type_ = ShowOpAll;
				((Button*)(arg->pSender))->SetText(L"显示全部");
				break;
			}
			board_->SetShowType(show_type_);
		}
	}
	return true;
}
Пример #11
0
		void HttpServer::WillClose()
		{
			will_close_ = true;
			if( send_set_.size() == 0 )
				DelayClose();
		}