MCPcopy Create free account
hub / github.com/daodst/chat / makeInvite

Method makeInvite

server/topic.go:930–959  ·  view source on GitHub ↗
(notify, target, from types.Uid, act types.InviteAction, modeWant,
	modeGiven types.AccessMode, info interface{})

Source from the content-addressed store, hash-verified

928}
929
930func (t *Topic) makeInvite(notify, target, from types.Uid, act types.InviteAction, modeWant,
931 modeGiven types.AccessMode, info interface{}) *ServerComMessage {
932
933 // FIXME(gene): this is a workaround for gorethink's broken way of marshalling json
934 inv, err := json.Marshal(MsgInvitation{
935 Topic: t.name,
936 User: target.UserId(),
937 Action: act.String(),
938 Acs: MsgAccessMode{modeWant.String(), modeGiven.String()},
939 Info: info})
940 if err != nil {
941 log.Println(err)
942 }
943 converted := map[string]interface{}{}
944 err = json.Unmarshal(inv, &converted)
945 if err != nil {
946 log.Println(err)
947 }
948 // endof workaround
949
950 msg := &ServerComMessage{Data: &MsgServerData{
951 Topic: "me",
952 From: from.UserId(),
953 Timestamp: time.Now().UTC().Round(time.Millisecond),
954 Content: converted},
955 rcptto: notify.UserId(),
956 appid: t.appid}
957 log.Printf("Invite generated: %#+v", msg.Data)
958 return msg
959}
960
961// This is a newly created topic (!me or generic), announce topic presence
962func (t *Topic) presPubTopicOnline() error {

Callers 3

handleSubscriptionMethod · 0.95
requestSubMethod · 0.95
approveSubMethod · 0.95

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected