Java Code Examples for org.telegram.tgnet.TLRPC#TL_inputPeerPhotoFileLocation
The following examples show how to use
org.telegram.tgnet.TLRPC#TL_inputPeerPhotoFileLocation .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileRefController.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
private boolean getPeerReferenceReplacement(TLRPC.User user, TLRPC.Chat chat, boolean big, TLRPC.InputFileLocation location, TLRPC.InputFileLocation[] replacement, boolean[] needReplacement) { if (needReplacement != null && needReplacement[0]) { replacement[0] = new TLRPC.TL_inputPeerPhotoFileLocation(); replacement[0].id = location.volume_id; replacement[0].volume_id = location.volume_id; replacement[0].local_id = location.local_id; replacement[0].big = big; TLRPC.InputPeer peer; if (user != null) { TLRPC.TL_inputPeerUser inputPeerUser = new TLRPC.TL_inputPeerUser(); inputPeerUser.user_id = user.id; inputPeerUser.access_hash = user.access_hash; peer = inputPeerUser; } else { if (ChatObject.isChannel(chat)) { TLRPC.TL_inputPeerChat inputPeerChat = new TLRPC.TL_inputPeerChat(); inputPeerChat.chat_id = chat.id; peer = inputPeerChat; } else { TLRPC.TL_inputPeerChannel inputPeerChannel = new TLRPC.TL_inputPeerChannel(); inputPeerChannel.channel_id = chat.id; inputPeerChannel.access_hash = chat.access_hash; peer = inputPeerChannel; } } replacement[0].peer = peer; return true; } return false; }
Example 2
Source File: FileRefController.java From Telegram with GNU General Public License v2.0 | 5 votes |
private boolean getPeerReferenceReplacement(TLRPC.User user, TLRPC.Chat chat, boolean big, TLRPC.InputFileLocation location, TLRPC.InputFileLocation[] replacement, boolean[] needReplacement) { if (needReplacement != null && needReplacement[0]) { replacement[0] = new TLRPC.TL_inputPeerPhotoFileLocation(); replacement[0].id = location.volume_id; replacement[0].volume_id = location.volume_id; replacement[0].local_id = location.local_id; replacement[0].big = big; TLRPC.InputPeer peer; if (user != null) { TLRPC.TL_inputPeerUser inputPeerUser = new TLRPC.TL_inputPeerUser(); inputPeerUser.user_id = user.id; inputPeerUser.access_hash = user.access_hash; peer = inputPeerUser; } else { if (ChatObject.isChannel(chat)) { TLRPC.TL_inputPeerChat inputPeerChat = new TLRPC.TL_inputPeerChat(); inputPeerChat.chat_id = chat.id; peer = inputPeerChat; } else { TLRPC.TL_inputPeerChannel inputPeerChannel = new TLRPC.TL_inputPeerChannel(); inputPeerChannel.channel_id = chat.id; inputPeerChannel.access_hash = chat.access_hash; peer = inputPeerChannel; } } replacement[0].peer = peer; return true; } return false; }
Example 3
Source File: FileLoadOperation.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public FileLoadOperation(ImageLocation imageLocation, Object parent, String extension, int size) { parentObject = parent; if (imageLocation.isEncrypted()) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; iv = new byte[32]; System.arraycopy(imageLocation.iv, 0, iv, 0, iv.length); key = imageLocation.key; } else if (imageLocation.photoPeer != null) { location = new TLRPC.TL_inputPeerPhotoFileLocation(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.big = imageLocation.photoPeerBig; location.peer = imageLocation.photoPeer; } else if (imageLocation.stickerSet != null) { location = new TLRPC.TL_inputStickerSetThumb(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.stickerset = imageLocation.stickerSet; } else if (imageLocation.thumbSize != null) { if (imageLocation.photoId != 0) { location = new TLRPC.TL_inputPhotoFileLocation(); location.id = imageLocation.photoId; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; location.thumb_size = imageLocation.thumbSize; } else { location = new TLRPC.TL_inputDocumentFileLocation(); location.id = imageLocation.documentId; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; location.thumb_size = imageLocation.thumbSize; } if (location.file_reference == null) { location.file_reference = new byte[0]; } } else { location = new TLRPC.TL_inputFileLocation(); location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.secret = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; if (location.file_reference == null) { location.file_reference = new byte[0]; } allowDisordererFileSave = true; } ungzip = imageLocation.imageType == FileLoader.IMAGE_TYPE_LOTTIE || imageLocation.imageType == FileLoader.IMAGE_TYPE_SVG; initialDatacenterId = datacenterId = imageLocation.dc_id; currentType = ConnectionsManager.FileTypePhoto; totalBytesCount = size; ext = extension != null ? extension : "jpg"; }
Example 4
Source File: FileLoadOperation.java From Telegram with GNU General Public License v2.0 | 4 votes |
public FileLoadOperation(ImageLocation imageLocation, Object parent, String extension, int size) { parentObject = parent; if (imageLocation.isEncrypted()) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; iv = new byte[32]; System.arraycopy(imageLocation.iv, 0, iv, 0, iv.length); key = imageLocation.key; } else if (imageLocation.photoPeer != null) { location = new TLRPC.TL_inputPeerPhotoFileLocation(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.big = imageLocation.photoPeerBig; location.peer = imageLocation.photoPeer; } else if (imageLocation.stickerSet != null) { location = new TLRPC.TL_inputStickerSetThumb(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.stickerset = imageLocation.stickerSet; } else if (imageLocation.thumbSize != null) { if (imageLocation.photoId != 0) { location = new TLRPC.TL_inputPhotoFileLocation(); location.id = imageLocation.photoId; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; location.thumb_size = imageLocation.thumbSize; } else { location = new TLRPC.TL_inputDocumentFileLocation(); location.id = imageLocation.documentId; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; location.thumb_size = imageLocation.thumbSize; } if (location.file_reference == null) { location.file_reference = new byte[0]; } } else { location = new TLRPC.TL_inputFileLocation(); location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.secret = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; if (location.file_reference == null) { location.file_reference = new byte[0]; } allowDisordererFileSave = true; } ungzip = imageLocation.imageType == FileLoader.IMAGE_TYPE_LOTTIE || imageLocation.imageType == FileLoader.IMAGE_TYPE_SVG; initialDatacenterId = datacenterId = imageLocation.dc_id; currentType = ConnectionsManager.FileTypePhoto; totalBytesCount = size; ext = extension != null ? extension : "jpg"; }