use of com.hyphenate.chat.EMCmdMessageBody in project SmartCampus by Vegen.
the class EaseDingMessageHelper method sendAckMessage.
public void sendAckMessage(EMMessage message) {
if (!validateMessage(message)) {
return;
}
if (message.isAcked()) {
return;
}
// May a user login from multiple devices, so do not need to send the ack msg.
if (EMClient.getInstance().getCurrentUser().equalsIgnoreCase(message.getFrom())) {
return;
}
try {
// cmd-type message will not store in native database.
EMMessage msg = EMMessage.createSendMessage(EMMessage.Type.CMD);
msg.setTo(message.getFrom());
msg.setAttribute(KEY_CONVERSATION_ID, message.getTo());
msg.setAttribute(KEY_DING_ACK, true);
msg.addBody(new EMCmdMessageBody(message.getMsgId()));
EMClient.getInstance().chatManager().sendMessage(msg);
message.setAcked(true);
EMLog.i(TAG, "Send the group ack cmd-type message.");
} catch (Exception e) {
}
}
use of com.hyphenate.chat.EMCmdMessageBody in project SmartCampus by Vegen.
the class EaseDingMessageHelperTest method createDingAckMessage.
private EMMessage createDingAckMessage(String conversationId, String originalMsgId, String from) {
EMAMessage _msg = EMAMessage.createSendMessage(from, "", null, EMMessage.ChatType.Chat.ordinal());
EMMessage msg = new EMMessage(_msg);
msg.setAttribute(KEY_CONVERSATION_ID, conversationId);
msg.setAttribute(KEY_DING_ACK, true);
msg.addBody(new EMCmdMessageBody(originalMsgId));
return msg;
}
Aggregations