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

The following examples show how to use org.telegram.tgnet.TLRPC#TL_userEmpty . 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: LocaleController.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public static String formatUserStatus(int currentAccount, TLRPC.User user)
{
    if (user != null && user.status != null && user.status.expires == 0)
    {
        if (user.status instanceof TLRPC.TL_userStatusRecently)
        {
            user.status.expires = -100;
        }
        else if (user.status instanceof TLRPC.TL_userStatusLastWeek)
        {
            user.status.expires = -101;
        }
        else if (user.status instanceof TLRPC.TL_userStatusLastMonth)
        {
            user.status.expires = -102;
        }
    }
    if (user != null && user.status != null && user.status.expires <= 0)
    {
        if (MessagesController.getInstance(currentAccount).onlinePrivacy.containsKey(user.id))
        {
            return getString("Online", R.string.Online);
        }
    }
    if (user == null || user.status == null || user.status.expires == 0 || UserObject.isDeleted(user) || user instanceof TLRPC.TL_userEmpty)
    {
        return getString("ALongTimeAgo", R.string.ALongTimeAgo);
    }
    else
    {
        int currentTime = ConnectionsManager.getInstance(currentAccount).getCurrentTime();
        if (user.status.expires > currentTime)
        {
            return getString("Online", R.string.Online);
        }
        else
        {
            if (user.status.expires == -1)
            {
                return getString("Invisible", R.string.Invisible);
            }
            else if (user.status.expires == -100)
            {
                return getString("Lately", R.string.Lately);
            }
            else if (user.status.expires == -101)
            {
                return getString("WithinAWeek", R.string.WithinAWeek);
            }
            else if (user.status.expires == -102)
            {
                return getString("WithinAMonth", R.string.WithinAMonth);
            }
            else
            {
                return formatDateOnline(user.status.expires);
            }
        }
    }
}
 
Example 2
Source File: UserObject.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public static boolean isDeleted(TLRPC.User user) {
    return user == null || user instanceof TLRPC.TL_userDeleted_old2 || user instanceof TLRPC.TL_userEmpty || user.deleted;
}
 
Example 3
Source File: LocaleController.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public static String formatUserStatus(int currentAccount, TLRPC.User user)
{
    if (user != null && user.status != null && user.status.expires == 0)
    {
        if (user.status instanceof TLRPC.TL_userStatusRecently)
        {
            user.status.expires = -100;
        }
        else if (user.status instanceof TLRPC.TL_userStatusLastWeek)
        {
            user.status.expires = -101;
        }
        else if (user.status instanceof TLRPC.TL_userStatusLastMonth)
        {
            user.status.expires = -102;
        }
    }
    if (user != null && user.status != null && user.status.expires <= 0)
    {
        if (MessagesController.getInstance(currentAccount).onlinePrivacy.containsKey(user.id))
        {
            return getString("Online", R.string.Online);
        }
    }
    if (user == null || user.status == null || user.status.expires == 0 || UserObject.isDeleted(user) || user instanceof TLRPC.TL_userEmpty)
    {
        return getString("ALongTimeAgo", R.string.ALongTimeAgo);
    }
    else
    {
        int currentTime = ConnectionsManager.getInstance(currentAccount).getCurrentTime();
        if (user.status.expires > currentTime)
        {
            return getString("Online", R.string.Online);
        }
        else
        {
            if (user.status.expires == -1)
            {
                return getString("Invisible", R.string.Invisible);
            }
            else if (user.status.expires == -100)
            {
                return getString("Lately", R.string.Lately);
            }
            else if (user.status.expires == -101)
            {
                return getString("WithinAWeek", R.string.WithinAWeek);
            }
            else if (user.status.expires == -102)
            {
                return getString("WithinAMonth", R.string.WithinAMonth);
            }
            else
            {
                return formatDateOnline(user.status.expires);
            }
        }
    }
}
 
Example 4
Source File: UserObject.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public static boolean isDeleted(TLRPC.User user) {
    return user == null || user instanceof TLRPC.TL_userDeleted_old2 || user instanceof TLRPC.TL_userEmpty || user.deleted;
}
 
Example 5
Source File: LocaleController.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public static String formatUserStatus(int currentAccount, TLRPC.User user, boolean[] isOnline) {
    if (user != null && user.status != null && user.status.expires == 0) {
        if (user.status instanceof TLRPC.TL_userStatusRecently) {
            user.status.expires = -100;
        } else if (user.status instanceof TLRPC.TL_userStatusLastWeek) {
            user.status.expires = -101;
        } else if (user.status instanceof TLRPC.TL_userStatusLastMonth) {
            user.status.expires = -102;
        }
    }
    if (user != null && user.status != null && user.status.expires <= 0) {
        if (MessagesController.getInstance(currentAccount).onlinePrivacy.containsKey(user.id)) {
            if (isOnline != null) {
                isOnline[0] = true;
            }
            return getString("Online", R.string.Online);
        }
    }
    if (user == null || user.status == null || user.status.expires == 0 || UserObject.isDeleted(user) || user instanceof TLRPC.TL_userEmpty) {
        return getString("ALongTimeAgo", R.string.ALongTimeAgo);
    } else {
        int currentTime = ConnectionsManager.getInstance(currentAccount).getCurrentTime();
        if (user.status.expires > currentTime) {
            if (isOnline != null) {
                isOnline[0] = true;
            }
            return getString("Online", R.string.Online);
        } else {
            if (user.status.expires == -1) {
                return getString("Invisible", R.string.Invisible);
            } else if (user.status.expires == -100) {
                return getString("Lately", R.string.Lately);
            } else if (user.status.expires == -101) {
                return getString("WithinAWeek", R.string.WithinAWeek);
            } else if (user.status.expires == -102) {
                return getString("WithinAMonth", R.string.WithinAMonth);
            }  else {
                return formatDateOnline(user.status.expires);
            }
        }
    }
}
 
Example 6
Source File: UserObject.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public static boolean isDeleted(TLRPC.User user) {
    return user == null || user instanceof TLRPC.TL_userDeleted_old2 || user instanceof TLRPC.TL_userEmpty || user.deleted;
}
 
Example 7
Source File: LocaleController.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public static String formatUserStatus(int currentAccount, TLRPC.User user, boolean[] isOnline) {
    if (user != null && user.status != null && user.status.expires == 0) {
        if (user.status instanceof TLRPC.TL_userStatusRecently) {
            user.status.expires = -100;
        } else if (user.status instanceof TLRPC.TL_userStatusLastWeek) {
            user.status.expires = -101;
        } else if (user.status instanceof TLRPC.TL_userStatusLastMonth) {
            user.status.expires = -102;
        }
    }
    if (user != null && user.status != null && user.status.expires <= 0) {
        if (MessagesController.getInstance(currentAccount).onlinePrivacy.containsKey(user.id)) {
            if (isOnline != null) {
                isOnline[0] = true;
            }
            return getString("Online", R.string.Online);
        }
    }
    if (user == null || user.status == null || user.status.expires == 0 || UserObject.isDeleted(user) || user instanceof TLRPC.TL_userEmpty) {
        return getString("ALongTimeAgo", R.string.ALongTimeAgo);
    } else {
        int currentTime = ConnectionsManager.getInstance(currentAccount).getCurrentTime();
        if (user.status.expires > currentTime) {
            if (isOnline != null) {
                isOnline[0] = true;
            }
            return getString("Online", R.string.Online);
        } else {
            if (user.status.expires == -1) {
                return getString("Invisible", R.string.Invisible);
            } else if (user.status.expires == -100) {
                return getString("Lately", R.string.Lately);
            } else if (user.status.expires == -101) {
                return getString("WithinAWeek", R.string.WithinAWeek);
            } else if (user.status.expires == -102) {
                return getString("WithinAMonth", R.string.WithinAMonth);
            }  else {
                return formatDateOnline(user.status.expires);
            }
        }
    }
}
 
Example 8
Source File: UserObject.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public static boolean isDeleted(TLRPC.User user) {
    return user == null || user instanceof TLRPC.TL_userDeleted_old2 || user instanceof TLRPC.TL_userEmpty || user.deleted;
}