@@ -65,18 +65,6 @@ func GetChatConversationIDByMsg(msg *sdkws.MsgData) string {
65
65
return ""
66
66
}
67
67
68
- func GenConversationUniqueKey (msg * sdkws.MsgData ) string {
69
- switch msg .SessionType {
70
- case constant .SingleChatType , constant .NotificationChatType :
71
- l := []string {msg .SendID , msg .RecvID }
72
- sort .Strings (l )
73
- return strings .Join (l , "_" )
74
- case constant .ReadGroupChatType :
75
- return msg .GroupID
76
- }
77
- return ""
78
- }
79
-
80
68
func GetConversationIDByMsg (msg * sdkws.MsgData ) string {
81
69
options := Options (msg .Options )
82
70
switch msg .SessionType {
@@ -98,10 +86,12 @@ func GetConversationIDByMsg(msg *sdkws.MsgData) string {
98
86
}
99
87
return "sg_" + msg .GroupID // super group chat
100
88
case constant .NotificationChatType :
89
+ l := []string {msg .SendID , msg .RecvID }
90
+ sort .Strings (l )
101
91
if ! options .IsNotNotification () {
102
- return "n_" + msg . SendID + "_" + msg . RecvID // super group chat
92
+ return "n_" + strings . Join ( l , "_" )
103
93
}
104
- return "sn_" + msg . SendID + "_" + msg . RecvID // server notification chat
94
+ return "sn_" + strings . Join ( l , "_" )
105
95
}
106
96
return ""
107
97
}
@@ -124,30 +114,6 @@ func GetConversationIDBySessionType(sessionType int, ids ...string) string {
124
114
return ""
125
115
}
126
116
127
- func GetNotificationConversationIDByConversationID (conversationID string ) string {
128
- l := strings .Split (conversationID , "_" )
129
- if len (l ) > 1 {
130
- l [0 ] = "n"
131
- return strings .Join (l , "_" )
132
- }
133
-
134
- return ""
135
- }
136
-
137
- func GetNotificationConversationID (sessionType int , ids ... string ) string {
138
- sort .Strings (ids )
139
- if len (ids ) > 2 || len (ids ) < 1 {
140
- return ""
141
- }
142
- switch sessionType {
143
- case constant .SingleChatType :
144
- return "n_" + strings .Join (ids , "_" ) // single chat
145
- case constant .ReadGroupChatType :
146
- return "n_" + ids [0 ] // super group chat
147
- }
148
- return ""
149
- }
150
-
151
117
func IsNotification (conversationID string ) bool {
152
118
return strings .HasPrefix (conversationID , "n_" )
153
119
}
@@ -156,30 +122,6 @@ func IsNotificationByMsg(msg *sdkws.MsgData) bool {
156
122
return ! Options (msg .Options ).IsNotNotification ()
157
123
}
158
124
159
- func ParseConversationID (msg * sdkws.MsgData ) (isNotification bool , conversationID string ) {
160
- options := Options (msg .Options )
161
- switch msg .SessionType {
162
- case constant .SingleChatType :
163
- l := []string {msg .SendID , msg .RecvID }
164
- sort .Strings (l )
165
- if ! options .IsNotNotification () {
166
- return true , "n_" + strings .Join (l , "_" )
167
- }
168
- return false , "si_" + strings .Join (l , "_" ) // single chat
169
- case constant .ReadGroupChatType :
170
- if ! options .IsNotNotification () {
171
- return true , "n_" + msg .GroupID // super group chat
172
- }
173
- return false , "sg_" + msg .GroupID // super group chat
174
- case constant .NotificationChatType :
175
- if ! options .IsNotNotification () {
176
- return true , "n_" + msg .SendID + "_" + msg .RecvID // super group chat
177
- }
178
- return false , "sn_" + msg .SendID + "_" + msg .RecvID // server notification chat
179
- }
180
- return false , ""
181
- }
182
-
183
125
type MsgBySeq []* sdkws.MsgData
184
126
185
127
func (s MsgBySeq ) Len () int {
0 commit comments