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

The following examples show how to use org.telegram.tgnet.TLRPC#TL_contacts_resolveUsername . 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: BaseLocationAdapter.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void searchBotUser()
{
    if (searchingUser)
    {
        return;
    }
    searchingUser = true;
    TLRPC.TL_contacts_resolveUsername req = new TLRPC.TL_contacts_resolveUsername();
    req.username = MessagesController.getInstance(currentAccount).venueSearchBot;
    ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) ->
    {
        if (response != null)
        {
            AndroidUtilities.runOnUIThread(() ->
            {
                TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
                MessagesController.getInstance(currentAccount).putUsers(res.users, false);
                MessagesController.getInstance(currentAccount).putChats(res.chats, false);
                MessagesStorage.getInstance(currentAccount).putUsersAndChats(res.users, res.chats, true, true);
                Location coord = lastSearchLocation;
                lastSearchLocation = null;
                searchPlacesWithQuery(lastSearchQuery, coord, false);
            });
        }
    });
}
 
Example 2
Source File: BaseLocationAdapter.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void searchBotUser()
{
    if (searchingUser)
    {
        return;
    }
    searchingUser = true;
    TLRPC.TL_contacts_resolveUsername req = new TLRPC.TL_contacts_resolveUsername();
    req.username = MessagesController.getInstance(currentAccount).venueSearchBot;
    ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) ->
    {
        if (response != null)
        {
            AndroidUtilities.runOnUIThread(() ->
            {
                TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
                MessagesController.getInstance(currentAccount).putUsers(res.users, false);
                MessagesController.getInstance(currentAccount).putChats(res.chats, false);
                MessagesStorage.getInstance(currentAccount).putUsersAndChats(res.users, res.chats, true, true);
                Location coord = lastSearchLocation;
                lastSearchLocation = null;
                searchPlacesWithQuery(lastSearchQuery, coord, false);
            });
        }
    });
}
 
Example 3
Source File: PhotoPickerActivity.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private void searchBotUser(boolean gif) {
    if (searchingUser) {
        return;
    }
    searchingUser = true;
    TLRPC.TL_contacts_resolveUsername req = new TLRPC.TL_contacts_resolveUsername();
    req.username = gif ? MessagesController.getInstance(currentAccount).gifSearchBot : MessagesController.getInstance(currentAccount).imageSearchBot;
    ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
        if (response != null) {
            AndroidUtilities.runOnUIThread(() -> {
                TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
                MessagesController.getInstance(currentAccount).putUsers(res.users, false);
                MessagesController.getInstance(currentAccount).putChats(res.chats, false);
                MessagesStorage.getInstance(currentAccount).putUsersAndChats(res.users, res.chats, true, true);
                String str = lastSearchImageString;
                lastSearchImageString = null;
                searchImages(gif, str, "", false);
            });
        }
    });
}
 
Example 4
Source File: BaseLocationAdapter.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private void searchBotUser() {
    if (searchingUser) {
        return;
    }
    searchingUser = true;
    TLRPC.TL_contacts_resolveUsername req = new TLRPC.TL_contacts_resolveUsername();
    req.username = MessagesController.getInstance(currentAccount).venueSearchBot;
    ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
        if (response != null) {
            AndroidUtilities.runOnUIThread(() -> {
                TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
                MessagesController.getInstance(currentAccount).putUsers(res.users, false);
                MessagesController.getInstance(currentAccount).putChats(res.chats, false);
                MessagesStorage.getInstance(currentAccount).putUsersAndChats(res.users, res.chats, true, true);
                Location coord = lastSearchLocation;
                lastSearchLocation = null;
                searchPlacesWithQuery(lastSearchQuery, coord, false);
            });
        }
    });
}
 
Example 5
Source File: WallpapersListActivity.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private void searchBotUser() {
    if (searchingUser) {
        return;
    }
    searchingUser = true;
    TLRPC.TL_contacts_resolveUsername req = new TLRPC.TL_contacts_resolveUsername();
    req.username = MessagesController.getInstance(currentAccount).imageSearchBot;
    ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
        if (response != null) {
            AndroidUtilities.runOnUIThread(() -> {
                TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
                MessagesController.getInstance(currentAccount).putUsers(res.users, false);
                MessagesController.getInstance(currentAccount).putChats(res.chats, false);
                MessagesStorage.getInstance(currentAccount).putUsersAndChats(res.users, res.chats, true, true);
                String str = lastSearchImageString;
                lastSearchImageString = null;
                searchImages(str, "", false);
            });
        }
    });
}
 
Example 6
Source File: PhotoPickerActivity.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private void searchBotUser(boolean gif) {
    if (searchingUser) {
        return;
    }
    searchingUser = true;
    TLRPC.TL_contacts_resolveUsername req = new TLRPC.TL_contacts_resolveUsername();
    req.username = gif ? MessagesController.getInstance(currentAccount).gifSearchBot : MessagesController.getInstance(currentAccount).imageSearchBot;
    ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
        if (response != null) {
            AndroidUtilities.runOnUIThread(() -> {
                TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
                MessagesController.getInstance(currentAccount).putUsers(res.users, false);
                MessagesController.getInstance(currentAccount).putChats(res.chats, false);
                MessagesStorage.getInstance(currentAccount).putUsersAndChats(res.users, res.chats, true, true);
                String str = lastSearchImageString;
                lastSearchImageString = null;
                searchImages(gif, str, "", false);
            });
        }
    });
}
 
Example 7
Source File: BaseLocationAdapter.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private void searchBotUser() {
    if (searchingUser) {
        return;
    }
    searchingUser = true;
    TLRPC.TL_contacts_resolveUsername req = new TLRPC.TL_contacts_resolveUsername();
    req.username = MessagesController.getInstance(currentAccount).venueSearchBot;
    ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
        if (response != null) {
            AndroidUtilities.runOnUIThread(() -> {
                TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
                MessagesController.getInstance(currentAccount).putUsers(res.users, false);
                MessagesController.getInstance(currentAccount).putChats(res.chats, false);
                MessagesStorage.getInstance(currentAccount).putUsersAndChats(res.users, res.chats, true, true);
                Location coord = lastSearchLocation;
                lastSearchLocation = null;
                searchPlacesWithQuery(lastSearchQuery, coord, false);
            });
        }
    });
}
 
Example 8
Source File: WallpapersListActivity.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private void searchBotUser() {
    if (searchingUser) {
        return;
    }
    searchingUser = true;
    TLRPC.TL_contacts_resolveUsername req = new TLRPC.TL_contacts_resolveUsername();
    req.username = MessagesController.getInstance(currentAccount).imageSearchBot;
    ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
        if (response != null) {
            AndroidUtilities.runOnUIThread(() -> {
                TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
                MessagesController.getInstance(currentAccount).putUsers(res.users, false);
                MessagesController.getInstance(currentAccount).putChats(res.chats, false);
                MessagesStorage.getInstance(currentAccount).putUsersAndChats(res.users, res.chats, true, true);
                String str = lastSearchImageString;
                lastSearchImageString = null;
                searchImages(str, "", false);
            });
        }
    });
}
 
Example 9
Source File: PhotoPickerActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void searchBotUser() {
    if (searchingUser) {
        return;
    }
    searchingUser = true;
    TLRPC.TL_contacts_resolveUsername req = new TLRPC.TL_contacts_resolveUsername();
    req.username = MessagesController.getInstance(currentAccount).imageSearchBot;
    ConnectionsManager.getInstance(currentAccount).sendRequest(req, new RequestDelegate() {
        @Override
        public void run(final TLObject response, TLRPC.TL_error error) {
            if (response != null) {
                AndroidUtilities.runOnUIThread(new Runnable() {
                    @Override
                    public void run() {
                        TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
                        MessagesController.getInstance(currentAccount).putUsers(res.users, false);
                        MessagesController.getInstance(currentAccount).putChats(res.chats, false);
                        MessagesStorage.getInstance(currentAccount).putUsersAndChats(res.users, res.chats, true, true);
                        String str = lastSearchImageString;
                        lastSearchImageString = null;
                        searchImages(str, "", false);
                    }
                });
            }
        }
    });
}
 
Example 10
Source File: PhotoPickerActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void searchBotUser() {
    if (searchingUser) {
        return;
    }
    searchingUser = true;
    TLRPC.TL_contacts_resolveUsername req = new TLRPC.TL_contacts_resolveUsername();
    req.username = MessagesController.getInstance(currentAccount).imageSearchBot;
    ConnectionsManager.getInstance(currentAccount).sendRequest(req, new RequestDelegate() {
        @Override
        public void run(final TLObject response, TLRPC.TL_error error) {
            if (response != null) {
                AndroidUtilities.runOnUIThread(new Runnable() {
                    @Override
                    public void run() {
                        TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
                        MessagesController.getInstance(currentAccount).putUsers(res.users, false);
                        MessagesController.getInstance(currentAccount).putChats(res.chats, false);
                        MessagesStorage.getInstance(currentAccount).putUsersAndChats(res.users, res.chats, true, true);
                        String str = lastSearchImageString;
                        lastSearchImageString = null;
                        searchImages(str, "", false);
                    }
                });
            }
        }
    });
}