2 # Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia
4 # This file is part of python-purple.
6 # python-purple is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # python-purple is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26 ctypedef char const_char "const char"
28 ctypedef void* va_list
30 cdef extern from "libpurple/request.h":
31 ctypedef enum PurpleRequestType:
32 PURPLE_REQUEST_INPUT = 0
39 ctypedef enum PurpleRequestFieldType:
40 PURPLE_REQUEST_FIELD_NONE
41 PURPLE_REQUEST_FIELD_STRING
42 PURPLE_REQUEST_FIELD_INTEGER
43 PURPLE_REQUEST_FIELD_BOOLEAN
44 PURPLE_REQUEST_FIELD_CHOICE
45 PURPLE_REQUEST_FIELD_LIST
46 PURPLE_REQUEST_FIELD_LABEL
47 PURPLE_REQUEST_FIELD_IMAGE
48 PURPLE_REQUEST_FIELD_ACCOUNT
50 ctypedef struct PurpleRequestFields:
52 glib.GHashTable *fields
53 glib.GList required_fields
56 ctypedef struct PurpleRequestFieldGroup:
57 PurpleRequestFields *fields_list
61 ctypedef struct PurpleRequestField:
64 ctypedef void (*PurpleRequestActionCb)(void *, int)
65 ctypedef void (*PurpleRequestChoiceCb)(void *, int)
66 ctypedef void (*PurpleRequestFieldsCb)(void *, PurpleRequestFields *fields)
67 ctypedef void (*PurpleRequestFileCb)(void *, char *filename)
69 ctypedef struct PurpleRequestUiOps:
70 void *(*request_input) (const_char *title, const_char *primary,
71 const_char *secondary,
72 const_char *default_value,
73 glib.gboolean multiline, glib.gboolean masked,
74 glib.gchar *hint, const_char *ok_text,
75 glib.GCallback ok_cb, const_char *cancel_text,
76 glib.GCallback cancel_cb,
77 account.PurpleAccount *account,
79 conversation.PurpleConversation *conv,
81 void *(*request_choice) (const_char *title, const_char *primary,
82 const_char *secondary, int default_value,
83 const_char *ok_text, glib.GCallback ok_cb,
84 const_char *cancel_text,
85 glib.GCallback cancel_cb,
86 account.PurpleAccount *account,
88 conversation.PurpleConversation *conv,
89 void *user_data, va_list choices)
90 void *(*request_action) (const_char *title, const_char *primary,
91 const_char *secondary, int default_action,
92 account.PurpleAccount *account,
94 conversation.PurpleConversation *conv,
95 void *user_data, size_t action_count,
97 void *(*request_fields) (const_char *title, const_char *primary,
98 const_char *secondary,
99 PurpleRequestFields *fields,
100 const_char *ok_text, glib.GCallback ok_cb,
101 const_char *cancel_text,
102 glib.GCallback cancel_cb,
103 account.PurpleAccount *account,
105 conversation.PurpleConversation *conv,
107 void *(*request_file) (const_char *title, const_char *filename,
108 glib.gboolean savedialog, glib.GCallback ok_cb,
109 glib.GCallback cancel_cb,
110 account.PurpleAccount *account,
112 conversation.PurpleConversation *conv,
114 void (*close_request) (PurpleRequestType type, void *ui_handle)
115 void *(*request_folder) (const_char *title, const_char *dirname,
116 glib.GCallback ok_cb,
117 glib.GCallback cancel_cb,
118 account.PurpleAccount *account,
120 conversation.PurpleConversation *conv,
123 void purple_request_close(PurpleRequestType type, void *uihandle)
124 void purple_request_set_ui_ops(PurpleRequestUiOps *ops)