本文整理汇总了Java中org.telegram.tgnet.TLRPC.EncryptedChat方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.EncryptedChat方法的具体用法?Java TLRPC.EncryptedChat怎么用?Java TLRPC.EncryptedChat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.tgnet.TLRPC
的用法示例。
在下文中一共展示了TLRPC.EncryptedChat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendClearHistoryMessage
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void sendClearHistoryMessage(TLRPC.EncryptedChat encryptedChat, TLRPC.Message resendMessage) {
if (!(encryptedChat instanceof TLRPC.TL_encryptedChat)) {
return;
}
TLRPC.TL_decryptedMessageService reqSend;
if (AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) {
reqSend = new TLRPC.TL_decryptedMessageService();
} else {
reqSend = new TLRPC.TL_decryptedMessageService_layer8();
reqSend.random_bytes = new byte[15];
Utilities.random.nextBytes(reqSend.random_bytes);
}
TLRPC.Message message;
if (resendMessage != null) {
message = resendMessage;
reqSend.action = message.action.encryptedAction;
} else {
reqSend.action = new TLRPC.TL_decryptedMessageActionFlushHistory();
message = createServiceSecretMessage(encryptedChat, reqSend.action);
}
reqSend.random_id = message.random_id;
performSendEncryptedRequest(reqSend, message, encryptedChat, null, null, null);
}
示例2: updateEncryptedChatLayer
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void updateEncryptedChatLayer(final TLRPC.EncryptedChat chat) {
if (chat == null) {
return;
}
storageQueue.postRunnable(new Runnable() {
@Override
public void run() {
SQLitePreparedStatement state = null;
try {
state = database.executeFast("UPDATE enc_chats SET layer = ? WHERE uid = ?");
state.bindInteger(1, chat.layer);
state.bindInteger(2, chat.id);
state.step();
} catch (Exception e) {
FileLog.e("tmessages", e);
} finally {
if (state != null) {
state.dispose();
}
}
}
});
}
示例3: setRecentSearch
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void setRecentSearch(ArrayList<RecentSearchObject> arrayList, HashMap<Long, RecentSearchObject> hashMap) {
recentSearchObjects = arrayList;
recentSearchObjectsById = hashMap;
for (int a = 0; a < recentSearchObjects.size(); a++) {
RecentSearchObject recentSearchObject = recentSearchObjects.get(a);
if (recentSearchObject.object instanceof TLRPC.User) {
MessagesController.getInstance().putUser((TLRPC.User) recentSearchObject.object, true);
} else if (recentSearchObject.object instanceof TLRPC.Chat) {
MessagesController.getInstance().putChat((TLRPC.Chat) recentSearchObject.object, true);
} else if (recentSearchObject.object instanceof TLRPC.EncryptedChat) {
MessagesController.getInstance().putEncryptedChat((TLRPC.EncryptedChat) recentSearchObject.object, true);
}
}
notifyDataSetChanged();
}
示例4: sendMessagesDeleteMessage
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void sendMessagesDeleteMessage(TLRPC.EncryptedChat encryptedChat, ArrayList<Long> random_ids, TLRPC.Message resendMessage) {
if (!(encryptedChat instanceof TLRPC.TL_encryptedChat)) {
return;
}
TLRPC.TL_decryptedMessageService reqSend;
if (AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) {
reqSend = new TLRPC.TL_decryptedMessageService();
} else {
reqSend = new TLRPC.TL_decryptedMessageService_layer8();
reqSend.random_bytes = new byte[15];
Utilities.random.nextBytes(reqSend.random_bytes);
}
TLRPC.Message message;
if (resendMessage != null) {
message = resendMessage;
reqSend.action = message.action.encryptedAction;
} else {
reqSend.action = new TLRPC.TL_decryptedMessageActionDeleteMessages();
reqSend.action.random_ids = random_ids;
message = createServiceSecretMessage(encryptedChat, reqSend.action);
}
reqSend.random_id = message.random_id;
performSendEncryptedRequest(reqSend, message, encryptedChat, null, null, null);
}
示例5: sendTTLMessage
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void sendTTLMessage(TLRPC.EncryptedChat encryptedChat, TLRPC.Message resendMessage) {
if (!(encryptedChat instanceof TLRPC.TL_encryptedChat)) {
return;
}
TLRPC.TL_decryptedMessageService reqSend;
if (AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) {
reqSend = new TLRPC.TL_decryptedMessageService();
} else {
reqSend = new TLRPC.TL_decryptedMessageService_layer8();
reqSend.random_bytes = new byte[15];
Utilities.random.nextBytes(reqSend.random_bytes);
}
TLRPC.Message message;
if (resendMessage != null) {
message = resendMessage;
reqSend.action = message.action.encryptedAction;
} else {
reqSend.action = new TLRPC.TL_decryptedMessageActionSetMessageTTL();
reqSend.action.ttl_seconds = encryptedChat.ttl;
message = createServiceSecretMessage(encryptedChat, reqSend.action);
MessageObject newMsgObj = new MessageObject(message, null, false);
newMsgObj.messageOwner.send_state = MessageObject.MESSAGE_SEND_STATE_SENDING;
ArrayList<MessageObject> objArr = new ArrayList<>();
objArr.add(newMsgObj);
MessagesController.getInstance().updateInterfaceWithMessages(message.dialog_id, objArr);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload);
}
reqSend.random_id = message.random_id;
performSendEncryptedRequest(reqSend, message, encryptedChat, null, null, null);
}
示例6: setEncryptedChat
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void setEncryptedChat(TLRPC.EncryptedChat encryptedChat) {
data = encryptedChat.key_hash;
if (data == null) {
encryptedChat.key_hash = data = AndroidUtilities.calcAuthKeyHash(encryptedChat.auth_key);
}
invalidateSelf();
}
示例7: sendCommitKeyMessage
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void sendCommitKeyMessage(final TLRPC.EncryptedChat encryptedChat, TLRPC.Message resendMessage) {
if (!(encryptedChat instanceof TLRPC.TL_encryptedChat)) {
return;
}
TLRPC.TL_decryptedMessageService reqSend;
if (AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) {
reqSend = new TLRPC.TL_decryptedMessageService();
} else {
reqSend = new TLRPC.TL_decryptedMessageService_layer8();
reqSend.random_bytes = new byte[15];
Utilities.random.nextBytes(reqSend.random_bytes);
}
TLRPC.Message message;
if (resendMessage != null) {
message = resendMessage;
reqSend.action = message.action.encryptedAction;
} else {
reqSend.action = new TLRPC.TL_decryptedMessageActionCommitKey();
reqSend.action.exchange_id = encryptedChat.exchange_id;
reqSend.action.key_fingerprint = encryptedChat.future_key_fingerprint;
message = createServiceSecretMessage(encryptedChat, reqSend.action);
}
reqSend.random_id = message.random_id;
performSendEncryptedRequest(reqSend, message, encryptedChat, null, null, null);
}
示例8: getEncryptedChat
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public TLRPC.EncryptedChat getEncryptedChat(final int chat_id) {
TLRPC.EncryptedChat chat = null;
try {
ArrayList<TLRPC.EncryptedChat> encryptedChats = new ArrayList<>();
getEncryptedChatsInternal("" + chat_id, encryptedChats, null);
if (!encryptedChats.isEmpty()) {
chat = encryptedChats.get(0);
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
return chat;
}
示例9: sendAbortKeyMessage
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void sendAbortKeyMessage(final TLRPC.EncryptedChat encryptedChat, TLRPC.Message resendMessage, long excange_id) {
if (!(encryptedChat instanceof TLRPC.TL_encryptedChat)) {
return;
}
TLRPC.TL_decryptedMessageService reqSend;
if (AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) {
reqSend = new TLRPC.TL_decryptedMessageService();
} else {
reqSend = new TLRPC.TL_decryptedMessageService_layer8();
reqSend.random_bytes = new byte[15];
Utilities.random.nextBytes(reqSend.random_bytes);
}
TLRPC.Message message;
if (resendMessage != null) {
message = resendMessage;
reqSend.action = message.action.encryptedAction;
} else {
reqSend.action = new TLRPC.TL_decryptedMessageActionAbortKey();
reqSend.action.exchange_id = excange_id;
message = createServiceSecretMessage(encryptedChat, reqSend.action);
}
reqSend.random_id = message.random_id;
performSendEncryptedRequest(reqSend, message, encryptedChat, null, null, null);
}
示例10: putEncryptedChat
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void putEncryptedChat(TLRPC.EncryptedChat encryptedChat, boolean fromCache) {
if (encryptedChat == null) {
return;
}
if (fromCache) {
encryptedChats.putIfAbsent(encryptedChat.id, encryptedChat);
} else {
encryptedChats.put(encryptedChat.id, encryptedChat);
}
}
示例11: 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;
}
示例12: sendMessagesReadMessage
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void sendMessagesReadMessage(TLRPC.EncryptedChat encryptedChat, ArrayList<Long> random_ids, TLRPC.Message resendMessage) {
if (!(encryptedChat instanceof TLRPC.TL_encryptedChat)) {
return;
}
TLRPC.TL_decryptedMessageService reqSend;
if (AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) {
reqSend = new TLRPC.TL_decryptedMessageService();
} else {
reqSend = new TLRPC.TL_decryptedMessageService_layer8();
reqSend.random_bytes = new byte[15];
Utilities.random.nextBytes(reqSend.random_bytes);
}
TLRPC.Message message;
if (resendMessage != null) {
message = resendMessage;
reqSend.action = message.action.encryptedAction;
} else {
reqSend.action = new TLRPC.TL_decryptedMessageActionReadMessages();
reqSend.action.random_ids = random_ids;
message = createServiceSecretMessage(encryptedChat, reqSend.action);
}
reqSend.random_id = message.random_id;
performSendEncryptedRequest(reqSend, message, encryptedChat, null, null, null);
}
示例13: getEncryptedChat
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public TLRPC.EncryptedChat getEncryptedChat(Integer id) {
return encryptedChats.get(id);
}
示例14: updateEncryptedChat
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void updateEncryptedChat(final TLRPC.EncryptedChat chat) {
if (chat == null) {
return;
}
storageQueue.postRunnable(new Runnable() {
@Override
public void run() {
SQLitePreparedStatement state = null;
try {
if ((chat.key_hash == null || chat.key_hash.length < 16) && chat.auth_key != null) {
chat.key_hash = AndroidUtilities.calcAuthKeyHash(chat.auth_key);
}
state = database.executeFast("UPDATE enc_chats SET data = ?, g = ?, authkey = ?, ttl = ?, layer = ?, seq_in = ?, seq_out = ?, use_count = ?, exchange_id = ?, key_date = ?, fprint = ?, fauthkey = ?, khash = ?, in_seq_no = ? WHERE uid = ?");
NativeByteBuffer data = new NativeByteBuffer(chat.getObjectSize());
NativeByteBuffer data2 = new NativeByteBuffer(chat.a_or_b != null ? chat.a_or_b.length : 1);
NativeByteBuffer data3 = new NativeByteBuffer(chat.auth_key != null ? chat.auth_key.length : 1);
NativeByteBuffer data4 = new NativeByteBuffer(chat.future_auth_key != null ? chat.future_auth_key.length : 1);
NativeByteBuffer data5 = new NativeByteBuffer(chat.key_hash != null ? chat.key_hash.length : 1);
chat.serializeToStream(data);
state.bindByteBuffer(1, data);
if (chat.a_or_b != null) {
data2.writeBytes(chat.a_or_b);
}
if (chat.auth_key != null) {
data3.writeBytes(chat.auth_key);
}
if (chat.future_auth_key != null) {
data4.writeBytes(chat.future_auth_key);
}
if (chat.key_hash != null) {
data5.writeBytes(chat.key_hash);
}
state.bindByteBuffer(2, data2);
state.bindByteBuffer(3, data3);
state.bindInteger(4, chat.ttl);
state.bindInteger(5, chat.layer);
state.bindInteger(6, chat.seq_in);
state.bindInteger(7, chat.seq_out);
state.bindInteger(8, (int) chat.key_use_count_in << 16 | chat.key_use_count_out);
state.bindLong(9, chat.exchange_id);
state.bindInteger(10, chat.key_create_date);
state.bindLong(11, chat.future_key_fingerprint);
state.bindByteBuffer(12, data4);
state.bindByteBuffer(13, data5);
state.bindInteger(14, chat.in_seq_no);
state.bindInteger(15, chat.id);
state.step();
data.reuse();
data2.reuse();
data3.reuse();
data4.reuse();
data5.reuse();
} catch (Exception e) {
FileLog.e("tmessages", e);
} finally {
if (state != null) {
state.dispose();
}
}
}
});
}
示例15: getCurrentEncryptedChat
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public TLRPC.EncryptedChat getCurrentEncryptedChat() {
return currentEncryptedChat;
}