cs

package
v0.0.0-...-4345fab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//proto start
	CS_PROTO_START                  = 0
	CS_PROTO_PING_REQ               = 1
	CS_PROTO_PING_RSP               = 2
	CS_PROTO_LOGIN_REQ              = 3
	CS_PROTO_LOGIN_RSP              = 4
	CS_PROTO_LOGOUT_REQ             = 5
	CS_PROTO_LOGOUT_RSP             = 6
	CS_PROTO_REG_REQ                = 7
	CS_PROTO_REG_RSP                = 8
	CS_PROTO_CREATE_GRP_REQ         = 9
	CS_PROTO_CREATE_GRP_RSP         = 10
	CS_PROTO_APPLY_GRP_REQ          = 11
	CS_PROTO_APPLY_GRP_RSP          = 12
	CS_PROTO_APPLY_GRP_NOTIFY       = 13
	CS_PROTO_APPLY_GRP_AUDIT        = 14
	CS_PROTO_SEND_CHAT_REQ          = 15
	CS_PROTO_SEND_CHAT_RSP          = 16
	CS_PROTO_SYNC_CHAT_LIST         = 17
	CS_PROTO_EXIT_GROUP_REQ         = 18
	CS_PROTO_EXIT_GROUP_RSP         = 19
	CS_PROTO_CHAT_HISTORY_REQ       = 20
	CS_PROTO_COMMON_NOTIFY          = 21
	CS_PROTO_KICK_GROUP_REQ         = 22
	CS_PROTO_QUERY_GROUP_REQ        = 23
	CS_PROTO_SYNC_GROUP_INFO        = 24
	CS_PROTO_FETCH_USER_PROFILE_REQ = 25
	CS_PROTO_FETCH_USER_PROFILE_RSP = 26
	CS_PROTO_CHG_GROUP_ATTR_REQ     = 27
	CS_PROTO_CHG_GROUP_ATTR_RSP     = 28
	CS_PROTO_GROUP_GROUND_REQ       = 29
	CS_PROTO_GROUP_GROUND_RSP       = 30
	CS_PROTO_COMMON_QUERY           = 31
	CS_PROTO_UPDATE_USER_REQ        = 32
	CS_PROTO_UPDATE_USER_RSP        = 33
	CS_PROTO_UPDATE_CHAT_REQ        = 34
	CS_PROTO_UPDATE_CHAT_RSP        = 35
	//PS:new proto added should modify 'Proto2Msg' function
	//proto end = last + 1
	CS_PROTO_END = 36
)

CS PROTO ID

View Source
const (
	COMMON_RESULT_SUCCESS = 0
	COMMON_RESULT_FAILED  = 1

	//COMMON_NOTIFY_TYPE
	COMMON_NOTIFY_T_FILE_ADDR      = 1
	COMMON_NOTIFY_T_ADD_MEM        = 2
	COMMON_NOTIFY_T_DEL_MEM        = 3
	COMMON_NOTIFY_T_HEAD_URL       = 4
	COMMON_NOTIFY_T_ENTER_GROUP    = 5 //self enter group
	COMMON_NOTIFY_T_SERVER_SETTING = 6 //server setting

	//COMMON_QUERY_TYPE
	COMMON_QUERY_OWN_GRP_SNAP  = 0
	COMMON_QUERY_SET_CLI_HEART = 1
)
View Source
const (
	CHAT_MSG_TYPE_TEXT = 0
	CHAT_MSG_TYPE_IMG  = 1

	//sync group field
	SYNC_GROUP_FIELD_ALL  = 1
	SYNC_GROUP_FIELD_SNAP = 2

	//group attr
	GROUP_ATTR_VISIBLE   = 0
	GROUP_ATTR_INVISIBLE = 1
	GROUP_ATTR_DESC      = 2
	GROUP_ATTR_GRP_NAME  = 3
	GROUP_ATTR_GRP_HEAD  = 4
)
View Source
const (
	SEX_MALE   = 1
	SEX_FEMALE = 2
)

Variables

This section is empty.

Functions

func DecodeMsg

func DecodeMsg(data []byte, pmsg *GeneralMsg) error

* Decode GeneralMsg * @return

func EncodeMsg

func EncodeMsg(pmsg *GeneralMsg) ([]byte, error)

* Encode GeneralMsg * @return encoded_bytes , error

func Proto2Msg

func Proto2Msg(proto_id int) (interface{}, error)

* Get ProtoMsg By Proto

Types

type CSApplyGroupAudit

type CSApplyGroupAudit struct {
	Audit    int    `json:"audit"` //0:deny 1:pass
	ApplyUid int64  `json:"apply_uid"`
	GrpId    int64  `json:"grp_id"`
	GrpName  string `json:"grp_name"`
	Flag     int    `json:"flag"` //0:normal 1:master activate invite
}

type CSApplyGroupNotify

type CSApplyGroupNotify struct {
	ApplyUid  int64  `json:"apply_uid"`
	ApplyName string `json:"apply_name"`
	ApplyMsg  string `json:"apply_msg"`
	GrpId     int64  `json:"grp_id"`
	GrpName   string `json:"grp_name"`
}

type CSApplyGroupReq

type CSApplyGroupReq struct {
	GrpId   int64  `json:"grp_id"`
	GrpName string `json:"grp_name"`
	Pass    string `json:"pass"`
	Msg     string `json:"msg"`
}

apply group

type CSApplyGroupRsp

type CSApplyGroupRsp struct {
	Result  int    `json:"result"`
	GrpId   int64  `json:"grp_id"`
	GrpName string `json:"grp_name"`
	Flag    int    `json:"flag"` //0:normal 1:master activate invite
}

type CSChatHistoryReq

type CSChatHistoryReq struct {
	GrpId int64 `json:"grp_id"`
	//fetch chat history before now_mst_id(not include now_msg_id) max 40. aka from [now_msg_id-count , now_msg_id) if 0 fetch from latest_msg_id
	NowMsgId int64 `json:"now_msg_id"`
	Count    int32 `json:"count"`
}

type CSChgGroupAttrReq

type CSChgGroupAttrReq struct {
	Attr  int    `json:"attr"` //refer GROUP_ATTR_XX
	GrpId int64  `json:"grp_id"`
	IntV  int64  `json:"int_v"`
	StrV  string `json:"str_v"`
}

type CSChgGroupAttrRsp

type CSChgGroupAttrRsp struct {
	Result int    `json:"result"` //COMMON_RESULT_XX
	Attr   int    `json:"attr"`   //refer GROUP_ATTR_XX
	GrpId  int64  `json:"grp_id"`
	IntV   int64  `json:"int_v"`
	StrV   string `json:"str_v"`
}

type CSCommonNotify

type CSCommonNotify struct {
	NotifyType int      `json:"type"` //refer COMMON_NOTIFY_T_XX
	GrpId      int64    `json:"grp_id"`
	IntV       int64    `json:"intv"`
	StrV       string   `json:"strv"`
	StrS       []string `json:"strs"`
}

server --> client common notify

type CSCommonQuery

type CSCommonQuery struct {
	QueryType int    `json:"type"`
	GrpId     int64  `json:"grp_id"`
	IntV      int64  `json:"int_v"`
	StrV      string `json:"str_v"`
}

client --> server common query

type CSCreateGroupReq

type CSCreateGroupReq struct {
	Name string `json:"name"`
	Pass string `json:"pass"`
	Desc string `json:"desc"`
}

create group

type CSCreateGroupRsp

type CSCreateGroupRsp struct {
	Result    int    `json:"result"`
	GrpId     int64  `json:"grp_id"`
	Name      string `json:"name"`
	MemberCnt int    `json:"member_count"`
	CreateTs  int64  `json:"create_ts"`
	Desc      string `json:"desc"`
}

type CSExitGroupReq

type CSExitGroupReq struct {
	GrpId int64 `json:"grp_id"`
}

type CSExitGroupRsp

type CSExitGroupRsp struct {
	Result   int    `json:"result"`
	GrpId    int64  `json:"grp_id"`
	GrpName  string `json:"grp_name"`
	DelGroup int8   `json:"del_group"`
	ByKick   int8   `json:"by_kick"`
}

type CSFetchUserProfileReq

type CSFetchUserProfileReq struct {
	TargetList []int64 `json:"target_list"`
}

type CSFetchUserProfileRsp

type CSFetchUserProfileRsp struct {
	Profiles map[int64]*UserProfile `json:"profiles"`
}

type CSGroupGroundReq

type CSGroupGroundReq struct {
	StartIndex int `json:"start"` //search start index
}

type CSGroupGroundRsp

type CSGroupGroundRsp struct {
	Count    int                `json:"count"`
	ItemList []*GroupGroundItem `json:"item_list"`
}

type CSKickGroupReq

type CSKickGroupReq struct {
	GrpId   int64 `json:"grp_id"`
	KickUid int64 `json:"kick_uid"`
}

type CSLoginReq

type CSLoginReq struct {
	Name    string `json:"name"`
	Pass    string `json:"pass"`
	Device  string `json:"device"`
	Version string `json:"version"`
	Flag    int64  `json:"flag"`
}

type CSLoginRsp

type CSLoginRsp struct {
	Result     int        `json:"result"`
	Name       string     `json:"name"`
	Basic      UserBasic  `json:"basic"`
	Detail     UserDetail `json:"user_detail"`
	Flag       int64      `json:"flag"`
	LastLogout int64      `json:"last_logout"`
}

type CSLogoutReq

type CSLogoutReq struct {
	Uid int64 `json:"uid"`
}

type CSLogoutRsp

type CSLogoutRsp struct {
	Result int    `json:"result"`
	Uid    int64  `json:"uid"`
	Msg    string `json:"msg"`
}

type CSPingReq

type CSPingReq struct {
	TimeStamp int64 `json:"ts"`
}

type CSPingRsp

type CSPingRsp struct {
	TimeStamp int64 `json:"ts"`
}

type CSQueryGroupReq

type CSQueryGroupReq struct {
	GrpId int64 `json:"grp_id"`
}

QUERY_FLAG

type CSRegReq

type CSRegReq struct {
	Name     string `json:"name"`
	Pass     string `json:"pass"`
	RoleName string `json:"role_name"`
	Sex      uint8  `json:"sex"`
	Addr     string `json:"addr"`
	Desc     string `json:"desc"`
}

type CSRegRsp

type CSRegRsp struct {
	Result int    `json:"result"`
	Name   string `json:"name"`
}

type CSSendChatReq

type CSSendChatReq struct {
	TempMsgId int64  `json:"temp_id"`
	ChatType  int    `json:"chat_type"` //CHAT_MSG_TYPE_XX
	GrpId     int64  `json:"grp_id"`
	Content   string `json:"content"`
}

Send Chat

type CSSendChatRsp

type CSSendChatRsp struct {
	TempMsgId int64    `json:"temp_id"`
	Result    int      `json:"result"`
	ChatMsg   *ChatMsg `json:"chat_msg"`
}

type CSSyncChatList

type CSSyncChatList struct {
	SyncType int8       `json:"sync_type"` //0:normal 1:history
	GrpId    int64      `json:"grp_id"`
	Count    int        `json:"count"`
	ChatList []*ChatMsg `json:"chat_list"`
}

type CSSyncGroupInfo

type CSSyncGroupInfo struct {
	Field   int32            `json:"field"` //refer SYNC_GROUP_FIELD_xx
	GrpId   int64            `json:"grp_id"`
	GrpInfo *ChatGroup       `json:"grp_info"`
	GrpSnap *GroupGroundItem `json:"grp_snap"`
}

type CSUpdateChatReq

type CSUpdateChatReq struct {
	UpdateType int   `json:"upt_type"`
	Grpid      int64 `json:"grp_id"`
	MsgId      int64 `json:"msg_id"`
}

type CSUpdateChatRsp

type CSUpdateChatRsp struct {
	Result     int   `json:"result"` //COMMON_RESULT_XX
	UpdateType int   `json:"upt_type"`
	GrpId      int64 `json:"grp_id"`
	MsgId      int64 `json:"msg_id"`
}

type CSUpdateUserReq

type CSUpdateUserReq struct {
	RoleName string `json:"role_name"` //if len>0 means update
	Addr     string `json:"addr"`      //if len>0 means update
	Desc     string `json:"desc"`      //if len>0 means update
	Passwd   string `json:"pass"`      //if len>0 will update
}

type CSUpdateUserRsp

type CSUpdateUserRsp struct {
	Result   int    `json:"result"`    //common result
	RoleName string `json:"role_name"` //if len>0 means update
	Addr     string `json:"addr"`      //if len>0 means update
	Desc     string `json:"desc"`      //if len>0 means update
	Passwd   string `json:"pass"`      //if len>0 will update
}

type ChatGroup

type ChatGroup struct {
	GrpId     int64           `json:"grp_id"`
	GrpName   string          `json:"grp_name"`
	MasterUid int64           `json:"master"`
	MsgCount  int64           `json:"msg_count"`
	CreateTs  int64           `json:"create"`
	MemCount  int32           `json:"mem_count"`
	Members   map[int64]int32 `json:"members"`
	Visible   int32           `json:"visible"`
	Desc      string          `json:"desc"`
	HeadUrl   string          `json:"head_url"`
}

type ChatMsg

type ChatMsg struct {
	ChatType   int    `json:"chat_type"` //CHAT_MSG_TYPE_XX
	MsgId      int64  `json:"msg_id"`
	GrpId      int64  `json:"grp_id"`
	SenderUid  int64  `json:"sender_uid"`
	SenderName string `json:"sender"`
	SendTs     int64  `json:"send_ts"`
	Content    string `json:"content"`
	Flag       int64  `json:"flag"`
}

type GeneralMsg

type GeneralMsg struct {
	ProtoId int         `json:"proto"`
	SubMsg  interface{} `json:"sub"`
}

* GeneralMsg

type GroupGroundItem

type GroupGroundItem struct {
	GrpId    int64  `json:"grp_id"`
	GrpName  string `json:"grp_name"`
	MemCount int32  `json:"mem_count"`
	Desc     string `json:"desc"`
	HeadUrl  string `json:"head_url"`
}

type ProtoHead

type ProtoHead struct {
	ProtoId int         `json:"proto"`
	Sub     interface{} `json:"-"`
}

type UserBasic

type UserBasic struct {
	Uid     int64  `json:"uid"`
	Name    string `json:"name"`
	Addr    string `json:"addr"`
	Sex     uint8  `json:"sex"` //refer SEX_XX
	Level   int32  `json:"level"`
	HeadUrl string `json:"head_url"`
}

type UserChatGroup

type UserChatGroup struct {
	GroupId   int64  `json:"grp_id"`
	GroupName string `json:"grp_name"`
	LastMsgId int64  `json:"last_msg"` //last readed
	EnterTs   int64  `json:"enter_ts"` //enter ts
}

type UserChatInfo

type UserChatInfo struct {
	AllGroup     int32                    `json:"all_group"`
	AllGroups    map[int64]*UserChatGroup `json:"all_groups"`
	MasterGroup  int32                    `json:"master_group"`
	MasterGroups map[int64]bool           `json:"master_groups"`
}

type UserDetail

type UserDetail struct {
	Exp int32 `json:"exp"`
	//Depot *UserDepot `json:"user_depot"`
	ChatInfo     *UserChatInfo `json:"chat_info"`
	Desc         string        `json:"desc"`
	ClientDesKey string        `json:"c_des_key"`
}

type UserProfile

type UserProfile struct {
	Uid     int64  `json:"uid"`
	Name    string `json:"name"`
	Addr    string `json:"addr"`
	Sex     uint8  `json:"sex"` //refer SEX_XX
	Level   int32  `json:"level"`
	HeadUrl string `json:"head_url"`
	Desc    string `json:"desc"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL