summaryrefslogtreecommitdiff
path: root/libpurple/purplerequestpage.h
blob: df51757c7a6738bfeebf870ab0701d3b929ef30f (plain)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/*
 * Purple - Internet Messaging Library
 * Copyright (C) Pidgin Developers <devel@pidgin.im>
 *
 * Purple is the legal property of its developers, whose names are too numerous
 * to list here.  Please refer to the COPYRIGHT file distributed with this
 * source distribution.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <https://www.gnu.org/licenses/>.
 */

#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
# error "only <purple.h> may be included directly"
#endif

#ifndef PURPLE_REQUEST_PAGE_H
#define PURPLE_REQUEST_PAGE_H

#include <glib.h>
#include <glib-object.h>

/**
 * PurpleRequestPage:
 *
 * Multiple fields request data.
 *
 * Since: 3.0.0
 */
typedef struct _PurpleRequestPage PurpleRequestPage;

#include "account.h"
#include "purplerequestgroup.h"
#include "purplerequestfield.h"

G_BEGIN_DECLS

#define PURPLE_TYPE_REQUEST_PAGE (purple_request_page_get_type())
G_DECLARE_FINAL_TYPE(PurpleRequestPage, purple_request_page,
                     PURPLE, REQUEST_PAGE, GObject)

/**
 * purple_request_page_new:
 *
 * Creates a page of fields to pass to [func@Purple.request_fields].
 *
 * Returns: (transfer full): The new request page.
 *
 * Since: 3.0.0
 */
PurpleRequestPage *purple_request_page_new(void);

/**
 * purple_request_page_add_group:
 * @page: The fields page.
 * @group: (transfer full): The group to add.
 *
 * Adds a group of fields to the list.
 *
 * Since: 3.0.0
 */
void purple_request_page_add_group(PurpleRequestPage *page, PurpleRequestGroup *group);

/**
 * purple_request_page_exists:
 * @page: The fields page.
 * @id: The ID of the field.
 *
 * Returns whether or not the field with the specified ID exists.
 *
 * Returns: TRUE if the field exists, or FALSE.
 *
 * Since: 3.0.0
 */
gboolean purple_request_page_exists(PurpleRequestPage *page, const char *id);

/**
 * purple_request_page_is_field_required:
 * @page: The fields page.
 * @id: The field ID.
 *
 * Returns whether or not a field with the specified ID is required.
 *
 * Returns: TRUE if the specified field is required, or FALSE.
 *
 * Since: 3.0.0
 */
gboolean purple_request_page_is_field_required(PurpleRequestPage *page, const char *id);

/**
 * purple_request_page_is_valid:
 * @page: The fields page.
 *
 * Returns whether or not all fields are valid.
 *
 * Returns: %TRUE if all fields in the page are valid, %FALSE otherwise.
 *
 * Since: 3.0.0
 */
gboolean purple_request_page_is_valid(PurpleRequestPage *page);

/**
 * purple_request_page_get_field:
 * @page: The fields page.
 * @id: The ID of the field.
 *
 * Return the field with the specified ID.
 *
 * Returns: (transfer none): The field, if found.
 *
 * Since: 3.0.0
 */
PurpleRequestField *purple_request_page_get_field(PurpleRequestPage *page, const char *id);

/**
 * purple_request_page_get_string:
 * @page: The fields page.
 * @id: The ID of the field.
 *
 * Returns the string value of a field with the specified ID.
 *
 * Returns: The string value, if found, or %NULL otherwise.
 *
 * Since: 3.0.0
 */
const char *purple_request_page_get_string(PurpleRequestPage *page, const char *id);

/**
 * purple_request_page_get_integer:
 * @page: The fields page.
 * @id: The ID of the field.
 *
 * Returns the integer value of a field with the specified ID.
 *
 * Returns: The integer value, if found, or 0 otherwise.
 *
 * Since: 3.0.0
 */
int purple_request_page_get_integer(PurpleRequestPage *page, const char *id);

/**
 * purple_request_page_get_bool:
 * @page: The fields page.
 * @id: The ID of the field.
 *
 * Returns the boolean value of a field with the specified ID.
 *
 * Returns: The boolean value, if found, or %FALSE otherwise.
 *
 * Since: 3.0.0
 */
gboolean purple_request_page_get_bool(PurpleRequestPage *page, const char *id);

/**
 * purple_request_page_get_choice:
 * @page: The fields page.
 * @id:     The ID of the field.
 *
 * Returns the choice index of a field with the specified ID.
 *
 * Returns: The choice value, if found, or NULL otherwise.
 *
 * Since: 3.0.0
 */
gpointer purple_request_page_get_choice(PurpleRequestPage *page, const char *id);

/**
 * purple_request_page_get_account:
 * @page: The fields page.
 * @id:     The ID of the field.
 *
 * Returns the account of a field with the specified ID.
 *
 * Returns: (transfer none): The account value, if found, or %NULL otherwise.
 *
 * Since: 3.0.0
 */
PurpleAccount *purple_request_page_get_account(PurpleRequestPage *page, const char *id);

G_END_DECLS

#endif /* PURPLE_REQUEST_PAGE_H */