GrpToChn converts group topic name to corresponding channel name. If it's a non-group channel topic, the name is returned unchanged. If it's neither, an empty string is returned.
(grp string)
| 210 | // If it's a non-group channel topic, the name is returned unchanged. |
| 211 | // If it's neither, an empty string is returned. |
| 212 | func GrpToChn(grp string) string { |
| 213 | if strings.HasPrefix(grp, "grp") { |
| 214 | return strings.Replace(grp, "grp", "chn", 1) |
| 215 | } |
| 216 | // Return unchanged if it's a channel already. |
| 217 | if strings.HasPrefix(grp, "chn") { |
| 218 | return grp |
| 219 | } |
| 220 | return "" |
| 221 | } |
| 222 | |
| 223 | // IsChannel checks if the given topic name is a reference to a channel. |
| 224 | // The "nch" should not be considered a channel reference because it can only be used by the topic owner at the time of |
no outgoing calls
no test coverage detected
searching dependent graphs…