|
|
|
@ -143,7 +143,8 @@ func (c *Client) updateNewChat(update *client.UpdateNewChat) {
|
|
|
|
|
c.cache.SetChat(update.Chat.Id, update.Chat)
|
|
|
|
|
|
|
|
|
|
var isChannel = false
|
|
|
|
|
if update.Chat.Type.ChatTypeType() == client.TypeChatTypeSupergroup {
|
|
|
|
|
chatType := update.Chat.Type.ChatTypeType()
|
|
|
|
|
if chatType == client.TypeChatTypeSupergroup {
|
|
|
|
|
typeSupergroup, ok := update.Chat.Type.(*client.ChatTypeSupergroup)
|
|
|
|
|
if !ok {
|
|
|
|
|
uhOh()
|
|
|
|
@ -151,7 +152,13 @@ func (c *Client) updateNewChat(update *client.UpdateNewChat) {
|
|
|
|
|
isChannel = typeSupergroup.IsChannel
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if !(isChannel && update.Chat.LastReadInboxMessageId == 0) {
|
|
|
|
|
// don't subscribe to channel posters
|
|
|
|
|
if !((isChannel && update.Chat.LastReadInboxMessageId == 0) ||
|
|
|
|
|
// don't subscribe to chats with no conversation
|
|
|
|
|
// (manual adding will trigger a subscribe anyway)
|
|
|
|
|
(update.Chat.LastReadInboxMessageId == 0 &&
|
|
|
|
|
update.Chat.LastReadOutboxMessageId == 0 &&
|
|
|
|
|
chatType == client.TypeChatTypePrivate)) {
|
|
|
|
|
gateway.SendPresence(
|
|
|
|
|
c.xmpp,
|
|
|
|
|
c.jid,
|
|
|
|
|