mirror of
https://dev.narayana.im/narayana/telegabber.git
synced 2026-08-05 12:17:06 +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)
|
COMMIT := $(shell git rev-parse --short HEAD)
|
||||||
TD_COMMIT := "5bbfc1cf5dab94f82e02f3430ded7241d4653551"
|
TD_COMMIT := "5bbfc1cf5dab94f82e02f3430ded7241d4653551"
|
||||||
VERSION := "v1.10.0"
|
VERSION := "v1.10.1"
|
||||||
MAKEOPTS := "-j4"
|
MAKEOPTS := "-j4"
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,8 @@ type Session struct {
|
||||||
NativeEdits bool `yaml:":nativeedits"`
|
NativeEdits bool `yaml:":nativeedits"`
|
||||||
IgnoredChats []int64 `yaml:":ignoredchats"`
|
IgnoredChats []int64 `yaml:":ignoredchats"`
|
||||||
ignoredChatsMap map[int64]bool `yaml:"-"`
|
ignoredChatsMap map[int64]bool `yaml:"-"`
|
||||||
|
|
||||||
|
IgnoreGroupDeletions bool `yaml:":ignoregroupdeletions"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var configKeys = []string{
|
var configKeys = []string{
|
||||||
|
|
@ -59,6 +61,7 @@ var configKeys = []string{
|
||||||
"hideids",
|
"hideids",
|
||||||
"receipts",
|
"receipts",
|
||||||
"nativeedits",
|
"nativeedits",
|
||||||
|
"ignoregroupdeletions",
|
||||||
}
|
}
|
||||||
|
|
||||||
var sessionDB *SessionsYamlDB
|
var sessionDB *SessionsYamlDB
|
||||||
|
|
@ -165,6 +168,8 @@ func (s *Session) get(key string) (string, error) {
|
||||||
return fromBool(s.Receipts), nil
|
return fromBool(s.Receipts), nil
|
||||||
case "nativeedits":
|
case "nativeedits":
|
||||||
return fromBool(s.NativeEdits), nil
|
return fromBool(s.NativeEdits), nil
|
||||||
|
case "ignoregroupdeletions":
|
||||||
|
return fromBool(s.IgnoreGroupDeletions), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return "", errors.New("Unknown session property")
|
return "", errors.New("Unknown session property")
|
||||||
|
|
@ -249,6 +254,13 @@ func (s *Session) Set(key string, value string) (string, error) {
|
||||||
}
|
}
|
||||||
s.NativeEdits = b
|
s.NativeEdits = b
|
||||||
return value, nil
|
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")
|
return "", errors.New("Unknown session property")
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import (
|
||||||
goxmpp "gosrc.io/xmpp"
|
goxmpp "gosrc.io/xmpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
var version string = "1.10.0"
|
var version string = "1.10.1"
|
||||||
var commit string
|
var commit string
|
||||||
|
|
||||||
var sm *goxmpp.StreamManager
|
var sm *goxmpp.StreamManager
|
||||||
|
|
|
||||||
|
|
@ -363,6 +363,12 @@ func (c *Client) updateDeleteMessages(update *client.UpdateDeleteMessages) {
|
||||||
if c.Session.IsChatIgnored(update.ChatId) {
|
if c.Session.IsChatIgnored(update.ChatId) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if c.Session.IgnoreGroupDeletions {
|
||||||
|
chatType, chatTypeErr := c.GetChatType(update.ChatId)
|
||||||
|
if chatTypeErr == nil && (chatType == ChatTypeBasicGroup || chatType == ChatTypeSupergroup) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var deleteChar string
|
var deleteChar string
|
||||||
if c.Session.AsciiArrows {
|
if c.Session.AsciiArrows {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue