private void TL_contacts_ImportedContacts(TL.Object obj) { User.addUsers(obj.getVector("users")); TL.Vector imported = obj.getVector("imported"); for (int i = 0; i < imported.count; i++) { TL.Object c = imported.getObject(i); User.getUser(c.getInt("user_id")).client_id = c.getLong("client_id"); } SyncUtils.updateContacts(Main.main); }
public static void getFullInfo() { synchronized (fullInfoQuery) { if (fullInfoQuery.size() == 0) return; for (int i = 0; i < fullInfoQuery.size(); i++) { User user = fullInfoQuery.get(i); if (user.id == 0) continue; // inputUserEmpty TL.Object inputUser = user.getInputUser(); Main.mtp.api(null, null, "users.getFullUser", inputUser); } fullInfoQuery.clear(); } }
private void TL_messages_StatedMessage(TL.Object obj) { setUpdate(-1, obj.getInt("pts"), obj.getInt("seq")); User.addUsers(obj.getVector("users")); TL.Object message = obj.getObject("message"); Dialog d = Dialog.getDialog(message.getInt("from_id"), message.getObject("to_id"), true); Dialog.newMessage(message, Dialog.MSG_INCOMING); }
public static User addUser(TL.Object user) { if (user == null) return null; int id = user.name.equals("userFull") ? user.getObject("user").getInt("id") : user.getInt("id"); User old = users.get(id); if (old != null) { old.update(user); getFullInfo(); return old; } else { User u = new User(user); users.put(id, u); getFullInfo(); return u; } }
private void TL_messages_StatedMessages(TL.Object obj) { setUpdate(-1, obj.getInt("pts"), obj.getInt("seq")); User.addUsers(obj.getVector("users")); TL.Vector messages = obj.getVector("messages"); for (int i = 0; i < messages.count; i++) { TL.Object message = messages.getObject(i); Dialog d = Dialog.getDialog(message.getInt("from_id"), message.getObject("to_id"), true); Dialog.newMessage(message, Dialog.MSG_INCOMING); } }
public void TL_messages_Dialogs(TL.Object obj) { User.addUsers(obj.getVector("users")); Chat.addChats(obj.getVector("chats")); // dialogs TL.Vector dialogs = obj.getVector("dialogs"); for (int i = 0; i < dialogs.count; i++) { TL.Object dobj = dialogs.getObject(i); Dialog d = Dialog.getDialog(-1, dobj.getObject("peer"), true); d.updating = true; } // messages TL.Vector messages = obj.getVector("messages"); for (int i = 0; i < messages.count; i++) cb.onMessage(messages.getObject(i), Dialog.MSG_HISTORY); for (int i = 0; i < dialogs.count; i++) { TL.Object dobj = dialogs.getObject(i); Dialog d = Dialog.getDialog(-1, dobj.getObject("peer"), true); if (dobj.getInt("top_message") == -7) // config_dialogs magic d.noHistory = true; d.unread_count = dobj.getInt("unread_count"); d.updating = false; Main.main.updateDialog(d); } Common.logError("dialogs: " + Dialog.dialogs.size()); // slice if (obj.name.equals("messages.dialogsSlice") && dialogs.count > 0) { int limit = obj.getInt("count") - Dialog.dialogs.size(); if (limit > 0) api_messages_getDialogs(Dialog.dialogs.size(), 0, limit); } if (Main.main != null) Main.main.resetDialogs(); }
private void TL_User(TL.Object user) { User.addUser(user); }
private void TL_updateUserPhoto(TL.Object update) { User user = User.getUser(update.getInt("user_id")); if (user != null) user.setPhoto(update.getObject("photo")); }
private void TL_updateUserStatus(TL.Object update) { User user = User.getUser(update.getInt("user_id")); if (user != null) user.setStatus(update.getObject("status")); }
private void userTyping(int chat_id, int user_id) { User user = User.getUser(user_id); if (user != null) user.setTyping(chat_id, true); }
public void onUpdate(TL.Object update, TL.Vector users, TL.Vector chats) { User.addUsers(users); Chat.addChats(chats); invoke(update.name, update); }
private void TL_contacts_Contacts(TL.Object obj) { if (obj.name.equals("contacts.contacts")) User.addUsers(obj.getVector("users")); }
private void TL_messages_ChatFull(TL.Object obj) { User.addUsers(obj.getVector("users")); TL.Object full_chat = obj.getObject("full_chat"); Chat chat = Chat.getChat(full_chat.getInt("id")); if (chat != null) chat.update(full_chat); }
private void TL_UserFull(TL.Object userFull) { User.addUser(userFull); }
private void TL_photos_Photo(TL.Object obj) { User.addUsers(obj.getVector("users")); }
public static void addUsers(TL.Vector users) { if (users == null) return; for (int i = 0; i < users.count; i++) User.addUser(users.getObject(i)); }