(notify, target, from types.Uid, act types.InviteAction, modeWant,
modeGiven types.AccessMode, info interface{})
| 928 | } |
| 929 | |
| 930 | func (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 |
| 962 | func (t *Topic) presPubTopicOnline() error { |
no test coverage detected