Skip to content
Snippets Groups Projects
Commit 7e1f8831 authored by Tigran Avakyan's avatar Tigran Avakyan
Browse files

Created fake viper JSON variable that is used to get group JSON for registration.

parent 6f8189a3
Branches
Tags
No related merge requests found
...@@ -17,6 +17,7 @@ import ( ...@@ -17,6 +17,7 @@ import (
"gitlab.com/elixxir/client/bindings" "gitlab.com/elixxir/client/bindings"
"gitlab.com/elixxir/client/bots" "gitlab.com/elixxir/client/bots"
"gitlab.com/elixxir/client/cmixproto" "gitlab.com/elixxir/client/cmixproto"
"gitlab.com/elixxir/client/crypto"
"gitlab.com/elixxir/client/globals" "gitlab.com/elixxir/client/globals"
"gitlab.com/elixxir/client/parse" "gitlab.com/elixxir/client/parse"
"gitlab.com/elixxir/primitives/switchboard" "gitlab.com/elixxir/primitives/switchboard"
...@@ -123,10 +124,9 @@ func sessionInitialization() { ...@@ -123,10 +124,9 @@ func sessionInitialization() {
// 64 bits // 64 bits
grp := cyclic.Group{} grp := cyclic.Group{}
grpBuff := []byte(viper.GetString("group")) grpBuff := []byte(viper.GetString("group"))
err := grp.UnmarshalJSON(grpBuff)
err := grp.GobDecode(grpBuff)
if err != nil { if err != nil {
fmt.Printf("Could Not Decode group: %s\n", err.Error()) fmt.Printf("Could Not Decode group from JSON: %s\n", err.Error())
return return
} }
...@@ -275,7 +275,6 @@ var rootCmd = &cobra.Command{ ...@@ -275,7 +275,6 @@ var rootCmd = &cobra.Command{
// Only send a message if we have a message to send (except dummy messages) // Only send a message if we have a message to send (except dummy messages)
recipientId := new(id.User).SetUints(&[4]uint64{0, 0, 0, destinationUserId}) recipientId := new(id.User).SetUints(&[4]uint64{0, 0, 0, destinationUserId})
senderId := new(id.User).SetUints(&[4]uint64{0, 0, 0, userId}) senderId := new(id.User).SetUints(&[4]uint64{0, 0, 0, userId})
grp := user.TheSession.GetGroup()
if message != "" { if message != "" {
// Get the recipient's nick // Get the recipient's nick
recipientNick := "" recipientNick := ""
...@@ -286,6 +285,7 @@ var rootCmd = &cobra.Command{ ...@@ -286,6 +285,7 @@ var rootCmd = &cobra.Command{
// Handle sending to UDB // Handle sending to UDB
if *recipientId == *bots.UdbID { if *recipientId == *bots.UdbID {
grp := user.TheSession.GetGroup()
fmt.Println(parseUdbMessage(message, grp)) fmt.Println(parseUdbMessage(message, grp))
} else { } else {
// Handle sending to any other destination // Handle sending to any other destination
...@@ -421,7 +421,14 @@ func SetCertPath(path string) { ...@@ -421,7 +421,14 @@ func SetCertPath(path string) {
} }
// initConfig reads in config file and ENV variables if set. // initConfig reads in config file and ENV variables if set.
func initConfig() {} func initConfig() {
// Temporarily need to get group as JSON data into viper
json, err := crypto.InitCrypto().MarshalJSON()
if err != nil {
// panic
}
viper.Set("group", string(json))
}
// initLog initializes logging thresholds and the log path. // initLog initializes logging thresholds and the log path.
func initLog() { func initLog() {
......
...@@ -199,7 +199,7 @@ func (s *SessionObj) GetCurrentUser() (currentUser *User) { ...@@ -199,7 +199,7 @@ func (s *SessionObj) GetCurrentUser() (currentUser *User) {
Nick: s.CurrentUser.Nick, Nick: s.CurrentUser.Nick,
} }
} }
return return currentUser
} }
func (s *SessionObj) GetGWAddress() string { func (s *SessionObj) GetGWAddress() string {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment