jabberd2
2.2.16
|
00001 /* 00002 * jabberd - Jabber Open Source Server 00003 * Copyright (c) 2002-2003 Jeremie Miller, Thomas Muldowney, 00004 * Ryan Eatmon, Robert Norris 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA 00019 */ 00020 00021 /* prototypes for xdata */ 00022 00023 #ifndef INCL_XDATA_H 00024 #define INCL_XDATA_H 00025 00026 #include "util.h" 00027 00028 typedef struct _xdata_st *xdata_t; 00029 typedef struct _xdata_field_st *xdata_field_t; 00030 typedef struct _xdata_option_st *xdata_option_t; 00031 typedef struct _xdata_item_st *xdata_item_t; 00032 00033 typedef enum { 00034 xd_type_NONE, 00035 xd_type_FORM, 00036 xd_type_RESULT, 00037 xd_type_SUBMIT, 00038 xd_type_CANCEL 00039 } xdata_type_t; 00040 00041 struct _xdata_st { 00042 pool_t p; 00043 00044 xdata_type_t type; 00045 00046 char *title; 00047 char *instructions; 00048 00049 xdata_field_t fields, flast; 00050 xdata_field_t rfields, rflast; /* reported fields */ 00051 00052 xdata_item_t items, ilast; 00053 }; 00054 00055 typedef enum { 00056 xd_field_NONE, 00057 xd_field_BOOLEAN, 00058 xd_field_FIXED, 00059 xd_field_HIDDEN, 00060 xd_field_JID_MULTI, 00061 xd_field_JID_SINGLE, 00062 xd_field_LIST_MULTI, 00063 xd_field_LIST_SINGLE, 00064 xd_field_TEXT_MULTI, 00065 xd_field_TEXT_PRIVATE, 00066 xd_field_TEXT_SINGLE 00067 } xdata_field_type_t; 00068 00069 struct _xdata_field_st { 00070 pool_t p; 00071 00072 xdata_field_type_t type; 00073 00074 char *var; 00075 00076 char *label; 00077 00078 char *desc; 00079 00080 int required; 00081 00082 char **values; 00083 int nvalues; 00084 00085 xdata_option_t options, olast; 00086 00087 xdata_field_t next; 00088 }; 00089 00090 struct _xdata_option_st { 00091 pool_t p; 00092 00093 char *label; 00094 char *value; 00095 00096 xdata_option_t next; 00097 }; 00098 00099 struct _xdata_item_st { 00100 pool_t p; 00101 00102 xdata_field_t fields, flast; 00103 00104 xdata_item_t next; 00105 }; 00106 00108 JABBERD2_API xdata_t xdata_new(xdata_type_t type, char *title, char *instructions); 00109 JABBERD2_API xdata_t xdata_parse(nad_t nad, int root); 00110 00112 JABBERD2_API xdata_field_t xdata_field_new(xdata_t xd, xdata_field_type_t type, char *var, char *label, char *desc, int required); 00113 00115 JABBERD2_API xdata_item_t xdata_item_new(xdata_t xd); 00116 00118 JABBERD2_API void xdata_add_field(xdata_t xd, xdata_field_t xdf); 00119 JABBERD2_API void xdata_add_rfield(xdata_t xd, xdata_field_t xdf); 00120 JABBERD2_API void xdata_add_field_item(xdata_item_t item, xdata_field_t xdf); 00121 00123 JABBERD2_API void xdata_add_item(xdata_t xd, xdata_item_t xdi); 00124 00126 JABBERD2_API void xdata_add_option(xdata_field_t xdf, char *value, int lvalue, char *label, int llabel); 00127 00129 JABBERD2_API void xdata_add_value(xdata_field_t xdf, char *value, int vlen); 00130 00131 #endif