Java Code Examples for org.telegram.tgnet.TLRPC#TL_channelFull

The following examples show how to use org.telegram.tgnet.TLRPC#TL_channelFull . 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: ProfileActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void updateOnlineCount()
{
    onlineCount = 0;
    if (info instanceof TLRPC.TL_chatFull || info instanceof TLRPC.TL_channelFull && info.participants_count <= 200 && info.participants != null)
    {
        sortParticipants(chatOnlineParticipantsList);
        int currentTime = ConnectionsManager.getInstance(currentAccount).getCurrentTime();
        for (TLRPC.ChatParticipant participant : chatOnlineParticipantsList)
        {
            if (!isParticipantOnline(participant, currentTime))
                break;

            onlineCount++;
        }
    }
}
 
Example 2
Source File: ChatAvatarContainer.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public void updateOnlineCount() {
    if (parentFragment == null) {
        return;
    }
    onlineCount = 0;
    TLRPC.ChatFull info = parentFragment.getCurrentChatInfo();
    if (info == null) {
        return;
    }
    int currentTime = ConnectionsManager.getInstance(currentAccount).getCurrentTime();
    if (info instanceof TLRPC.TL_chatFull || info instanceof TLRPC.TL_channelFull && info.participants_count <= 200 && info.participants != null) {
        for (int a = 0; a < info.participants.participants.size(); a++) {
            TLRPC.ChatParticipant participant = info.participants.participants.get(a);
            TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(participant.user_id);
            if (user != null && user.status != null && (user.status.expires > currentTime || user.id == UserConfig.getInstance(currentAccount).getClientUserId()) && user.status.expires > 10000) {
                onlineCount++;
            }
        }
    }
}
 
Example 3
Source File: ProfileActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void updateOnlineCount()
{
    onlineCount = 0;
    if (info instanceof TLRPC.TL_chatFull || info instanceof TLRPC.TL_channelFull && info.participants_count <= 200 && info.participants != null)
    {
        sortParticipants(chatOnlineParticipantsList);
        int currentTime = ConnectionsManager.getInstance(currentAccount).getCurrentTime();
        for (TLRPC.ChatParticipant participant : chatOnlineParticipantsList)
        {
            if (!isParticipantOnline(participant, currentTime))
                break;

            onlineCount++;
        }
    }
}
 
Example 4
Source File: ChatAvatarContainer.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public void updateOnlineCount() {
    if (parentFragment == null) {
        return;
    }
    onlineCount = 0;
    TLRPC.ChatFull info = parentFragment.getCurrentChatInfo();
    if (info == null) {
        return;
    }
    int currentTime = ConnectionsManager.getInstance(currentAccount).getCurrentTime();
    if (info instanceof TLRPC.TL_chatFull || info instanceof TLRPC.TL_channelFull && info.participants_count <= 200 && info.participants != null) {
        for (int a = 0; a < info.participants.participants.size(); a++) {
            TLRPC.ChatParticipant participant = info.participants.participants.get(a);
            TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(participant.user_id);
            if (user != null && user.status != null && (user.status.expires > currentTime || user.id == UserConfig.getInstance(currentAccount).getClientUserId()) && user.status.expires > 10000) {
                onlineCount++;
            }
        }
    }
}
 
Example 5
Source File: ChatAvatarContainer.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
public void updateOnlineCount() {
    if (parentFragment == null) {
        return;
    }
    onlineCount = 0;
    TLRPC.ChatFull info = parentFragment.getCurrentChatInfo();
    if (info == null) {
        return;
    }
    int currentTime = ConnectionsManager.getInstance(currentAccount).getCurrentTime();
    if (info instanceof TLRPC.TL_chatFull || info instanceof TLRPC.TL_channelFull && info.participants_count <= 200 && info.participants != null) {
        for (int a = 0; a < info.participants.participants.size(); a++) {
            TLRPC.ChatParticipant participant = info.participants.participants.get(a);
            TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(participant.user_id);
            if (user != null && user.status != null && (user.status.expires > currentTime || user.id == UserConfig.getInstance(currentAccount).getClientUserId()) && user.status.expires > 10000) {
                onlineCount++;
            }
        }
    } else if (info instanceof TLRPC.TL_channelFull && info.participants_count > 200) {
        onlineCount = info.online_count;
    }
}
 
Example 6
Source File: ChatAvatarContainer.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
public void updateOnlineCount() {
    if (parentFragment == null) {
        return;
    }
    onlineCount = 0;
    TLRPC.ChatFull info = parentFragment.getCurrentChatInfo();
    if (info == null) {
        return;
    }
    int currentTime = ConnectionsManager.getInstance(currentAccount).getCurrentTime();
    if (info instanceof TLRPC.TL_chatFull || info instanceof TLRPC.TL_channelFull && info.participants_count <= 200 && info.participants != null) {
        for (int a = 0; a < info.participants.participants.size(); a++) {
            TLRPC.ChatParticipant participant = info.participants.participants.get(a);
            TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(participant.user_id);
            if (user != null && user.status != null && (user.status.expires > currentTime || user.id == UserConfig.getInstance(currentAccount).getClientUserId()) && user.status.expires > 10000) {
                onlineCount++;
            }
        }
    } else if (info instanceof TLRPC.TL_channelFull && info.participants_count > 200) {
        onlineCount = info.online_count;
    }
}
 
Example 7
Source File: ProfileActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void fetchUsersFromChannelInfo()
{
    if (currentChat == null || !currentChat.megagroup)
        return;

    if (info instanceof TLRPC.TL_channelFull && info.participants != null)
    {
        for (int a = 0; a < chatParticipantsList.size(); a++)
        {
            TLRPC.ChatParticipant chatParticipant = chatParticipantsList.get(a);
            participantsMap.put(chatParticipant.user_id, chatParticipant);
        }
    }
}
 
Example 8
Source File: ChannelEditActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.chatInfoDidLoaded) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        if (chatFull.id == chat_id) {
            boolean byChannelUsers = (Boolean) args[2];
            if (info instanceof TLRPC.TL_channelFull) {
                if (chatFull.participants == null && info != null) {
                    chatFull.participants = info.participants;
                }
            }
            boolean loadChannelParticipants = info == null && chatFull instanceof TLRPC.TL_channelFull;
            info = chatFull;
            fetchUsersFromChannelInfo();
            updateRowsIds();
            if (listViewAdapter != null) {
                listViewAdapter.notifyDataSetChanged();
            }
            TLRPC.Chat newChat = MessagesController.getInstance(currentAccount).getChat(chat_id);
            if (newChat != null) {
                currentChat = newChat;
            }
            if (loadChannelParticipants || !byChannelUsers) {
                getChannelParticipants(true);
            }
        }
    } else if (id == NotificationCenter.closeChats) {
        removeSelfFromStack();
    }
}
 
Example 9
Source File: ChannelEditActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void fetchUsersFromChannelInfo() {
    if (info instanceof TLRPC.TL_channelFull && info.participants != null) {
        for (int a = 0; a < info.participants.participants.size(); a++) {
            TLRPC.ChatParticipant chatParticipant = info.participants.participants.get(a);
            participantsMap.put(chatParticipant.user_id, chatParticipant);
        }
    }
}
 
Example 10
Source File: ProfileActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void fetchUsersFromChannelInfo()
{
    if (currentChat == null || !currentChat.megagroup)
        return;

    if (info instanceof TLRPC.TL_channelFull && info.participants != null)
    {
        for (int a = 0; a < chatParticipantsList.size(); a++)
        {
            TLRPC.ChatParticipant chatParticipant = chatParticipantsList.get(a);
            participantsMap.put(chatParticipant.user_id, chatParticipant);
        }
    }
}
 
Example 11
Source File: ChannelEditActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.chatInfoDidLoaded) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        if (chatFull.id == chat_id) {
            boolean byChannelUsers = (Boolean) args[2];
            if (info instanceof TLRPC.TL_channelFull) {
                if (chatFull.participants == null && info != null) {
                    chatFull.participants = info.participants;
                }
            }
            boolean loadChannelParticipants = info == null && chatFull instanceof TLRPC.TL_channelFull;
            info = chatFull;
            fetchUsersFromChannelInfo();
            updateRowsIds();
            if (listViewAdapter != null) {
                listViewAdapter.notifyDataSetChanged();
            }
            TLRPC.Chat newChat = MessagesController.getInstance(currentAccount).getChat(chat_id);
            if (newChat != null) {
                currentChat = newChat;
            }
            if (loadChannelParticipants || !byChannelUsers) {
                getChannelParticipants(true);
            }
        }
    } else if (id == NotificationCenter.closeChats) {
        removeSelfFromStack();
    }
}
 
Example 12
Source File: ChannelEditActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void fetchUsersFromChannelInfo() {
    if (info instanceof TLRPC.TL_channelFull && info.participants != null) {
        for (int a = 0; a < info.participants.participants.size(); a++) {
            TLRPC.ChatParticipant chatParticipant = info.participants.participants.get(a);
            participantsMap.put(chatParticipant.user_id, chatParticipant);
        }
    }
}
 
Example 13
Source File: MentionsAdapter.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public Object getItem(int i)
{
    if (searchResultBotContext != null)
    {
        if (searchResultBotContextSwitch != null)
        {
            if (i == 0)
            {
                return searchResultBotContextSwitch;
            }
            else
            {
                i--;
            }
        }
        if (i < 0 || i >= searchResultBotContext.size())
        {
            return null;
        }
        return searchResultBotContext.get(i);
    }
    else if (searchResultUsernames != null)
    {
        if (i < 0 || i >= searchResultUsernames.size())
        {
            return null;
        }
        return searchResultUsernames.get(i);
    }
    else if (searchResultHashtags != null)
    {
        if (i < 0 || i >= searchResultHashtags.size())
        {
            return null;
        }
        return searchResultHashtags.get(i);
    }
    else if (searchResultSuggestions != null)
    {
        if (i < 0 || i >= searchResultSuggestions.size())
        {
            return null;
        }
        return searchResultSuggestions.get(i);
    }
    else if (searchResultCommands != null)
    {
        if (i < 0 || i >= searchResultCommands.size())
        {
            return null;
        }
        if (searchResultCommandsUsers != null && (botsCount != 1 || info instanceof TLRPC.TL_channelFull))
        {
            if (searchResultCommandsUsers.get(i) != null)
            {
                return String.format("%s@%s", searchResultCommands.get(i), searchResultCommandsUsers.get(i) != null ? searchResultCommandsUsers.get(i).username : "");
            }
            else
            {
                return String.format("%s", searchResultCommands.get(i));
            }
        }
        return searchResultCommands.get(i);
    }
    return null;
}
 
Example 14
Source File: MentionsAdapter.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public Object getItem(int i)
{
    if (searchResultBotContext != null)
    {
        if (searchResultBotContextSwitch != null)
        {
            if (i == 0)
            {
                return searchResultBotContextSwitch;
            }
            else
            {
                i--;
            }
        }
        if (i < 0 || i >= searchResultBotContext.size())
        {
            return null;
        }
        return searchResultBotContext.get(i);
    }
    else if (searchResultUsernames != null)
    {
        if (i < 0 || i >= searchResultUsernames.size())
        {
            return null;
        }
        return searchResultUsernames.get(i);
    }
    else if (searchResultHashtags != null)
    {
        if (i < 0 || i >= searchResultHashtags.size())
        {
            return null;
        }
        return searchResultHashtags.get(i);
    }
    else if (searchResultSuggestions != null)
    {
        if (i < 0 || i >= searchResultSuggestions.size())
        {
            return null;
        }
        return searchResultSuggestions.get(i);
    }
    else if (searchResultCommands != null)
    {
        if (i < 0 || i >= searchResultCommands.size())
        {
            return null;
        }
        if (searchResultCommandsUsers != null && (botsCount != 1 || info instanceof TLRPC.TL_channelFull))
        {
            if (searchResultCommandsUsers.get(i) != null)
            {
                return String.format("%s@%s", searchResultCommands.get(i), searchResultCommandsUsers.get(i) != null ? searchResultCommandsUsers.get(i).username : "");
            }
            else
            {
                return String.format("%s", searchResultCommands.get(i));
            }
        }
        return searchResultCommands.get(i);
    }
    return null;
}
 
Example 15
Source File: MentionsAdapter.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public Object getItem(int i) {
    if (searchResultBotContext != null) {
        if (searchResultBotContextSwitch != null) {
            if (i == 0) {
                return searchResultBotContextSwitch;
            } else {
                i--;
            }
        }
        if (i < 0 || i >= searchResultBotContext.size()) {
            return null;
        }
        return searchResultBotContext.get(i);
    } else if (searchResultUsernames != null) {
        if (i < 0 || i >= searchResultUsernames.size()) {
            return null;
        }
        return searchResultUsernames.get(i);
    } else if (searchResultHashtags != null) {
        if (i < 0 || i >= searchResultHashtags.size()) {
            return null;
        }
        return searchResultHashtags.get(i);
    } else if (searchResultSuggestions != null) {
        if (i < 0 || i >= searchResultSuggestions.size()) {
            return null;
        }
        return searchResultSuggestions.get(i);
    } else if (searchResultCommands != null) {
        if (i < 0 || i >= searchResultCommands.size()) {
            return null;
        }
        if (searchResultCommandsUsers != null && (botsCount != 1 || info instanceof TLRPC.TL_channelFull)) {
            if (searchResultCommandsUsers.get(i) != null) {
                return String.format("%s@%s", searchResultCommands.get(i), searchResultCommandsUsers.get(i) != null ? searchResultCommandsUsers.get(i).username : "");
            } else {
                return String.format("%s", searchResultCommands.get(i));
            }
        }
        return searchResultCommands.get(i);
    }
    return null;
}
 
Example 16
Source File: MentionsAdapter.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public Object getItem(int i) {
    if (searchResultBotContext != null) {
        if (searchResultBotContextSwitch != null) {
            if (i == 0) {
                return searchResultBotContextSwitch;
            } else {
                i--;
            }
        }
        if (i < 0 || i >= searchResultBotContext.size()) {
            return null;
        }
        return searchResultBotContext.get(i);
    } else if (searchResultUsernames != null) {
        if (i < 0 || i >= searchResultUsernames.size()) {
            return null;
        }
        return searchResultUsernames.get(i);
    } else if (searchResultHashtags != null) {
        if (i < 0 || i >= searchResultHashtags.size()) {
            return null;
        }
        return searchResultHashtags.get(i);
    } else if (searchResultSuggestions != null) {
        if (i < 0 || i >= searchResultSuggestions.size()) {
            return null;
        }
        return searchResultSuggestions.get(i);
    } else if (searchResultCommands != null) {
        if (i < 0 || i >= searchResultCommands.size()) {
            return null;
        }
        if (searchResultCommandsUsers != null && (botsCount != 1 || info instanceof TLRPC.TL_channelFull)) {
            if (searchResultCommandsUsers.get(i) != null) {
                return String.format("%s@%s", searchResultCommands.get(i), searchResultCommandsUsers.get(i) != null ? searchResultCommandsUsers.get(i).username : "");
            } else {
                return String.format("%s", searchResultCommands.get(i));
            }
        }
        return searchResultCommands.get(i);
    }
    return null;
}