github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/chat/msgchecker/constants.go (about)

     1  package msgchecker
     2  
     3  import "github.com/keybase/client/go/protocol/chat1"
     4  
     5  const (
     6  	TextMessageMaxLength        = 10000
     7  	DevTextMessageMaxLength     = 1000000
     8  	ReactionMessageMaxLength    = 10000
     9  	HeadlineMaxLength           = 280
    10  	TopicMaxLength              = 20
    11  	RequestPaymentTextMaxLength = 240
    12  )
    13  
    14  const (
    15  	BoxedTextMessageBodyMaxLength           = 11000
    16  	DevBoxedTextMessageBodyMaxLength        = 1100000
    17  	BoxedEditMessageBodyMaxLength           = 11000
    18  	BoxedReactionMessageBodyMaxLength       = 10000
    19  	BoxedHeadlineMessageBodyMaxLength       = 380
    20  	BoxedMetadataMessageBodyMaxLength       = 200
    21  	BoxedJoinMessageBodyMaxLength           = 200
    22  	BoxedLeaveMessageBodyMaxLength          = 200
    23  	BoxedSystemMessageBodyMaxLength         = 5000
    24  	BoxedDeleteHistoryMessageBodyMaxLength  = 200
    25  	BoxedSendPaymentMessageBodyMaxLength    = 200
    26  	BoxedRequestPaymentMessageBodyMaxLength = 500
    27  	BoxedSanityLength                       = 5000000
    28  )
    29  
    30  func getMaxTextLength(topicType chat1.TopicType) (textMsgLength int) {
    31  	switch topicType {
    32  	case chat1.TopicType_CHAT:
    33  		textMsgLength = TextMessageMaxLength
    34  	case chat1.TopicType_DEV, chat1.TopicType_KBFSFILEEDIT, chat1.TopicType_EMOJI,
    35  		chat1.TopicType_EMOJICROSS:
    36  		textMsgLength = DevTextMessageMaxLength
    37  	default:
    38  		textMsgLength = TextMessageMaxLength
    39  	}
    40  	return textMsgLength
    41  }
    42  
    43  func getBoxedMaxTextLength(topicType chat1.TopicType) (textMsgLength int) {
    44  	switch topicType {
    45  	case chat1.TopicType_CHAT:
    46  		textMsgLength = BoxedTextMessageBodyMaxLength
    47  	case chat1.TopicType_DEV, chat1.TopicType_KBFSFILEEDIT, chat1.TopicType_EMOJI,
    48  		chat1.TopicType_EMOJICROSS:
    49  		textMsgLength = DevBoxedTextMessageBodyMaxLength
    50  	default:
    51  		textMsgLength = BoxedTextMessageBodyMaxLength
    52  	}
    53  	return textMsgLength
    54  }