user: add API for displaying queries to the user
[siplcs.git] / src / core / sipe-user.h
blob2009504f98e48d0482303ebc60408e14aae54ab2
1 /**
2 * @file sipe-user.h
4 * pidgin-sipe
6 * Copyright (C) 2011 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 /* Forward declarations */
24 struct sip_session;
25 struct sipe_core_private;
27 /* Opaque ask context structure */
28 struct sipe_user_ask_ctx;
30 /**
31 * Present error message in users session
33 * @param sipe_private SIPE core private data
34 * @param session session for the conversation
35 * @param message message text
37 void sipe_user_present_error(struct sipe_core_private *sipe_private,
38 struct sip_session *session,
39 const gchar *message);
41 /**
42 * Present info message in users session
44 * @param sipe_private SIPE core private data
45 * @param session session for the conversation
46 * @param message message text
48 void sipe_user_present_info(struct sipe_core_private *sipe_private,
49 struct sip_session *session,
50 const gchar *message);
52 /**
53 * Present error that his message wasn't delivered in users session
55 * @param sipe_private SIPE core private data
56 * @param session session for the conversation
57 * @param sip_error SIP error code or -1
58 * @param sip_warning SIP warning code or -1
59 * @param who URI of recipient
60 * @param message message text
62 void sipe_user_present_message_undelivered(struct sipe_core_private *sipe_private,
63 struct sip_session *session,
64 int sip_error,
65 int sip_warning,
66 const gchar *who,
67 const gchar *message);
69 typedef void (* SipeUserAskCb)(struct sipe_core_private *, gpointer data);
71 /**
72 * Present a query that is to be accepted or declined by the user
74 * @param sipe_private SIPE core private data
75 * @param message Text of the query to be shown to user
76 * @param accept_label Label to be displayed on UI control that accepts query
77 * @param accept_cb callback function to be invoked when query is accepted
78 * @param decline_label Label to be displayed on UI control that declines query
79 * @param decline_cb callback function to be invoked when query is declined
80 * @param data custom user data
82 * @return opaque sipe_user_ask_ctx pointer that can be used to close the query
83 * before user answered it.
85 struct sipe_user_ask_ctx * sipe_user_ask(struct sipe_core_private *sipe_private,
86 const gchar *message,
87 const gchar *accept_label,
88 SipeUserAskCb accept_cb,
89 const gchar *decline_label,
90 SipeUserAskCb decline_cb,
91 gpointer data);
93 /**
94 * Closes the pending user query
96 * @param context sipe_user_ask_ctx pointer returned by sipe_user_ask()
98 void sipe_user_close_ask(struct sipe_user_ask_ctx *context);