mirror of
https://dev.narayana.im/narayana/telegabber.git
synced 2026-08-04 19:57:07 +00:00
Add ignoregroupdeletions configuration option
This commit is contained in:
parent
c5e41c7ce8
commit
7ebcdb0826
4 changed files with 20 additions and 2 deletions
2
Makefile
2
Makefile
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
COMMIT := $(shell git rev-parse --short HEAD)
|
||||
TD_COMMIT := "5bbfc1cf5dab94f82e02f3430ded7241d4653551"
|
||||
VERSION := "v1.10.0"
|
||||
VERSION := "v1.10.1"
|
||||
MAKEOPTS := "-j4"
|
||||
|
||||
all:
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ type Session struct {
|
|||
NativeEdits bool `yaml:":nativeedits"`
|
||||
IgnoredChats []int64 `yaml:":ignoredchats"`
|
||||
ignoredChatsMap map[int64]bool `yaml:"-"`
|
||||
|
||||
IgnoreGroupDeletions bool `yaml:":ignoregroupdeletions"`
|
||||
}
|
||||
|
||||
var configKeys = []string{
|
||||
|
|
@ -59,6 +61,7 @@ var configKeys = []string{
|
|||
"hideids",
|
||||
"receipts",
|
||||
"nativeedits",
|
||||
"ignoregroupdeletions",
|
||||
}
|
||||
|
||||
var sessionDB *SessionsYamlDB
|
||||
|
|
@ -165,6 +168,8 @@ func (s *Session) get(key string) (string, error) {
|
|||
return fromBool(s.Receipts), nil
|
||||
case "nativeedits":
|
||||
return fromBool(s.NativeEdits), nil
|
||||
case "ignoregroupdeletions":
|
||||
return fromBool(s.IgnoreGroupDeletions), nil
|
||||
}
|
||||
|
||||
return "", errors.New("Unknown session property")
|
||||
|
|
@ -249,6 +254,13 @@ func (s *Session) Set(key string, value string) (string, error) {
|
|||
}
|
||||
s.NativeEdits = b
|
||||
return value, nil
|
||||
case "ignoregroupdeletions":
|
||||
b, err := toBool(value)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
s.IgnoreGroupDeletions = b
|
||||
return value, nil
|
||||
}
|
||||
|
||||
return "", errors.New("Unknown session property")
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import (
|
|||
goxmpp "gosrc.io/xmpp"
|
||||
)
|
||||
|
||||
var version string = "1.10.0"
|
||||
var version string = "1.10.1"
|
||||
var commit string
|
||||
|
||||
var sm *goxmpp.StreamManager
|
||||
|
|
|
|||
|
|
@ -363,6 +363,12 @@ func (c *Client) updateDeleteMessages(update *client.UpdateDeleteMessages) {
|
|||
if c.Session.IsChatIgnored(update.ChatId) {
|
||||
return
|
||||
}
|
||||
if c.Session.IgnoreGroupDeletions {
|
||||
chatType, chatTypeErr := c.GetChatType(update.ChatId)
|
||||
if chatTypeErr == nil && (chatType == ChatTypeBasicGroup || chatType == ChatTypeSupergroup) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
var deleteChar string
|
||||
if c.Session.AsciiArrows {
|
||||
|
|
|
|||
Loading…
Reference in a new issue