mirror of
https://dev.narayana.im/narayana/telegabber.git
synced 2026-08-05 12:17:06 +00:00
Send an invite to MUC on /add wherever applicable
This commit is contained in:
parent
d665dbdcc4
commit
2b5bb43bdd
3 changed files with 10 additions and 5 deletions
|
|
@ -1126,7 +1126,7 @@ func (c *Client) cmdAdd(args []string) (string, bool) {
|
||||||
return "No error, but chat is nil", false
|
return "No error, but chat is nil", false
|
||||||
}
|
}
|
||||||
|
|
||||||
c.subscribeToID(chat.Id, chat)
|
c.subscribeToID(chat.Id, chat, true)
|
||||||
|
|
||||||
return "", true
|
return "", true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ func (c *Client) updateNewChat(update *client.UpdateNewChat) {
|
||||||
c.cache.SetChat(update.Chat.Id, update.Chat)
|
c.cache.SetChat(update.Chat.Id, update.Chat)
|
||||||
|
|
||||||
if update.Chat.Positions != nil && len(update.Chat.Positions) > 0 {
|
if update.Chat.Positions != nil && len(update.Chat.Positions) > 0 {
|
||||||
c.subscribeToID(update.Chat.Id, update.Chat)
|
c.subscribeToID(update.Chat.Id, update.Chat, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
if update.Chat.Id < 0 {
|
if update.Chat.Id < 0 {
|
||||||
|
|
@ -192,14 +192,14 @@ func (c *Client) updateNewChat(update *client.UpdateNewChat) {
|
||||||
// chat position is updated
|
// chat position is updated
|
||||||
func (c *Client) updateChatPosition(update *client.UpdateChatPosition) {
|
func (c *Client) updateChatPosition(update *client.UpdateChatPosition) {
|
||||||
if update.Position != nil && update.Position.Order != 0 {
|
if update.Position != nil && update.Position.Order != 0 {
|
||||||
go c.subscribeToID(update.ChatId, nil)
|
go c.subscribeToID(update.ChatId, nil, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// chat last message is updated
|
// chat last message is updated
|
||||||
func (c *Client) updateChatLastMessage(update *client.UpdateChatLastMessage) {
|
func (c *Client) updateChatLastMessage(update *client.UpdateChatLastMessage) {
|
||||||
if update.Positions != nil && len(update.Positions) > 0 {
|
if update.Positions != nil && len(update.Positions) > 0 {
|
||||||
go c.subscribeToID(update.ChatId, nil)
|
go c.subscribeToID(update.ChatId, nil, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2401,7 +2401,7 @@ func (c *Client) IsGroup(chat *client.Chat) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// subscribe to a Telegram ID
|
// subscribe to a Telegram ID
|
||||||
func (c *Client) subscribeToID(id int64, chat *client.Chat) {
|
func (c *Client) subscribeToID(id int64, chat *client.Chat, firstTime bool) {
|
||||||
args := gateway.SimplePresence(id, "subscribe")
|
args := gateway.SimplePresence(id, "subscribe")
|
||||||
|
|
||||||
if chat == nil {
|
if chat == nil {
|
||||||
|
|
@ -2409,6 +2409,11 @@ func (c *Client) subscribeToID(id int64, chat *client.Chat) {
|
||||||
}
|
}
|
||||||
if chat != nil {
|
if chat != nil {
|
||||||
if c.Session.MUC && c.IsGroup(chat) {
|
if c.Session.MUC && c.IsGroup(chat) {
|
||||||
|
if firstTime {
|
||||||
|
for resource := range c.resourcesRange() {
|
||||||
|
gateway.InviteToMUC(id, c.jid+"/"+resource, c.xmpp)
|
||||||
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue