当前位置: 首页>>代码示例>>Java>>正文


Java TLRPC.Message方法代码示例

本文整理汇总了Java中org.telegram.tgnet.TLRPC.Message方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.Message方法的具体用法?Java TLRPC.Message怎么用?Java TLRPC.Message使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.telegram.tgnet.TLRPC的用法示例。


在下文中一共展示了TLRPC.Message方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: broadcastPinnedMessage

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private static MessageObject broadcastPinnedMessage(final TLRPC.Message result, final ArrayList<TLRPC.User> users, final ArrayList<TLRPC.Chat> chats, final boolean isCache, boolean returnValue) {
    final HashMap<Integer, TLRPC.User> usersDict = new HashMap<>();
    for (int a = 0; a < users.size(); a++) {
        TLRPC.User user = users.get(a);
        usersDict.put(user.id, user);
    }
    final HashMap<Integer, TLRPC.Chat> chatsDict = new HashMap<>();
    for (int a = 0; a < chats.size(); a++) {
        TLRPC.Chat chat = chats.get(a);
        chatsDict.put(chat.id, chat);
    }
    if (returnValue) {
        return new MessageObject(result, usersDict, chatsDict, false);
    } else {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public void run() {
                MessagesController.getInstance().putUsers(users, isCache);
                MessagesController.getInstance().putChats(chats, isCache);
                NotificationCenter.getInstance().postNotificationName(NotificationCenter.didLoadedPinnedMessage, new MessageObject(result, usersDict, chatsDict, false));
            }
        });
    }
    return null;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:26,代码来源:MessagesQuery.java

示例2: 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);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:27,代码来源:SecretChatHelper.java

示例3: 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;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:25,代码来源:SecretChatHelper.java

示例4: 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;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:33,代码来源:SecretChatHelper.java

示例5: broadcastReplyMessages

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private static void broadcastReplyMessages(final ArrayList<TLRPC.Message> result, final HashMap<Integer, ArrayList<MessageObject>> replyMessageOwners, final ArrayList<TLRPC.User> users, final ArrayList<TLRPC.Chat> chats, final long dialog_id, final boolean isCache) {
    final HashMap<Integer, TLRPC.User> usersDict = new HashMap<>();
    for (int a = 0; a < users.size(); a++) {
        TLRPC.User user = users.get(a);
        usersDict.put(user.id, user);
    }
    final HashMap<Integer, TLRPC.Chat> chatsDict = new HashMap<>();
    for (int a = 0; a < chats.size(); a++) {
        TLRPC.Chat chat = chats.get(a);
        chatsDict.put(chat.id, chat);
    }
    AndroidUtilities.runOnUIThread(new Runnable() {
        @Override
        public void run() {
            MessagesController.getInstance().putUsers(users, isCache);
            MessagesController.getInstance().putChats(chats, isCache);
            boolean changed = false;
            for (int a = 0; a < result.size(); a++) {
                TLRPC.Message message = result.get(a);
                ArrayList<MessageObject> arrayList = replyMessageOwners.get(message.id);
                if (arrayList != null) {
                    MessageObject messageObject = new MessageObject(message, usersDict, chatsDict, false);
                    for (int b = 0; b < arrayList.size(); b++) {
                        MessageObject m = arrayList.get(b);
                        m.replyMessageObject = messageObject;
                        if (m.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage) {
                            m.generatePinMessageText(null, null);
                        }
                    }
                    changed = true;
                }
            }
            if (changed) {
                NotificationCenter.getInstance().postNotificationName(NotificationCenter.didLoadedReplyMessages, dialog_id);
            }
        }
    });
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:39,代码来源:MessagesQuery.java

示例6: saveMessagesThumbs

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static void saveMessagesThumbs(ArrayList<TLRPC.Message> messages) {
    if (messages == null || messages.isEmpty()) {
        return;
    }
    for (int a = 0; a < messages.size(); a++) {
        TLRPC.Message message = messages.get(a);
        saveMessageThumbs(message);
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:10,代码来源:ImageLoader.java

示例7: saveReplyMessages

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private static void saveReplyMessages(final HashMap<Integer, ArrayList<MessageObject>> replyMessageOwners, final ArrayList<TLRPC.Message> result) {
    MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() {
        @Override
        public void run() {
            try {
                MessagesStorage.getInstance().getDatabase().beginTransaction();
                SQLitePreparedStatement state = MessagesStorage.getInstance().getDatabase().executeFast("UPDATE messages SET replydata = ? WHERE mid = ?");
                for (int a = 0; a < result.size(); a++) {
                    TLRPC.Message message = result.get(a);
                    ArrayList<MessageObject> messageObjects = replyMessageOwners.get(message.id);
                    if (messageObjects != null) {
                        NativeByteBuffer data = new NativeByteBuffer(message.getObjectSize());
                        message.serializeToStream(data);
                        for (int b = 0; b < messageObjects.size(); b++) {
                            MessageObject messageObject = messageObjects.get(b);
                            state.requery();
                            long messageId = messageObject.getId();
                            if (messageObject.messageOwner.to_id.channel_id != 0) {
                                messageId |= ((long) messageObject.messageOwner.to_id.channel_id) << 32;
                            }
                            state.bindByteBuffer(1, data);
                            state.bindLong(2, messageId);
                            state.step();
                        }
                        data.reuse();
                    }
                }
                state.dispose();
                MessagesStorage.getInstance().getDatabase().commitTransaction();
            } catch (Exception e) {
                FileLog.e("tmessages", e);
            }
        }
    });
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:36,代码来源:MessagesQuery.java

示例8: sendNoopMessage

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void sendNoopMessage(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_decryptedMessageActionNoop();
        message = createServiceSecretMessage(encryptedChat, reqSend.action);
    }
    reqSend.random_id = message.random_id;

    performSendEncryptedRequest(reqSend, message, encryptedChat, null, null, null);
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:28,代码来源:SecretChatHelper.java

示例9: sendScreenshotMessage

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void sendScreenshotMessage(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_decryptedMessageActionScreenshotMessages();
        reqSend.action.random_ids = random_ids;
        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);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:36,代码来源:SecretChatHelper.java

示例10: getUnreadFlags

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static int getUnreadFlags(TLRPC.Message message) {
    int flags = 0;
    if (!message.unread) {
        flags |= 1;
    }
    if (!message.media_unread) {
        flags |= 2;
    }
    return flags;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:11,代码来源:MessageObject.java

示例11: getMediaType

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static int getMediaType(TLRPC.Message message) {
    if (message == null) {
        return -1;
    }
    if (message.media instanceof TLRPC.TL_messageMediaPhoto) {
        return MEDIA_PHOTOVIDEO;
    } else if (message.media instanceof TLRPC.TL_messageMediaDocument) {
        if (MessageObject.isVoiceMessage(message)) {
            return MEDIA_AUDIO;
        } else if (MessageObject.isVideoMessage(message)) {
            return MEDIA_PHOTOVIDEO;
        } else if (MessageObject.isStickerMessage(message)) {
            return -1;
        } else if (MessageObject.isMusicMessage(message)) {
            return MEDIA_MUSIC;
        } else {
            return MEDIA_FILE;
        }
    } else if (!message.entities.isEmpty()) {
        for (int a = 0; a < message.entities.size(); a++) {
            TLRPC.MessageEntity entity = message.entities.get(a);
            if (entity instanceof TLRPC.TL_messageEntityUrl || entity instanceof TLRPC.TL_messageEntityTextUrl || entity instanceof TLRPC.TL_messageEntityEmail) {
                return MEDIA_URL;
            }
        }
    }
    return -1;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:29,代码来源:AllSharedMediaQuery.java

示例12: putBotKeyboard

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static void putBotKeyboard(final long did, final TLRPC.Message message) {
    if (message == null) {
        return;
    }
    try {
        int mid = 0;
        SQLiteCursor cursor = MessagesStorage.getInstance().getDatabase().queryFinalized(String.format(Locale.US, "SELECT mid FROM bot_keyboard WHERE uid = %d", did));
        if (cursor.next()) {
            mid = cursor.intValue(0);
        }
        cursor.dispose();
        if (mid >= message.id) {
            return;
        }

        SQLitePreparedStatement state = MessagesStorage.getInstance().getDatabase().executeFast("REPLACE INTO bot_keyboard VALUES(?, ?, ?)");
        state.requery();
        NativeByteBuffer data = new NativeByteBuffer(message.getObjectSize());
        message.serializeToStream(data);
        state.bindLong(1, did);
        state.bindInteger(2, message.id);
        state.bindByteBuffer(3, data);
        state.step();
        data.reuse();
        state.dispose();

        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public void run() {
                TLRPC.Message old = botKeyboards.put(did, message);
                if (old != null) {
                    botKeyboardsByMids.remove(old.id);
                }
                botKeyboardsByMids.put(message.id, did);
                NotificationCenter.getInstance().postNotificationName(NotificationCenter.botKeyboardDidLoaded, message, did);
            }
        });
    } catch (Exception e) {
        FileLog.e("tmessages", e);
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:42,代码来源:BotQuery.java

示例13: putMessages

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void putMessages(final ArrayList<TLRPC.Message> messages, final boolean withTransaction, boolean useQueue, final boolean doNotUpdateDialogDate, final int downloadMask) {
    putMessages(messages, withTransaction, useQueue, doNotUpdateDialogDate, downloadMask, false);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:4,代码来源:MessagesStorage.java

示例14: isForwardedMessage

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static boolean isForwardedMessage(TLRPC.Message message) {
    return (message.flags & TLRPC.MESSAGE_FLAG_FWD) != 0;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:4,代码来源:MessageObject.java

示例15: saveDraft

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static void saveDraft(long did, CharSequence message, ArrayList<TLRPC.MessageEntity> entities, TLRPC.Message replyToMessage, boolean noWebpage) {
    saveDraft(did, message, entities, replyToMessage, noWebpage, false);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:4,代码来源:DraftQuery.java


注:本文中的org.telegram.tgnet.TLRPC.Message方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。