std::string Talk::CreateVideoMessage(const std::string& receiver_id
	, const NIMSessionType session_type
	, const std::string& client_msg_id
	, const IMVideo& video
	, const std::string& file_path
	, const MessageSetting& msg_setting
	, __int64 timetag/* = 0*/)
{
	Json::Value values;
	values[kNIMMsgKeyToAccount] = receiver_id;
	values[kNIMMsgKeyToType] = session_type;
	values[kNIMMsgKeyClientMsgid] = client_msg_id;
	values[kNIMMsgKeyAttach] = video.ToJsonString();
	values[kNIMMsgKeyType] = kNIMMessageTypeVideo;
	values[kNIMMsgKeyLocalFilePath] = file_path;
	values[kNIMMsgKeyLocalTalkId] = receiver_id;
	values[kNIMMsgKeyLocalResId] = client_msg_id;

	msg_setting.ToJsonValue(values);

	//选填
	if (timetag > 0)
		values[kNIMMsgKeyTime] = timetag;

	return GetJsonStringWithNoStyled(values);
}
Example #2
0
std::string Talk::CreateImageMessage(const std::string& receiver_id
	, const NIMSessionType session_type
	, const std::string& client_msg_id
	, const IMImage& image
	, const std::string& file_path
	, const MessageSetting& msg_setting
	, __int64 timetag/* = 0*/)
{
	Json::Value values;
	values[kNIMMsgKeyToAccount] = receiver_id;
	values[kNIMMsgKeyToType] = session_type;
	values[kNIMMsgKeyClientMsgid] = client_msg_id;
	values[kNIMMsgKeyAttach] = image.ToJsonString();
	values[kNIMMsgKeyType] = kNIMMessageTypeImage;
	values[kNIMMsgKeyLocalFilePath] = file_path;
	values[kNIMMsgKeyLocalTalkId] = receiver_id;
	values[kNIMMsgKeyLocalResId] = client_msg_id;

	msg_setting.ToJsonValue(values);

	//僉野
	if (timetag > 0)
		values[kNIMMsgKeyTime] = timetag;

	return values.toStyledString();
}
std::string Talk::CreateTipMessage(const std::string& receiver_id
	, const NIMSessionType session_type
	, const std::string& client_msg_id
	, const Json::Value& tips
	, const MessageSetting& msg_setting
	, __int64 timetag/* = 0*/)
{
	Json::Value values;
	values[kNIMMsgKeyToAccount] = receiver_id;
	values[kNIMMsgKeyToType] = session_type;
	values[kNIMMsgKeyClientMsgid] = client_msg_id;
	values[kNIMMsgKeyServerExt] = GetJsonStringWithNoStyled(tips);
	values[kNIMMsgKeyType] = kNIMMessageTypeTips;
	values[kNIMMsgKeyLocalTalkId] = receiver_id;

	msg_setting.ToJsonValue(values);

	//选填
	if (timetag > 0)
		values[kNIMMsgKeyTime] = timetag;

	return GetJsonStringWithNoStyled(values);
}
Example #4
0
std::string Talk::CreateLocationMessage(const std::string& receiver_id
	, const NIMSessionType session_type
	, const std::string& client_msg_id
	, const IMLocation& location
	, const MessageSetting& msg_setting
	, __int64 timetag/* = 0*/)
{
	Json::Value values;
	values[kNIMMsgKeyToAccount] = receiver_id;
	values[kNIMMsgKeyToType] = session_type;
	values[kNIMMsgKeyClientMsgid] = client_msg_id;
	values[kNIMMsgKeyAttach] = location.ToJsonString();
	values[kNIMMsgKeyType] = kNIMMessageTypeLocation;
	values[kNIMMsgKeyLocalTalkId] = receiver_id;

	msg_setting.ToJsonValue(values);

	//僉野
	if (timetag > 0)
		values[kNIMMsgKeyTime] = timetag;

	return values.toStyledString();
}