mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-05 09:36:00 +08:00
notification
This commit is contained in:
@@ -7,7 +7,7 @@ type OptionsOpt func(Options)
|
||||
|
||||
func NewOptions(opts ...OptionsOpt) Options {
|
||||
options := make(map[string]bool, 11)
|
||||
options[constant.IsNotification] = false
|
||||
options[constant.IsNotNotification] = false
|
||||
options[constant.IsSendMsg] = false
|
||||
options[constant.IsHistory] = false
|
||||
options[constant.IsPersistent] = false
|
||||
@@ -32,9 +32,9 @@ func WithOptions(options Options, opts ...OptionsOpt) Options {
|
||||
return options
|
||||
}
|
||||
|
||||
func WithNotification(b bool) OptionsOpt {
|
||||
func WithNotNotification(b bool) OptionsOpt {
|
||||
return func(options Options) {
|
||||
options[constant.IsNotification] = b
|
||||
options[constant.IsNotNotification] = b
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ func (o Options) Is(notification string) bool {
|
||||
}
|
||||
|
||||
func (o Options) IsNotNotification() bool {
|
||||
return o.Is(constant.IsNotification)
|
||||
return o.Is(constant.IsNotNotification)
|
||||
}
|
||||
|
||||
func (o Options) IsSendMsg() bool {
|
||||
|
||||
@@ -170,6 +170,11 @@ func GetHashCode(s string) uint32 {
|
||||
return crc32.ChecksumIEEE([]byte(s))
|
||||
}
|
||||
|
||||
func MsgIsNotification(msg *sdkws.MsgData) bool {
|
||||
options := Options(msg.Options)
|
||||
return !options.IsNotNotification()
|
||||
}
|
||||
|
||||
func GetConversationIDByMsg(msg *sdkws.MsgData) string {
|
||||
options := Options(msg.Options)
|
||||
switch msg.SessionType {
|
||||
|
||||
Reference in New Issue
Block a user