本文整理汇总了Java中org.telegram.tgnet.TLRPC.TL_draftMessageEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.TL_draftMessageEmpty方法的具体用法?Java TLRPC.TL_draftMessageEmpty怎么用?Java TLRPC.TL_draftMessageEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.tgnet.TLRPC
的用法示例。
在下文中一共展示了TLRPC.TL_draftMessageEmpty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveDraft
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static void saveDraft(long did, CharSequence message, ArrayList<TLRPC.MessageEntity> entities, TLRPC.Message replyToMessage, boolean noWebpage, boolean clean) {
TLRPC.DraftMessage draftMessage;
if (!TextUtils.isEmpty(message) || replyToMessage != null) {
draftMessage = new TLRPC.TL_draftMessage();
} else {
draftMessage = new TLRPC.TL_draftMessageEmpty();
}
draftMessage.date = (int) (System.currentTimeMillis() / 1000);
draftMessage.message = message == null ? "" : message.toString();
draftMessage.no_webpage = noWebpage;
if (replyToMessage != null) {
draftMessage.reply_to_msg_id = replyToMessage.id;
draftMessage.flags |= 1;
}
if (entities != null && !entities.isEmpty()) {
draftMessage.entities = entities;
draftMessage.flags |= 8;
}
TLRPC.DraftMessage currentDraft = drafts.get(did);
if (!clean) {
if (currentDraft != null && currentDraft.message.equals(draftMessage.message) && currentDraft.reply_to_msg_id == draftMessage.reply_to_msg_id && currentDraft.no_webpage == draftMessage.no_webpage ||
currentDraft == null && TextUtils.isEmpty(draftMessage.message) && draftMessage.reply_to_msg_id == 0) {
return;
}
}
saveDraft(did, draftMessage, replyToMessage, false);
int lower_id = (int) did;
if (lower_id != 0) {
TLRPC.TL_messages_saveDraft req = new TLRPC.TL_messages_saveDraft();
req.peer = MessagesController.getInputPeer(lower_id);
if (req.peer == null) {
return;
}
req.message = draftMessage.message;
req.no_webpage = draftMessage.no_webpage;
req.reply_to_msg_id = draftMessage.reply_to_msg_id;
req.entities = draftMessage.entities;
req.flags = draftMessage.flags;
ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
@Override
public void run(TLObject response, TLRPC.TL_error error) {
}
});
}
MessagesController.getInstance().sortDialogs(null);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload);
}