Skip to content
Snippets Groups Projects
Commit 5b1c29c8 authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

fixed uses of old contact object

parent 328d9ab3
No related branches found
No related tags found
No related merge requests found
package api package api
import jww "github.com/spf13/jwalterweatherman" import (
jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/interfaces/contact"
)
// CreateAuthenticatedChannel creates a 1-way authenticated channel // CreateAuthenticatedChannel creates a 1-way authenticated channel
// so this user can send messages to the desired recipient Contact. // so this user can send messages to the desired recipient Contact.
// To receive confirmation from the remote user, clients must // To receive confirmation from the remote user, clients must
// register a listener to do that. // register a listener to do that.
func (c *Client) CreateAuthenticatedChannel(recipient Contact, func (c *Client) CreateAuthenticatedChannel(recipient contact.Contact,
payload []byte) error { payload []byte) error {
jww.INFO.Printf("CreateAuthenticatedChannel(%v, %v)", jww.INFO.Printf("CreateAuthenticatedChannel(%v, %v)",
recipient, payload) recipient, payload)
...@@ -15,14 +18,14 @@ func (c *Client) CreateAuthenticatedChannel(recipient Contact, ...@@ -15,14 +18,14 @@ func (c *Client) CreateAuthenticatedChannel(recipient Contact,
// RegisterAuthConfirmationCb registers a callback for channel // RegisterAuthConfirmationCb registers a callback for channel
// authentication confirmation events. // authentication confirmation events.
func (c *Client) RegisterAuthConfirmationCb(cb func(contact Contact, func (c *Client) RegisterAuthConfirmationCb(cb func(contact contact.Contact,
payload []byte)) { payload []byte)) {
jww.INFO.Printf("RegisterAuthConfirmationCb(...)") jww.INFO.Printf("RegisterAuthConfirmationCb(...)")
} }
// RegisterAuthRequestCb registers a callback for channel // RegisterAuthRequestCb registers a callback for channel
// authentication request events. // authentication request events.
func (c *Client) RegisterAuthRequestCb(cb func(contact Contact, func (c *Client) RegisterAuthRequestCb(cb func(contact contact.Contact,
payload []byte)) { payload []byte)) {
jww.INFO.Printf("RegisterAuthRequestCb(...)") jww.INFO.Printf("RegisterAuthRequestCb(...)")
} }
package api package api
import jww "github.com/spf13/jwalterweatherman" import (
jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/interfaces/contact"
)
// Returns true if the cryptographic identity has been registered with // Returns true if the cryptographic identity has been registered with
// the CMIX user discovery agent. // the CMIX user discovery agent.
...@@ -48,7 +51,7 @@ func (c *Client) ConfirmRegistration(token, code []byte) error { ...@@ -48,7 +51,7 @@ func (c *Client) ConfirmRegistration(token, code []byte) error {
// Search accepts a "separator" separated list of search elements with // Search accepts a "separator" separated list of search elements with
// an associated list of searchTypes. It returns a ContactList which // an associated list of searchTypes. It returns a ContactList which
// allows you to iterate over the found contact objects. // allows you to iterate over the found contact objects.
func (c *Client) Search(data, separator string, searchTypes []byte) []Contact { func (c *Client) Search(data, separator string, searchTypes []byte) []contact.Contact {
jww.INFO.Printf("Search(%s, %s, %s)", data, separator, searchTypes) jww.INFO.Printf("Search(%s, %s, %s)", data, separator, searchTypes)
return nil return nil
} }
...@@ -56,14 +59,14 @@ func (c *Client) Search(data, separator string, searchTypes []byte) []Contact { ...@@ -56,14 +59,14 @@ func (c *Client) Search(data, separator string, searchTypes []byte) []Contact {
// SearchWithHandler is a non-blocking search that also registers // SearchWithHandler is a non-blocking search that also registers
// a callback interface for user disovery events. // a callback interface for user disovery events.
func (c *Client) SearchWithCallback(data, separator string, searchTypes []byte, func (c *Client) SearchWithCallback(data, separator string, searchTypes []byte,
cb func(results []Contact)) { cb func(results []contact.Contact)) {
resultCh := make(chan []Contact, 1) resultCh := make(chan []contact.Contact, 1)
go func(out chan []Contact, data, separator string, srchTypes []byte) { go func(out chan []contact.Contact, data, separator string, srchTypes []byte) {
out <- c.Search(data, separator, srchTypes) out <- c.Search(data, separator, srchTypes)
close(out) close(out)
}(resultCh, data, separator, searchTypes) }(resultCh, data, separator, searchTypes)
go func(in chan []Contact, cb func(results []Contact)) { go func(in chan []contact.Contact, cb func(results []contact.Contact)) {
select { select {
case contacts := <-in: case contacts := <-in:
cb(contacts) cb(contacts)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment