本文整理汇总了Java中org.telegram.tgnet.TLRPC.TL_messageService方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.TL_messageService方法的具体用法?Java TLRPC.TL_messageService怎么用?Java TLRPC.TL_messageService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.tgnet.TLRPC
的用法示例。
在下文中一共展示了TLRPC.TL_messageService方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDeleteMessage
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private TLRPC.Message createDeleteMessage(int mid, int seq_out, int seq_in, long random_id, TLRPC.EncryptedChat encryptedChat) {
TLRPC.TL_messageService newMsg = new TLRPC.TL_messageService();
newMsg.action = new TLRPC.TL_messageEncryptedAction();
newMsg.action.encryptedAction = new TLRPC.TL_decryptedMessageActionDeleteMessages();
newMsg.action.encryptedAction.random_ids.add(random_id);
newMsg.local_id = newMsg.id = mid;
newMsg.from_id = UserConfig.getClientUserId();
newMsg.unread = true;
newMsg.out = true;
newMsg.flags = TLRPC.MESSAGE_FLAG_HAS_FROM_ID;
newMsg.dialog_id = ((long) encryptedChat.id) << 32;
newMsg.to_id = new TLRPC.TL_peerUser();
newMsg.send_state = MessageObject.MESSAGE_SEND_STATE_SENDING;
newMsg.seq_in = seq_in;
newMsg.seq_out = seq_out;
if (encryptedChat.participant_id == UserConfig.getClientUserId()) {
newMsg.to_id.user_id = encryptedChat.admin_id;
} else {
newMsg.to_id.user_id = encryptedChat.participant_id;
}
newMsg.date = 0;
newMsg.random_id = random_id;
return newMsg;
}
示例2: createServiceSecretMessage
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private TLRPC.TL_messageService createServiceSecretMessage(final TLRPC.EncryptedChat encryptedChat, TLRPC.DecryptedMessageAction decryptedMessage) {
TLRPC.TL_messageService newMsg = new TLRPC.TL_messageService();
newMsg.action = new TLRPC.TL_messageEncryptedAction();
newMsg.action.encryptedAction = decryptedMessage;
newMsg.local_id = newMsg.id = UserConfig.getNewMessageId();
newMsg.from_id = UserConfig.getClientUserId();
newMsg.unread = true;
newMsg.out = true;
newMsg.flags = TLRPC.MESSAGE_FLAG_HAS_FROM_ID;
newMsg.dialog_id = ((long) encryptedChat.id) << 32;
newMsg.to_id = new TLRPC.TL_peerUser();
newMsg.send_state = MessageObject.MESSAGE_SEND_STATE_SENDING;
if (encryptedChat.participant_id == UserConfig.getClientUserId()) {
newMsg.to_id.user_id = encryptedChat.admin_id;
} else {
newMsg.to_id.user_id = encryptedChat.participant_id;
}
if (decryptedMessage instanceof TLRPC.TL_decryptedMessageActionScreenshotMessages || decryptedMessage instanceof TLRPC.TL_decryptedMessageActionSetMessageTTL) {
newMsg.date = ConnectionsManager.getInstance().getCurrentTime();
} else {
newMsg.date = 0;
}
newMsg.random_id = SendMessagesHelper.getInstance().getNextRandomId();
UserConfig.saveConfig(false);
ArrayList<TLRPC.Message> arr = new ArrayList<>();
arr.add(newMsg);
MessagesStorage.getInstance().putMessages(arr, false, true, true, 0);
return newMsg;
}
示例3: generateJoinMessage
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void generateJoinMessage(final int chat_id, boolean ignoreLeft) {
TLRPC.Chat chat = getChat(chat_id);
if (chat == null || !ChatObject.isChannel(chat_id) || (chat.left || chat.kicked) && !ignoreLeft) {
return;
}
TLRPC.TL_messageService message = new TLRPC.TL_messageService();
message.flags = TLRPC.MESSAGE_FLAG_HAS_FROM_ID;
message.local_id = message.id = UserConfig.getNewMessageId();
message.date = ConnectionsManager.getInstance().getCurrentTime();
message.from_id = UserConfig.getClientUserId();
message.to_id = new TLRPC.TL_peerChannel();
message.to_id.channel_id = chat_id;
message.dialog_id = -chat_id;
message.post = true;
message.action = new TLRPC.TL_messageActionChatAddUser();
message.action.users.add(UserConfig.getClientUserId());
if (chat.megagroup) {
message.flags |= TLRPC.MESSAGE_FLAG_MEGAGROUP;
}
UserConfig.saveConfig(false);
final ArrayList<MessageObject> pushMessages = new ArrayList<>();
final ArrayList<TLRPC.Message> messagesArr = new ArrayList<>();
messagesArr.add(message);
MessageObject obj = new MessageObject(message, null, true);
pushMessages.add(obj);
MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() {
@Override
public void run() {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
NotificationsController.getInstance().processNewMessages(pushMessages, true);
}
});
}
});
MessagesStorage.getInstance().putMessages(messagesArr, true, true, false, MediaController.getInstance().getAutodownloadMask());
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
updateInterfaceWithMessages(-chat_id, pushMessages);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload);
}
});
}
示例4: setType
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void setType() {
int oldType = type;
if (messageOwner instanceof TLRPC.TL_message || messageOwner instanceof TLRPC.TL_messageForwarded_old2) {
if (isMediaEmpty()) {
type = 0;
if (messageText == null || messageText.length() == 0) {
messageText = "Empty message";
}
} else if (messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) {
type = 1;
} else if (messageOwner.media instanceof TLRPC.TL_messageMediaGeo || messageOwner.media instanceof TLRPC.TL_messageMediaVenue) {
type = 4;
} else if (isVideo()) {
type = 3;
} else if (isVoice()) {
type = 2;
} else if (isMusic()) {
type = 14;
} else if (messageOwner.media instanceof TLRPC.TL_messageMediaContact) {
type = 12;
} else if (messageOwner.media instanceof TLRPC.TL_messageMediaUnsupported) {
type = 0;
} else if (messageOwner.media instanceof TLRPC.TL_messageMediaDocument) {
if (messageOwner.media.document.mime_type != null) {
if (isGifDocument(messageOwner.media.document)) {
type = 8;
} else if (messageOwner.media.document.mime_type.equals("image/webp") && isSticker()) {
type = 13;
} else {
type = 9;
}
} else {
type = 9;
}
}
} else if (messageOwner instanceof TLRPC.TL_messageService) {
if (messageOwner.action instanceof TLRPC.TL_messageActionLoginUnknownLocation) {
type = 0;
} else if (messageOwner.action instanceof TLRPC.TL_messageActionChatEditPhoto || messageOwner.action instanceof TLRPC.TL_messageActionUserUpdatedPhoto) {
contentType = 1;
type = 11;
} else if (messageOwner.action instanceof TLRPC.TL_messageEncryptedAction) {
if (messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionScreenshotMessages || messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionSetMessageTTL) {
contentType = 1;
type = 10;
} else {
contentType = -1;
type = -1;
}
} else if (messageOwner.action instanceof TLRPC.TL_messageActionHistoryClear) {
contentType = -1;
type = -1;
} else {
contentType = 1;
type = 10;
}
}
if (oldType != 1000 && oldType != type) {
generateThumbs(false);
}
}
示例5: setType
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void setType() {
int oldType = type;
if (messageOwner instanceof TLRPC.TL_message || messageOwner instanceof TLRPC.TL_messageForwarded_old2) {
if (isMediaEmpty()) {
type = 0;
if (messageText == null || messageText.length() == 0) {
messageText = "Empty message";
}
} else if (messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) {
type = 1;
} else if (messageOwner.media instanceof TLRPC.TL_messageMediaGeo || messageOwner.media instanceof TLRPC.TL_messageMediaVenue) {
type = 4;
} else if (isVideo()) {
type = 3;
} else if (isVoice()) {
type = 2;
} else if (isMusic()) {
type = 14;
} else if (messageOwner.media instanceof TLRPC.TL_messageMediaContact) {
type = 12;
} else if (messageOwner.media instanceof TLRPC.TL_messageMediaUnsupported) {
type = 0;
} else if (messageOwner.media instanceof TLRPC.TL_messageMediaDocument) {
if (messageOwner.media.document != null && messageOwner.media.document.mime_type != null) {
if (isGifDocument(messageOwner.media.document)) {
type = 8;
} else if (messageOwner.media.document.mime_type.equals("image/webp") && isSticker()) {
type = 13;
} else {
type = 9;
}
} else {
type = 9;
}
} else if (messageOwner.media instanceof TLRPC.TL_messageMediaGame) {
type = 0;
}
} else if (messageOwner instanceof TLRPC.TL_messageService) {
if (messageOwner.action instanceof TLRPC.TL_messageActionLoginUnknownLocation) {
type = 0;
} else if (messageOwner.action instanceof TLRPC.TL_messageActionChatEditPhoto || messageOwner.action instanceof TLRPC.TL_messageActionUserUpdatedPhoto) {
contentType = 1;
type = 11;
} else if (messageOwner.action instanceof TLRPC.TL_messageEncryptedAction) {
if (messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionScreenshotMessages || messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionSetMessageTTL) {
contentType = 1;
type = 10;
} else {
contentType = -1;
type = -1;
}
} else if (messageOwner.action instanceof TLRPC.TL_messageActionHistoryClear) {
contentType = -1;
type = -1;
} else {
contentType = 1;
type = 10;
}
}
if (oldType != 1000 && oldType != type) {
generateThumbs(false);
}
}