本文整理汇总了Java中org.telegram.tgnet.TLRPC.Chat方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.Chat方法的具体用法?Java TLRPC.Chat怎么用?Java TLRPC.Chat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.tgnet.TLRPC
的用法示例。
在下文中一共展示了TLRPC.Chat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getForwardedName
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public String getForwardedName() {
if (messageOwner.fwd_from != null) {
if (messageOwner.fwd_from.channel_id != 0) {
TLRPC.Chat chat = MessagesController.getInstance().getChat(messageOwner.fwd_from.channel_id);
if (chat != null) {
return chat.title;
}
} else if (messageOwner.fwd_from.from_id != 0) {
TLRPC.User user = MessagesController.getInstance().getUser(messageOwner.fwd_from.from_id);
if (user != null) {
return UserObject.getUserName(user);
}
}
}
return null;
}
示例2: reportSpam
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void reportSpam(final long dialogId, TLRPC.User currentUser, TLRPC.Chat currentChat) {
if (currentUser == null && currentChat == null) {
return;
}
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putInt("spam3_" + dialogId, 1);
editor.commit();
TLRPC.TL_messages_reportSpam req = new TLRPC.TL_messages_reportSpam();
if (currentChat != null) {
req.peer = MessagesController.getInputPeer(-currentChat.id);
} else if (currentUser != null) {
req.peer = MessagesController.getInputPeer(currentUser.id);
}
ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
@Override
public void run(TLObject response, TLRPC.TL_error error) {
}
}, ConnectionsManager.RequestFlagFailOnServerErrors);
}
示例3: updateFieldHint
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void updateFieldHint() {
boolean isChannel = false;
if ((int) dialog_id < 0) {
TLRPC.Chat chat = MessagesController.getInstance().getChat(-(int) dialog_id);
isChannel = ChatObject.isChannel(chat) && !chat.megagroup;
}
if (isChannel) {
if (editingMessageObject != null) {
messageEditText.setHint(editingCaption ? LocaleController.getString("Caption", R.string.Caption) : LocaleController.getString("TypeMessage", R.string.TypeMessage));
} else {
if (silent) {
messageEditText.setHint(LocaleController.getString("ChannelSilentBroadcast", R.string.ChannelSilentBroadcast));
} else {
messageEditText.setHint(LocaleController.getString("ChannelBroadcast", R.string.ChannelBroadcast));
}
}
} else {
messageEditText.setHint("");
}
}
示例4: broadcastPinnedMessage
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private static MessageObject broadcastPinnedMessage(final TLRPC.Message result, final ArrayList<TLRPC.User> users, final ArrayList<TLRPC.Chat> chats, final boolean isCache, boolean returnValue) {
final HashMap<Integer, TLRPC.User> usersDict = new HashMap<>();
for (int a = 0; a < users.size(); a++) {
TLRPC.User user = users.get(a);
usersDict.put(user.id, user);
}
final HashMap<Integer, TLRPC.Chat> chatsDict = new HashMap<>();
for (int a = 0; a < chats.size(); a++) {
TLRPC.Chat chat = chats.get(a);
chatsDict.put(chat.id, chat);
}
if (returnValue) {
return new MessageObject(result, usersDict, chatsDict, false);
} else {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
MessagesController.getInstance().putUsers(users, isCache);
MessagesController.getInstance().putChats(chats, isCache);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.didLoadedPinnedMessage, new MessageObject(result, usersDict, chatsDict, false));
}
});
}
return null;
}
示例5: updateFieldHint
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void updateFieldHint() {
boolean isChannel = false;
if ((int) dialog_id < 0) {
TLRPC.Chat chat = MessagesController.getInstance().getChat(-(int) dialog_id);
isChannel = ChatObject.isChannel(chat) && !chat.megagroup;
}
if (isChannel) {
if (editingMessageObject != null) {
messageEditText.setHint(editingCaption ? LocaleController.getString("Caption", R.string.Caption) : LocaleController.getString("TypeMessage", R.string.TypeMessage));
} else {
if (silent) {
messageEditText.setHint(LocaleController.getString("ChannelSilentBroadcast", R.string.ChannelSilentBroadcast));
} else {
messageEditText.setHint(LocaleController.getString("ChannelBroadcast", R.string.ChannelBroadcast));
}
}
} else {
messageEditText.setHint(LocaleController.getString("TypeMessage", R.string.TypeMessage));
}
}
示例6: checkAndUpdateAvatar
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void checkAndUpdateAvatar() {
if (currentUser != null) {
TLRPC.User user = MessagesController.getInstance().getUser(currentUser.id);
if (user == null) {
return;
}
currentUser = user;
} else if (currentChat != null) {
TLRPC.Chat chat = MessagesController.getInstance().getChat(currentChat.id);
if (chat == null) {
return;
}
currentChat = chat;
}
if (avatarContainer != null) {
avatarContainer.checkAndUpdateAvatar();
}
}
示例7: putUsersAndChatsInternal
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void putUsersAndChatsInternal(final ArrayList<TLRPC.User> users, final ArrayList<TLRPC.Chat> chats, final boolean withTransaction) {
try {
if (withTransaction) {
database.beginTransaction();
}
putUsersInternal(users);
putChatsInternal(chats);
if (withTransaction) {
database.commitTransaction();
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
}
示例8: putChats
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void putChats(ArrayList<TLRPC.Chat> chats, boolean fromCache) {
if (chats == null || chats.isEmpty()) {
return;
}
int count = chats.size();
for (int a = 0; a < count; a++) {
TLRPC.Chat chat = chats.get(a);
putChat(chat, fromCache);
}
}
示例9: setData
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void setData(TLObject object, TLRPC.EncryptedChat ec, CharSequence n, CharSequence s, boolean needCount) {
currentName = n;
if (object instanceof TLRPC.User) {
user = (TLRPC.User) object;
chat = null;
} else if (object instanceof TLRPC.Chat) {
chat = (TLRPC.Chat) object;
user = null;
}
encryptedChat = ec;
subLabel = s;
drawCount = needCount;
update(0);
}
示例10: onPlayFromSearch
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
@Override
public void onPlayFromSearch(String query, Bundle extras) {
if (query == null || query.length() == 0) {
return;
}
query = query.toLowerCase();
for (int a = 0; a < dialogs.size(); a++) {
int did = dialogs.get(a);
if (did > 0) {
TLRPC.User user = users.get(did);
if (user == null) {
continue;
}
if (user.first_name != null && user.first_name.startsWith(query) || user.last_name != null && user.last_name.startsWith(query)) {
onPlayFromMediaId(did + "_" + 0, null);
break;
}
} else {
TLRPC.Chat chat = chats.get(-did);
if (chat == null) {
continue;
}
if (chat.title != null && chat.title.toLowerCase().contains(query)) {
onPlayFromMediaId(did + "_" + 0, null);
break;
}
}
}
}
示例11: checkCanOpenChat
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static boolean checkCanOpenChat(Bundle bundle, BaseFragment fragment) {
if (bundle == null || fragment == null) {
return true;
}
TLRPC.User user = null;
TLRPC.Chat chat = null;
int user_id = bundle.getInt("user_id", 0);
int chat_id = bundle.getInt("chat_id", 0);
if (user_id != 0) {
user = MessagesController.getInstance().getUser(user_id);
} else if (chat_id != 0) {
chat = MessagesController.getInstance().getChat(chat_id);
}
if (user == null && chat == null) {
return true;
}
String reason = null;
if (chat != null) {
reason = getRestrictionReason(chat.restriction_reason);
} else if (user != null) {
reason = getRestrictionReason(user.restriction_reason);
}
if (reason != null) {
showCantOpenAlert(fragment, reason);
return false;
}
return true;
}
示例12: canDeleteMessage
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static boolean canDeleteMessage(TLRPC.Message message, TLRPC.Chat chat) {
if (message.id < 0) {
return true;
}
if (chat == null && message.to_id.channel_id != 0) {
chat = MessagesController.getInstance().getChat(message.to_id.channel_id);
}
if (ChatObject.isChannel(chat)) {
if (message.id == 1) {
return false;
}
if (chat.creator) {
return true;
} else if (chat.editor) {
if (isOut(message) || message.from_id > 0 && !message.post) {
return true;
}
} else if (chat.moderator) {
if (message.from_id > 0 && !message.post) {
return true;
}
} else if (isOut(message) && message.from_id > 0) {
return true;
}
}
return isOut(message) || !ChatObject.isChannel(chat);
}
示例13: isNotInChat
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static boolean isNotInChat(TLRPC.Chat chat) {
return chat == null || chat instanceof TLRPC.TL_chatEmpty || chat instanceof TLRPC.TL_chatForbidden || chat instanceof TLRPC.TL_channelForbidden || chat.left || chat.kicked || chat.deactivated;
}
示例14: isLeftFromChat
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static boolean isLeftFromChat(TLRPC.Chat chat) {
return chat == null || chat instanceof TLRPC.TL_chatEmpty || chat instanceof TLRPC.TL_chatForbidden || chat instanceof TLRPC.TL_channelForbidden || chat.left || chat.deactivated;
}
示例15: isKickedFromChat
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static boolean isKickedFromChat(TLRPC.Chat chat) {
return chat == null || chat instanceof TLRPC.TL_chatEmpty || chat instanceof TLRPC.TL_chatForbidden || chat instanceof TLRPC.TL_channelForbidden || chat.kicked || chat.deactivated;
}