Convert expanded (routable) topic name into name suitable for sending to the user. For example p2pAbCDef123 -> usrAbCDef
(name string, uid types.Uid, isChan bool)
| 3988 | // Convert expanded (routable) topic name into name suitable for sending to the user. |
| 3989 | // For example p2pAbCDef123 -> usrAbCDef |
| 3990 | func topicNameForUser(name string, uid types.Uid, isChan bool) string { |
| 3991 | switch topicCat(name) { |
| 3992 | case types.TopicCatMe: |
| 3993 | return "me" |
| 3994 | case types.TopicCatFnd: |
| 3995 | return "fnd" |
| 3996 | case types.TopicCatP2P: |
| 3997 | topic, _ := types.P2PNameForUser(uid, name) |
| 3998 | return topic |
| 3999 | case types.TopicCatGrp: |
| 4000 | if isChan { |
| 4001 | return types.GrpToChn(name) |
| 4002 | } |
| 4003 | } |
| 4004 | return name |
| 4005 | } |
| 4006 | |
| 4007 | // calculateUnreadInRanges calculates how many unread messages are within the given ranges. |
| 4008 | // unreadStart is the first unread message SeqId (readID + 1), unreadEnd is the last possible message SeqId. |
no test coverage detected
searching dependent graphs…