~samwhited/xmpp

ref: 60ea96a263f3efcf4108d85b0aec66f777f3efd4 xmpp/types.go -rw-r--r-- 3.6 KiB
60ea96a2Sam Whited Minor whitespace and comment fixes 5 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// Copyright 2015 Sam Whited.
// Use of this source code is governed by the BSD 2-clause license that can be
// found in the LICENSE file.

package xmpp

type messageType int

const (
	// A NormalMessage is a standalone message that is sent outside the context of
	// a one-to-one conversation or groupchat, and to which it is expected that
	// the recipient will reply. Typically a receiving client will present a
	// message of type "normal" in an interface that enables the recipient to
	// reply, but without a conversation history.
	NormalMessage messageType = iota

	// ChatMessage represents a message sent in the context of a one-to-one chat
	// session.  Typically an interactive client will present a message of type
	// "chat" in an interface that enables one-to-one chat between the two
	// parties, including an appropriate conversation history.
	ChatMessage

	// An ErrorMessage is generated by an entity that experiences an error when
	// processing a message received from another entity.
	ErrorMessage

	// A GroupChatMessage is sent in the context of a multi-user chat environment.
	// Typically a receiving client will present a message of type "groupchat" in
	// an interface that enables many-to-many chat between the parties, including
	// a roster of parties in the chatroom and an appropriate conversation
	// history.
	GroupChatMessage

	// A HeadlineMessage provides an alert, a notification, or other transient
	// information to which no reply is expected (e.g., news headlines, sports
	// updates, near-real-time market data, or syndicated content). Because no
	// reply to the message is expected, typically a receiving client will present
	// a message of type "headline" in an interface that appropriately
	// differentiates the message from standalone messages, chat messages, and
	// groupchat messages (e.g., by not providing the recipient with the ability
	// to reply).
	HeadlineMessage
)

type presenceType int

const (
	// NoTypePresence is a special type that indicates that a stanza is a presence
	// stanza without a defined type (indicating availability on the network).
	NoTypePresence presenceType = iota

	// An ErrorPresence indicates that an error has occurred regarding processing
	// of a previously sent presence stanza; if the presence stanza is of type
	// "error", it MUST include an <error/> child element
	ErrorPresence presenceType = iota

	// A ProbePresence is a request for an entity's current presence. It should
	// generally only be generated and sent by servers on behalf of a user.
	ProbePresence

	// A SubscribePresence is sent when the sender wishes to subscribe to the
	// recipient's presence.
	SubscribePresence

	// A SubscribedPresence indicates that the sender has allowed the recipient to
	// receive future presence broadcasts.
	SubscribedPresence

	// An UnavailablePresence indicates that the sender is no longer available for
	// communication.
	UnavailablePresence

	// An UnsubscribePresence indicates that the sender is unsubscribing from the
	// receiver's presence.
	UnsubscribePresence

	// An UnsubscribedPresence indicates that the subscription request has been
	// denied, or a previously granted subscription has been revoked.
	UnsubscribedPresence
)

type iqType int

const (
	// A GetIQ is used to query another entity for information.
	GetIQ iqType = iota

	// A SetIQ is used to provide data to another entity, set new values, replace
	// existing values, and other such operations.
	SetIQ

	// A ResultIQ is sent in response to a successful GetIQ or SetIQ stanza.
	ResultIQ

	// An ErrorIQ is sent to report that an error occured during the delivery or
	// processing of a GetIQ or SetIQ.
	ErrorIQ
)