Esempio n. 1
0
	HERRCODE ChatClient::sendFileTransferRequest(const std::wstring& email, const RequestFilesInfo& fileInfo, time_t timestamp)
	{
		SockStream os;
		os.writeInt(net::kCommandType_FileTransferRequest);
		os.writeInt(0);
		os.writeString(email);
		os.writeString(fileInfo.fileName);
		os.writeInt(fileInfo.fileSize);
		os.writeInt64(timestamp);
		os.flushSize();
		queueSendRequest(sock_, os);
		return H_OK;
	}
Esempio n. 2
0
	HERRCODE ChatClient::confirmFileTransferRequest(const std::wstring& username, time_t timestamp,
		bool recv, const std::wstring& savePath)
	{
		if (!recv) {
			SockStream os;
			os.writeInt(net::kCommandType_FileTransferRequestAck);
			os.writeInt(0);
			os.writeString(username);
			os.writeInt64(timestamp);
			os.writeBool(false);
			os.flushSize();
			queueSendRequest(sock_, os);
		} else {
			SockStream os;
			os.writeInt(net::kCommandType_FileTransferRequestAck);
			os.writeInt(0);
			os.writeString(username);
			os.writeInt64(timestamp);
			os.writeBool(true);
			os.flushSize();
			queueSendRequest(sock_, os);
		}
		return H_OK;
	}
Esempio n. 3
0
	HERRCODE ChatClient::sendMessage(const std::wstring& username, const std::wstring& message, time_t timestamp)
	{
		if (message.find(L"<img") == -1) {
			SockStream stream;
			stream.writeInt(net::kCommandType_Message);
			stream.writeInt(0);
			stream.writeString(email_);
			stream.writeString(username);
			stream.writeInt64(timestamp);
			stream.writeString(message);
			stream.flushSize();
			queueSendRequest(sock_, stream);
			msgMan_.addMessageRequest(timestamp, username, timestamp);
		} else {
			ChatOverlappedData* ol = new ChatOverlappedData(net::kAction_SendMessage);
			ImageMessageForSend* msg = new ImageMessageForSend;
			msg->setRawMessage(message, username, timestamp);
			ol->setProp((int)msg);
			PostQueuedCompletionStatus(hComp_, 0, kServerKey, ol);
		}
		return H_OK;
	}