This commit is contained in:
B. Petersen
2016-10-26 23:33:58 +02:00
parent 562d0baf8d
commit ba8d919c68
9 changed files with 44 additions and 1617 deletions
@@ -909,12 +909,12 @@ public class MessageObject {
}
boolean useManualParse = !hasEntities && (
messageOwner instanceof TLRPC.TL_message_old ||
//messageOwner instanceof TLRPC.TL_message_old ||
//messageOwner instanceof TLRPC.TL_message_old2 ||
//messageOwner instanceof TLRPC.TL_message_old3 ||
//messageOwner instanceof TLRPC.TL_message_old4 ||
messageOwner instanceof TLRPC.TL_messageForwarded_old ||
messageOwner instanceof TLRPC.TL_messageForwarded_old2 ||
//messageOwner instanceof TLRPC.TL_messageForwarded_old ||
//messageOwner instanceof TLRPC.TL_messageForwarded_old2 ||
messageOwner instanceof TLRPC.TL_message_secret ||
isOut() && messageOwner.send_state != MESSAGE_SEND_STATE_SENT ||
messageOwner.id < 0 || messageOwner.media instanceof TLRPC.TL_messageMediaUnsupported);
@@ -1077,18 +1077,18 @@ public class MessagesController implements NotificationCenter.NotificationCenter
//MessagesStorage.getInstance().updateDialogsWithDeletedMessages(messages, true, channelId);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.messagesDeleted, messages, channelId);
if (channelId != 0) {
TLRPC.TL_channels_deleteMessages req = new TLRPC.TL_channels_deleteMessages();
/*TLRPC.TL_channels_deleteMessages req = new TLRPC.TL_channels_deleteMessages();
req.id = toSend;
req.channel = getInputChannel(channelId);
ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
@Override
public void run(TLObject response, TLRPC.TL_error error) {
if (error == null) {
//TLRPC.TL_messages_affectedMessages res = (TLRPC.TL_messages_affectedMessages) response;
//processNewChannelDifferenceParams(res.pts, res.pts_count, channelId);
TLRPC.TL_messages_affectedMessages res = (TLRPC.TL_messages_affectedMessages) response;
processNewChannelDifferenceParams(res.pts, res.pts_count, channelId);
}
}
});
});*/
} else {
/*
if (randoms != null && encryptedChat != null && !randoms.isEmpty()) {
@@ -1141,37 +1141,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
return searchImage;
}
public void loadChannelParticipants(final Integer chat_id) {
if (loadingFullParticipants.contains(chat_id) || loadedFullParticipants.contains(chat_id)) {
return;
}
loadingFullParticipants.add(chat_id);
final TLRPC.TL_channels_getParticipants req = new TLRPC.TL_channels_getParticipants();
req.channel = getInputChannel(chat_id);
req.filter = new TLRPC.TL_channelParticipantsRecent();
req.offset = 0;
req.limit = 32;
ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
@Override
public void run(final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
if (error == null) {
TLRPC.TL_channels_channelParticipants res = (TLRPC.TL_channels_channelParticipants) response;
putUsers(res.users, false);
//MessagesStorage.getInstance().putUsersAndChats(res.users, null, true, true);
//MessagesStorage.getInstance().updateChannelUsers(chat_id, res.participants);
loadedFullParticipants.add(chat_id);
}
loadingFullParticipants.remove(chat_id);
}
});
}
});
}
public void loadChatInfo(final int chat_id, Semaphore semaphore, boolean force) {
//MessagesStorage.getInstance().loadChatInfo(chat_id, semaphore, force, false);
}
@@ -1872,7 +1841,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
});
}
}, ConnectionsManager.RequestFlagFailOnServerErrors);
} else if (type == ChatObject.CHAT_TYPE_CHANNEL || type == ChatObject.CHAT_TYPE_MEGAGROUP) {
} /*else if (type == ChatObject.CHAT_TYPE_CHANNEL || type == ChatObject.CHAT_TYPE_MEGAGROUP) {
TLRPC.TL_channels_createChannel req = new TLRPC.TL_channels_createChannel();
req.title = title;
req.about = about;
@@ -1888,11 +1857,9 @@ public class MessagesController implements NotificationCenter.NotificationCenter
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
/* EDUT BY MR
if (error.text.startsWith("FLOOD_WAIT")) {
AlertsCreator.showFloodWaitAlert(error.text, fragment);
}
*/
NotificationCenter.getInstance().postNotificationName(NotificationCenter.chatDidFailCreate);
}
});
@@ -1914,7 +1881,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
});
}
}, ConnectionsManager.RequestFlagFailOnServerErrors);
}
}*/
return 0;
}
@@ -1929,7 +1896,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
public void changeChatAvatar(int chat_id, TLRPC.InputFile uploadedAvatar) {
TLObject request;
if (ChatObject.isChannel(chat_id)) {
/*if (ChatObject.isChannel(chat_id)) {
TLRPC.TL_channels_editPhoto req = new TLRPC.TL_channels_editPhoto();
req.channel = getInputChannel(chat_id);
if (uploadedAvatar != null) {
@@ -1940,7 +1907,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
req.photo = new TLRPC.TL_inputChatPhotoEmpty();
}
request = req;
} else {
} else*/ {
TLRPC.TL_messages_editChatPhoto req = new TLRPC.TL_messages_editChatPhoto();
req.chat_id = chat_id;
if (uploadedAvatar != null) {
File diff suppressed because it is too large Load Diff
@@ -166,23 +166,6 @@ public class SharedMediaQuery {
return -1;
}
public static boolean canAddMessageToMedia(TLRPC.Message message) {
if (message instanceof TLRPC.TL_message_secret && message.media instanceof TLRPC.TL_messageMediaPhoto && message.ttl != 0 && message.ttl <= 60) {
return false;
} else if (message.media instanceof TLRPC.TL_messageMediaPhoto ||
message.media instanceof TLRPC.TL_messageMediaDocument && !MessageObject.isGifDocument(message.media.document)) {
return true;
} else if (!message.entities.isEmpty()) {
for (int a = 0; a < message.entities.size(); a++) {
TLRPC.MessageEntity entity = message.entities.get(a);
if (entity instanceof TLRPC.TL_messageEntityUrl || entity instanceof TLRPC.TL_messageEntityTextUrl || entity instanceof TLRPC.TL_messageEntityEmail) {
return true;
}
}
}
return false;
}
private static void processLoadedMedia(final TLRPC.messages_Messages res, final long uid, int offset, int count, int max_id, final int type, final boolean fromCache, final int classGuid, final boolean isChannel, final boolean topReached) {
int lower_part = (int)uid;
if (fromCache && res.messages.isEmpty() && lower_part != 0) {
@@ -498,37 +498,6 @@ public class TLRPC {
}
}
public static class TL_messages_affectedMessages extends TLObject {
public static int constructor = 0x84d19185;
public int pts;
public int pts_count;
public static TL_messages_affectedMessages TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
if (TL_messages_affectedMessages.constructor != constructor) {
if (exception) {
throw new RuntimeException(String.format("can't parse magic %x in TL_messages_affectedMessages", constructor));
} else {
return null;
}
}
TL_messages_affectedMessages result = new TL_messages_affectedMessages();
result.readParams(stream, exception);
return result;
}
public void readParams(AbstractSerializedData stream, boolean exception) {
pts = stream.readInt32(exception);
pts_count = stream.readInt32(exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(pts);
stream.writeInt32(pts_count);
}
}
public static class PrivacyKey extends TLObject {
public static PrivacyKey TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
@@ -1027,7 +996,6 @@ public class TLRPC {
public int w;
public int h;
public int duration;
public BotInlineMessage send_message;
public Photo photo;
public Document document;
public long query_id;
@@ -1044,7 +1012,6 @@ public class TLRPC {
public boolean silent;
public int mute_until;
public String sound;
public int events_mask;
public static PeerNotifySettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
PeerNotifySettings result = null;
@@ -1196,7 +1163,6 @@ public class TLRPC {
public static class Audio extends TLObject {
public long id;
public long access_hash;
public int date;
public int duration;
public String mime_type;
@@ -1224,19 +1190,6 @@ public class TLRPC {
}
}
public static class ReplyMarkup extends TLObject {
public ArrayList<TL_keyboardButtonRow> rows = new ArrayList<>();
public int flags;
public boolean selective;
public boolean single_use;
public boolean resize;
public static ReplyMarkup TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
ReplyMarkup result = null;
return result;
}
}
public static class contacts_Contacts extends TLObject {
public ArrayList<TL_contact> contacts = new ArrayList<>();
public ArrayList<User> users = new ArrayList<>();
@@ -1627,155 +1580,6 @@ public class TLRPC {
}
}
public static class KeyboardButton extends TLObject {
public String text;
public String query;
public byte[] data;
public String url;
public static KeyboardButton TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
KeyboardButton result = null;
return result;
}
}
public static class TL_keyboardButtonSwitchInline extends KeyboardButton {
public static int constructor = 0xea1b7a14;
public void readParams(AbstractSerializedData stream, boolean exception) {
text = stream.readString(exception);
query = stream.readString(exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeString(text);
stream.writeString(query);
}
}
public static class BotInlineMessage extends TLObject {
public int flags;
public GeoPoint geo;
public ReplyMarkup reply_markup;
public String caption;
public boolean no_webpage;
public String message;
public ArrayList<MessageEntity> entities = new ArrayList<>();
public String phone_number;
public String first_name;
public String last_name;
public String title;
public String address;
public String provider;
public String venue_id;
public static BotInlineMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
BotInlineMessage result = null;
return result;
}
}
public static class TL_botInlineMessageMediaGeo extends BotInlineMessage {
public static int constructor = 0x3a8fd8b8;
public void readParams(AbstractSerializedData stream, boolean exception) {
flags = stream.readInt32(exception);
geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 4) != 0) {
reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
}
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(flags);
geo.serializeToStream(stream);
if ((flags & 4) != 0) {
reply_markup.serializeToStream(stream);
}
}
}
public static class TL_botInlineMessageMediaVenue extends BotInlineMessage {
public static int constructor = 0x4366232e;
public void readParams(AbstractSerializedData stream, boolean exception) {
flags = stream.readInt32(exception);
geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception);
title = stream.readString(exception);
address = stream.readString(exception);
provider = stream.readString(exception);
venue_id = stream.readString(exception);
if ((flags & 4) != 0) {
reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
}
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(flags);
geo.serializeToStream(stream);
stream.writeString(title);
stream.writeString(address);
stream.writeString(provider);
stream.writeString(venue_id);
if ((flags & 4) != 0) {
reply_markup.serializeToStream(stream);
}
}
}
public static class TL_keyboardButtonRow extends TLObject {
public static int constructor = 0x77608b83;
public ArrayList<KeyboardButton> buttons = new ArrayList<>();
public static TL_keyboardButtonRow TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
if (TL_keyboardButtonRow.constructor != constructor) {
if (exception) {
throw new RuntimeException(String.format("can't parse magic %x in TL_keyboardButtonRow", constructor));
} else {
return null;
}
}
TL_keyboardButtonRow result = new TL_keyboardButtonRow();
result.readParams(stream, exception);
return result;
}
public void readParams(AbstractSerializedData stream, boolean exception) {
int magic = stream.readInt32(exception);
if (magic != 0x1cb5c415) {
if (exception) {
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
}
return;
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
KeyboardButton object = KeyboardButton.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
buttons.add(object);
}
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(0x1cb5c415);
int count = buttons.size();
stream.writeInt32(count);
for (int a = 0; a < count; a++) {
buttons.get(a).serializeToStream(stream);
}
}
}
public static class Bool extends TLObject {
public static Bool TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
@@ -2273,23 +2077,6 @@ public class TLRPC {
}
}
public static class ChannelParticipantsFilter extends TLObject {
public static ChannelParticipantsFilter TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
ChannelParticipantsFilter result = null;
return result;
}
}
public static class TL_channelParticipantsRecent extends ChannelParticipantsFilter {
public static int constructor = 0xde3f3c79;
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class MessageAction extends TLObject {
public String title;
public String address;
@@ -4567,156 +4354,6 @@ public class TLRPC {
}
}
public static class ChannelParticipant extends TLObject {
public int user_id;
public int date;
public int inviter_id;
public int kicked_by;
public static ChannelParticipant TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
ChannelParticipant result = null;
return result;
}
}
public static class TL_channelParticipant extends ChannelParticipant {
public static int constructor = 0x15ebac1d;
public void readParams(AbstractSerializedData stream, boolean exception) {
user_id = stream.readInt32(exception);
date = stream.readInt32(exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(user_id);
stream.writeInt32(date);
}
}
public static class TL_channelParticipantEditor extends ChannelParticipant {
public static int constructor = 0x98192d61;
public void readParams(AbstractSerializedData stream, boolean exception) {
user_id = stream.readInt32(exception);
inviter_id = stream.readInt32(exception);
date = stream.readInt32(exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(user_id);
stream.writeInt32(inviter_id);
stream.writeInt32(date);
}
}
public static class TL_channelParticipantModerator extends ChannelParticipant {
public static int constructor = 0x91057fef;
public void readParams(AbstractSerializedData stream, boolean exception) {
user_id = stream.readInt32(exception);
inviter_id = stream.readInt32(exception);
date = stream.readInt32(exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(user_id);
stream.writeInt32(inviter_id);
stream.writeInt32(date);
}
}
public static class TL_channelParticipantCreator extends ChannelParticipant {
public static int constructor = 0xe3e2e1f9;
public void readParams(AbstractSerializedData stream, boolean exception) {
user_id = stream.readInt32(exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(user_id);
}
}
public static class TL_channels_channelParticipants extends TLObject {
public static int constructor = 0xf56ee2a8;
public int count;
public ArrayList<ChannelParticipant> participants = new ArrayList<>();
public ArrayList<User> users = new ArrayList<>();
public static TL_channels_channelParticipants TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
if (TL_channels_channelParticipants.constructor != constructor) {
if (exception) {
throw new RuntimeException(String.format("can't parse magic %x in TL_channels_channelParticipants", constructor));
} else {
return null;
}
}
TL_channels_channelParticipants result = new TL_channels_channelParticipants();
result.readParams(stream, exception);
return result;
}
public void readParams(AbstractSerializedData stream, boolean exception) {
count = stream.readInt32(exception);
int magic = stream.readInt32(exception);
if (magic != 0x1cb5c415) {
if (exception) {
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
}
return;
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
ChannelParticipant object = ChannelParticipant.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
participants.add(object);
}
magic = stream.readInt32(exception);
if (magic != 0x1cb5c415) {
if (exception) {
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
}
return;
}
count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
User object = User.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
users.add(object);
}
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(count);
stream.writeInt32(0x1cb5c415);
int count = participants.size();
stream.writeInt32(count);
for (int a = 0; a < count; a++) {
participants.get(a).serializeToStream(stream);
}
stream.writeInt32(0x1cb5c415);
count = users.size();
stream.writeInt32(count);
for (int a = 0; a < count; a++) {
users.get(a).serializeToStream(stream);
}
}
}
public static class TL_contacts_found extends TLObject {
public static int constructor = 0x1aa1f784;
@@ -7354,91 +6991,6 @@ public class TLRPC {
}
}
public static class TL_channels_deleteMessages extends TLObject {
public static int constructor = 0x84c1fd4e;
public InputChannel channel;
public ArrayList<Integer> id = new ArrayList<>();
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
return TL_messages_affectedMessages.TLdeserialize(stream, constructor, exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
channel.serializeToStream(stream);
stream.writeInt32(0x1cb5c415);
int count = id.size();
stream.writeInt32(count);
for (int a = 0; a < count; a++) {
stream.writeInt32(id.get(a));
}
}
}
public static class TL_channels_getParticipants extends TLObject {
public static int constructor = 0x24d98f92;
public InputChannel channel;
public ChannelParticipantsFilter filter;
public int offset;
public int limit;
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
return TL_channels_channelParticipants.TLdeserialize(stream, constructor, exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
channel.serializeToStream(stream);
filter.serializeToStream(stream);
stream.writeInt32(offset);
stream.writeInt32(limit);
}
}
public static class TL_channels_createChannel extends TLObject {
public static int constructor = 0xf4893d7f;
public int flags;
public boolean broadcast;
public boolean megagroup;
public String title;
public String about;
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
return Updates.TLdeserialize(stream, constructor, exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
flags = broadcast ? (flags | 1) : (flags &~ 1);
flags = megagroup ? (flags | 2) : (flags &~ 2);
stream.writeInt32(flags);
stream.writeString(title);
stream.writeString(about);
}
}
public static class TL_channels_editPhoto extends TLObject {
public static int constructor = 0xf12e57c9;
public InputChannel channel;
public InputChatPhoto photo;
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
return Updates.TLdeserialize(stream, constructor, exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
channel.serializeToStream(stream);
photo.serializeToStream(stream);
}
}
//manually created
//MessageMedia start
@@ -7509,7 +7061,6 @@ public class TLRPC {
public boolean unread;
public ArrayList<MessageEntity> entities = new ArrayList<>();
public String via_bot_name;
public ReplyMarkup reply_markup;
public int views;
public int edit_date;
public boolean silent;
@@ -7590,9 +7141,6 @@ public class TLRPC {
} else {
media = new TL_messageMediaEmpty();
}
if ((flags & 64) != 0) {
reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 128) != 0) {
int magic = stream.readInt32(exception);
if (magic != 0x1cb5c415) {
@@ -7665,9 +7213,6 @@ public class TLRPC {
if ((flags & 512) != 0) {
media.serializeToStream(stream);
}
if ((flags & 64) != 0) {
reply_markup.serializeToStream(stream);
}
if ((flags & 128) != 0) {
stream.writeInt32(0x1cb5c415);
int count = entities.size();
@@ -7696,134 +7241,6 @@ public class TLRPC {
}
}
public static class TL_messageForwarded_old2 extends Message {
public static int constructor = 0xa367e716;
public void readParams(AbstractSerializedData stream, boolean exception) {
flags = stream.readInt32(exception);
unread = (flags & 1) != 0;
out = (flags & 2) != 0;
mentioned = (flags & 16) != 0;
media_unread = (flags & 32) != 0;
id = stream.readInt32(exception);
fwd_from = new TL_messageFwdHeader();
fwd_from.from_id = stream.readInt32(exception);
fwd_from.flags |= 1;
fwd_from.date = stream.readInt32(exception);
from_id = stream.readInt32(exception);
to_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
date = stream.readInt32(exception);
message = stream.readString(exception);
flags |= MESSAGE_FLAG_FWD | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA;
media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception);
if (id < 0) {
fwd_msg_id = stream.readInt32(exception);
}
if (id < 0 || (media != null && !(media instanceof TL_messageMediaEmpty) && message != null && message.length() != 0 && message.startsWith("-1"))) {
attachPath = stream.readString(exception);
}
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
flags = unread ? (flags | 1) : (flags &~ 1);
flags = out ? (flags | 2) : (flags &~ 2);
flags = mentioned ? (flags | 16) : (flags &~ 16);
flags = media_unread ? (flags | 32) : (flags &~ 32);
stream.writeInt32(flags);
stream.writeInt32(id);
stream.writeInt32(fwd_from.from_id);
stream.writeInt32(fwd_from.date);
stream.writeInt32(from_id);
to_id.serializeToStream(stream);
stream.writeInt32(date);
stream.writeString(message);
media.serializeToStream(stream);
if (id < 0) {
stream.writeInt32(fwd_msg_id);
}
stream.writeString(attachPath);
}
}
public static class TL_messageForwarded_old extends TL_messageForwarded_old2 {
public static int constructor = 0x5f46804;
public void readParams(AbstractSerializedData stream, boolean exception) {
id = stream.readInt32(exception);
fwd_from = new TL_messageFwdHeader();
fwd_from.from_id = stream.readInt32(exception);
fwd_from.flags |= 1;
fwd_from.date = stream.readInt32(exception);
from_id = stream.readInt32(exception);
to_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
out = stream.readBool(exception);
unread = stream.readBool(exception);
flags |= MESSAGE_FLAG_FWD | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA;
date = stream.readInt32(exception);
message = stream.readString(exception);
media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception);
if (id < 0) {
fwd_msg_id = stream.readInt32(exception);
}
if (id < 0 || (media != null && !(media instanceof TL_messageMediaEmpty) && !(media instanceof TL_messageMediaWebPage) && message != null && message.length() != 0 && message.startsWith("-1"))) {
attachPath = stream.readString(exception);
}
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(id);
stream.writeInt32(fwd_from.from_id);
stream.writeInt32(fwd_from.date);
stream.writeInt32(from_id);
to_id.serializeToStream(stream);
stream.writeBool(out);
stream.writeBool(unread);
stream.writeInt32(date);
stream.writeString(message);
media.serializeToStream(stream);
if (id < 0) {
stream.writeInt32(fwd_msg_id);
}
stream.writeString(attachPath);
}
}
public static class TL_message_old extends TL_message {
public static int constructor = 0x22eb6aba;
public void readParams(AbstractSerializedData stream, boolean exception) {
id = stream.readInt32(exception);
from_id = stream.readInt32(exception);
to_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
out = stream.readBool(exception);
unread = stream.readBool(exception);
flags |= MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA;
date = stream.readInt32(exception);
message = stream.readString(exception);
media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception);
if (id < 0 || (media != null && !(media instanceof TL_messageMediaEmpty) && !(media instanceof TL_messageMediaWebPage) && message != null && message.length() != 0 && message.startsWith("-1"))) {
attachPath = stream.readString(exception);
}
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(id);
stream.writeInt32(from_id);
to_id.serializeToStream(stream);
stream.writeBool(out);
stream.writeBool(unread);
stream.writeInt32(date);
stream.writeString(message);
media.serializeToStream(stream);
stream.writeString(attachPath);
}
}
public static class TL_message_secret extends TL_message {
public static int constructor = 0x555555f9;
@@ -8045,14 +7462,6 @@ public class TLRPC {
}
//TL_dialog end
//ChatParticipant start
public static class TL_chatChannelParticipant extends ChatParticipant {
public static int constructor = 0xc8d7493e;
public TLRPC.ChannelParticipant channelParticipant;
}
//ChatParticipant end
//Chat start
public static class TL_chatEmpty extends Chat {
public static int constructor = 0x9ba2d800;
@@ -226,11 +226,11 @@ public class ContextLinkCell extends View implements MediaController.FileDownloa
}
}
if (url == null && currentPhotoObject == null && currentPhotoObjectThumb == null) {
if (inlineResult.send_message instanceof TLRPC.TL_botInlineMessageMediaVenue || inlineResult.send_message instanceof TLRPC.TL_botInlineMessageMediaGeo) {
/*if (inlineResult.send_message instanceof TLRPC.TL_botInlineMessageMediaVenue || inlineResult.send_message instanceof TLRPC.TL_botInlineMessageMediaGeo) {
double lat = inlineResult.send_message.geo.lat;
double lon = inlineResult.send_message.geo._long;
url = String.format(Locale.US, "https://maps.googleapis.com/maps/api/staticmap?center=%f,%f&zoom=15&size=72x72&maptype=roadmap&scale=%d&markers=color:red|size:small|%f,%f&sensor=false", lat, lon, Math.min(2, (int) Math.ceil(AndroidUtilities.density)), lat, lon);
}
}*/
}
int width;
@@ -500,7 +500,7 @@ public class ContextLinkCell extends View implements MediaController.FileDownloa
letterDrawable.draw(canvas);
}
} else {
if (inlineResult != null && (inlineResult.send_message instanceof TLRPC.TL_botInlineMessageMediaGeo || inlineResult.send_message instanceof TLRPC.TL_botInlineMessageMediaVenue)) {
/*if (inlineResult != null && (inlineResult.send_message instanceof TLRPC.TL_botInlineMessageMediaGeo || inlineResult.send_message instanceof TLRPC.TL_botInlineMessageMediaVenue)) {
int w = Theme.inlineLocationDrawable.getIntrinsicWidth();
int h = Theme.inlineLocationDrawable.getIntrinsicHeight();
int x = linkImageView.getImageX() + (linkImageView.getImageWidth() - w) / 2;
@@ -508,7 +508,7 @@ public class ContextLinkCell extends View implements MediaController.FileDownloa
canvas.drawRect(linkImageView.getImageX(), linkImageView.getImageY(), linkImageView.getImageX() + linkImageView.getImageWidth(), linkImageView.getImageY() + linkImageView.getImageHeight(), LetterDrawable.paint);
Theme.inlineLocationDrawable.setBounds(x, y, x + w, y + h);
Theme.inlineLocationDrawable.draw(canvas);
}
}*/
}
if (drawLinkImageView) {
canvas.save();
@@ -5735,7 +5735,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
if (currentChat != null && chatFull.id == currentChat.id) {
if (chatFull instanceof TLRPC.TL_channelFull) {
if (currentChat.megagroup) {
/*if (currentChat.megagroup) {
int lastDate = 0;
if (chatFull.participants != null) {
for (int a = 0; a < chatFull.participants.participants.size(); a++) {
@@ -5745,7 +5745,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (lastDate == 0 || Math.abs(System.currentTimeMillis() / 1000 - lastDate) > 60 * 60) {
MessagesController.getInstance().loadChannelParticipants(currentChat.id);
}
}
}*/
if (chatFull.participants == null && info != null) {
chatFull.participants = info.participants;
}
@@ -6246,45 +6246,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
public boolean processSwitchButton(TLRPC.TL_keyboardButtonSwitchInline button) {
if (inlineReturn == 0) {
return false;
}
String query = "@" + currentUser.username + " " + button.query;
if (inlineReturn == dialog_id) {
inlineReturn = 0;
chatActivityEnterView.setFieldText(query);
} else {
DraftQuery.saveDraft(inlineReturn, query, null, null, false);
if (parentLayout.fragmentsStack.size() > 1) {
BaseFragment prevFragment = parentLayout.fragmentsStack.get(parentLayout.fragmentsStack.size() - 2);
if (prevFragment instanceof ChatActivity && ((ChatActivity) prevFragment).dialog_id == inlineReturn) {
finishFragment();
} else {
Bundle bundle = new Bundle();
int lower_part = (int) inlineReturn;
int high_part = (int) (inlineReturn >> 32);
if (lower_part != 0) {
if (lower_part > 0) {
bundle.putInt("user_id", lower_part);
} else if (lower_part < 0) {
bundle.putInt("chat_id", -lower_part);
}
} else {
bundle.putInt("enc_id", high_part);
}
/*ActionBarLayout parentLayout = ChatActivity.this.parentLayout;
if (lastFragment != null) {
NotificationCenter.getInstance().removeObserver(lastFragment, NotificationCenter.closeChats);
}
NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats);*/
presentFragment(new ChatActivity(bundle), true);
}
}
}
return true;
}
private void updateSearchButtons(int mask, int num, int count) {
if (searchUpButton != null) {
searchUpButton.setEnabled((mask & 1) != 0);
@@ -370,8 +370,8 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
private boolean allowShowTopView;
private AnimatorSet currentTopViewAnimation;
private MessageObject pendingMessageObject;
private TLRPC.KeyboardButton pendingLocationButton;
//private MessageObject pendingMessageObject;
//private TLRPC.KeyboardButton pendingLocationButton;
private boolean waitingForKeyboardOpen;
private Runnable openKeyboardRunnable = new Runnable() {
@@ -2605,16 +2605,14 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
}
public void onRequestPermissionsResultFragment(int requestCode, String[] permissions, int[] grantResults) {
if (requestCode == 2) {
/*if (requestCode == 2) {
if (pendingLocationButton != null) {
/*
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
SendMessagesHelper.getInstance().sendCurrentLocation(pendingMessageObject, pendingLocationButton);
}
*/
pendingLocationButton = null;
pendingMessageObject = null;
}
}
}*/
}
}
@@ -706,7 +706,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
selectedUser = user.user_id;
if (ChatObject.isChannel(currentChat)) {
/*if (ChatObject.isChannel(currentChat)) {
TLRPC.ChannelParticipant channelParticipant = ((TLRPC.TL_chatChannelParticipant) user).channelParticipant;
if (user.user_id != UserConfig.getClientUserId()) {
if (currentChat.creator) {
@@ -719,7 +719,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
TLRPC.User u = MessagesController.getInstance().getUser(user.user_id);
allowSetAdmin = channelParticipant instanceof TLRPC.TL_channelParticipant && !u.bot;
} else {
} else */ {
if (user.user_id != UserConfig.getClientUserId()) {
if (currentChat.creator) {
allowKick = true;
@@ -1093,6 +1093,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
private void getChannelParticipants(boolean reload) {
/*
if (loadingUsers || participantsMap == null || info == null) {
return;
}
@@ -1145,6 +1146,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
});
ConnectionsManager.getInstance().bindRequestToGuid(reqId, classGuid);
*/
}
private void openAddMember() {
@@ -1845,7 +1847,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if (uid != 0) {
MessagesController.getInstance().deleteUserFromChat(chat_id, MessagesController.getInstance().getUser(uid), info);
if (currentChat.megagroup && info != null && info.participants != null) {
boolean changed = false;
/*boolean changed = false;
for (int a = 0; a < info.participants.participants.size(); a++) {
TLRPC.ChannelParticipant p = ((TLRPC.TL_chatChannelParticipant) info.participants.participants.get(a)).channelParticipant;
if (p.user_id == uid) {
@@ -1871,7 +1873,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
updateOnlineCount();
updateRowsIds();
listAdapter.notifyDataSetChanged();
}
}*/
}
} else {
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.closeChats);
@@ -2502,7 +2504,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
part = info.participants.participants.get(i - emptyRowChat2 - 1);
}
if (part != null) {
if (part instanceof TLRPC.TL_chatChannelParticipant) {
/*if (part instanceof TLRPC.TL_chatChannelParticipant) {
TLRPC.ChannelParticipant channelParticipant = ((TLRPC.TL_chatChannelParticipant) part).channelParticipant;
if (channelParticipant instanceof TLRPC.TL_channelParticipantCreator) {
userCell.setIsAdmin(1);
@@ -2511,7 +2513,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
} else {
userCell.setIsAdmin(0);
}
} else {
} else*/ {
if (part instanceof TLRPC.TL_chatParticipantCreator) {
userCell.setIsAdmin(1);
} else if (currentChat.admins_enabled && part instanceof TLRPC.TL_chatParticipantAdmin) {