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

The following examples show how to use org.telegram.tgnet.TLRPC#TL_chatParticipantCreator . 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 5 votes vote down vote up
private boolean isParticipantAdmin(TLRPC.ChatParticipant participant)
{
    if (participant instanceof TLRPC.TL_chatChannelParticipant)
    {
        TLRPC.ChannelParticipant channelParticipant = ((TLRPC.TL_chatChannelParticipant) participant).channelParticipant;
        return channelParticipant instanceof TLRPC.TL_channelParticipantCreator || channelParticipant instanceof TLRPC.TL_channelParticipantAdmin;
    }
    else
    {
        return participant instanceof TLRPC.TL_chatParticipantCreator || (currentChat != null &&
                currentChat.admins_enabled && participant instanceof TLRPC.TL_chatParticipantAdmin);
    }
}
 
Example 2
Source File: SetAdminsActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private int getChatAdminParticipantType(TLRPC.ChatParticipant participant) {
    if (participant instanceof TLRPC.TL_chatParticipantCreator) {
        return 0;
    } else if (participant instanceof TLRPC.TL_chatParticipantAdmin) {
        return 1;
    }  else {
        return 2;
    }
}
 
Example 3
Source File: SetAdminsActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean isEnabled(RecyclerView.ViewHolder holder) {
    int position = holder.getAdapterPosition();
    if (position == allAdminsRow) {
        return true;
    } else if (position >= usersStartRow && position < usersEndRow) {
        TLRPC.ChatParticipant participant = participants.get(position - usersStartRow);
        if (!(participant instanceof TLRPC.TL_chatParticipantCreator)) {
            return true;
        }
    }
    return false;
}
 
Example 4
Source File: ProfileActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private boolean isParticipantAdmin(TLRPC.ChatParticipant participant)
{
    if (participant instanceof TLRPC.TL_chatChannelParticipant)
    {
        TLRPC.ChannelParticipant channelParticipant = ((TLRPC.TL_chatChannelParticipant) participant).channelParticipant;
        return channelParticipant instanceof TLRPC.TL_channelParticipantCreator || channelParticipant instanceof TLRPC.TL_channelParticipantAdmin;
    }
    else
    {
        return participant instanceof TLRPC.TL_chatParticipantCreator || (currentChat != null &&
                currentChat.admins_enabled && participant instanceof TLRPC.TL_chatParticipantAdmin);
    }
}
 
Example 5
Source File: SetAdminsActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private int getChatAdminParticipantType(TLRPC.ChatParticipant participant) {
    if (participant instanceof TLRPC.TL_chatParticipantCreator) {
        return 0;
    } else if (participant instanceof TLRPC.TL_chatParticipantAdmin) {
        return 1;
    }  else {
        return 2;
    }
}
 
Example 6
Source File: SetAdminsActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean isEnabled(RecyclerView.ViewHolder holder) {
    int position = holder.getAdapterPosition();
    if (position == allAdminsRow) {
        return true;
    } else if (position >= usersStartRow && position < usersEndRow) {
        TLRPC.ChatParticipant participant = participants.get(position - usersStartRow);
        if (!(participant instanceof TLRPC.TL_chatParticipantCreator)) {
            return true;
        }
    }
    return false;
}
 
Example 7
Source File: ChatEditActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private int getAdminCount() {
    if (info == null) {
        return 1;
    }
    int count = 0;
    for (int a = 0, N = info.participants.participants.size(); a < N; a++) {
        TLRPC.ChatParticipant chatParticipant = info.participants.participants.get(a);
        if (chatParticipant instanceof TLRPC.TL_chatParticipantAdmin ||
                chatParticipant instanceof TLRPC.TL_chatParticipantCreator) {
            count++;
        }
    }
    return count;
}
 
Example 8
Source File: ChatEditActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private int getAdminCount() {
    if (info == null) {
        return 1;
    }
    int count = 0;
    for (int a = 0, N = info.participants.participants.size(); a < N; a++) {
        TLRPC.ChatParticipant chatParticipant = info.participants.participants.get(a);
        if (chatParticipant instanceof TLRPC.TL_chatParticipantAdmin ||
                chatParticipant instanceof TLRPC.TL_chatParticipantCreator) {
            count++;
        }
    }
    return count;
}