~samwhited/xmpp

ref: 7e76defde884af7cd63b3d6bb7065694db076b8f xmpp/ibr2/form.go -rw-r--r-- 852 bytes
7e76defdSam Whited all: pass Session directly to handler 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright 2017 The Mellium Contributors.
// Use of this source code is governed by the BSD 2-clause
// license that can be found in the LICENSE file.

package ibr2

import (
	"mellium.im/xmpp/form"
)

// Form is a challenge that presents or receives a data form as specified in
// XEP-0004.
// If Form is used by a client, f is called and passed the form sent by the
// server.
// The returned form should be a response to the sent form.
// If Form is used by a server, f is called once with a nil form and should
// return a form to be sent to the client; it is then called again with the
// clients response at which point a nil form can be returned to terminate the
// exchange, or a second form to be sent to the client can be returned.
func Form(f func(data *form.Data) (*form.Data, error)) Challenge {
	return Challenge{
		Type: form.NS,
	}
}