actions.h 6.9 KB
Newer Older
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
1
/*
2
 *  Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
3
 *  Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
4
 *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
Julien Bonjean's avatar
Julien Bonjean committed
5
 *
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
6
7
 *  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
8
 *  the Free Software Foundation; either version 3 of the License, or
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
9
 *  (at your option) any later version.
Julien Bonjean's avatar
Julien Bonjean committed
10
 *
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
11
12
13
14
 *  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.
Julien Bonjean's avatar
Julien Bonjean committed
15
 *
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
16
17
18
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20
21
22
23
24
25
26
27
28
29
 *
 *  Additional permission under GNU GPL version 3 section 7:
 *
 *  If you modify this program, or any covered work, by linking or
 *  combining it with the OpenSSL project's OpenSSL library (or a
 *  modified version of that library), containing parts covered by the
 *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
 *  grants you additional permission to convey the resulting work.
 *  Corresponding Source for a non-source form of such a combination
 *  shall include the source code for the parts of OpenSSL used as well
 *  as that of the covered work.
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
30
 */
Julien Bonjean's avatar
Julien Bonjean committed
31

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
32
33
34
#ifndef __ACTIONS_H__
#define __ACTIONS_H__

35
36
#include <libintl.h>
#include <locale.h>
37

38
39
40
41
#include "accountlist.h"
#include "codeclist.h"
#include "sflphone_const.h"
#include "conference_obj.h"
42
#include "callable_obj.h"
43

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
44
45
46
47
48
49
50
/** @file actions.h
  * @brief General functions that change the state of the application.
  * All of these functions are called when dbus signals are triggered.  Exceptions
  * are sflphone_init() sflphone_quit(), sflphone_keypad() and sflphone_place_call().
  */


Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
51
/**
Julien Bonjean's avatar
Julien Bonjean committed
52
 * Initialize lists and configurations
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
53
54
 * @return TRUE if succeeded, FALSE otherwise
 */
55
gboolean sflphone_init(GError **error);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
56
57
58
59

/**
 * Steps when closing the application.  Will ask for confirmation if a call is in progress.
 */
Tristan Matthews's avatar
Tristan Matthews committed
60
void sflphone_quit();
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
61

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
62
/**
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
63
 * Hang up / refuse the current call
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
64
 */
Tristan Matthews's avatar
Tristan Matthews committed
65
void sflphone_hang_up();
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
66

67
/**
Julien Bonjean's avatar
Julien Bonjean committed
68
 * Put the selected call on hold
69
 */
Tristan Matthews's avatar
Tristan Matthews committed
70
void sflphone_on_hold();
71
72
73
74

/**
 * Put the selected call off hold
 */
Tristan Matthews's avatar
Tristan Matthews committed
75
void sflphone_off_hold();
76
77
78

/**
 * Open a new call
79
 * @return callable_obj_t* A pointer on the call structure
80
 */
81
callable_obj_t * sflphone_new_call();
82
83
84
85
86
87

/**
 * Notify voice mails to the application
 * @param accountID The account the voice mails are for
 * @param count The number of voice mails
 */
Tristan Matthews's avatar
Tristan Matthews committed
88
void sflphone_notify_voice_mail(const gchar* accountID, guint count);
89
90
91
92
93

/**
 * Prepare SFLphone to transfer a call and wait for the user to dial the number to transfer to
 * Put the selected call in Transfer state
 */
94
void sflphone_set_transfer();
95
96
97
98

/**
 * Cancel the transfer and puts back the selected call to Current state
 */
99
void sflphone_unset_transfer();
100

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
101
102
103
/**
 * Accept / dial the current call
 */
Tristan Matthews's avatar
Tristan Matthews committed
104
void sflphone_pick_up();
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
105

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
106
/**
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
107
 * Put the call on hold state
Emmanuel Milou's avatar
Emmanuel Milou committed
108
 * @param c The current call
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
109
 */
Tristan Matthews's avatar
Tristan Matthews committed
110
void sflphone_hold(callable_obj_t * c);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
111

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
112
113
/**
 * Put the call in Ringing state
Emmanuel Milou's avatar
Emmanuel Milou committed
114
 * @param c* The current call
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
115
 */
Tristan Matthews's avatar
Tristan Matthews committed
116
void sflphone_ringing(callable_obj_t * c);
117

118
119
/**
 * Put the call in Busy state
Emmanuel Milou's avatar
Emmanuel Milou committed
120
 * @param c* The current call
121
 */
Tristan Matthews's avatar
Tristan Matthews committed
122
void sflphone_busy(callable_obj_t * c);
123
124
125

/**
 * Put the call in Failure state
Emmanuel Milou's avatar
Emmanuel Milou committed
126
 * @param c* The current call
127
 */
Tristan Matthews's avatar
Tristan Matthews committed
128
void sflphone_fail(callable_obj_t * c);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
129

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
130
131
/**
 * Put the call in Current state
Emmanuel Milou's avatar
Emmanuel Milou committed
132
 * @param c The current call
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
133
 */
Tristan Matthews's avatar
Tristan Matthews committed
134
void sflphone_current(callable_obj_t * c);
135

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
136
/**
Julien Bonjean's avatar
Julien Bonjean committed
137
 * The callee has hung up
Emmanuel Milou's avatar
Emmanuel Milou committed
138
 * @param c The current call
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
139
 */
Tristan Matthews's avatar
Tristan Matthews committed
140
void sflphone_hung_up(callable_obj_t * c);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
141

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
142
143
/**
 * Incoming call
Emmanuel Milou's avatar
Emmanuel Milou committed
144
 * @param c The incoming call
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
145
 */
Tristan Matthews's avatar
Tristan Matthews committed
146
void sflphone_incoming_call(callable_obj_t * c);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
147
148
149
150

/**
 * Dial the number
 * If the call is in DIALING state, the char will be append to the number
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
151
 * @param keyval The unique int representing the key
Emmanuel Milou's avatar
Emmanuel Milou committed
152
 * @param key The char value of the key
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
153
 */
Tristan Matthews's avatar
Tristan Matthews committed
154
void sflphone_keypad(guint keyval, gchar * key);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
155
156

/**
157
 * Place a call with a filled callable_obj_t.to
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
158
159
 * @param c A call in CALL_STATE_DIALING state
 */
160
int sflphone_place_call(callable_obj_t * c);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
161

162
163
/**
 * Fetch the ip2ip profile through dbus and fill
Julien Bonjean's avatar
Julien Bonjean committed
164
 * the internal hash table.
165
 */
Tristan Matthews's avatar
Tristan Matthews committed
166
void sflphone_fill_ip2ip_profile(void);
167
168
169

/**
 * @return The internal hash table representing
Julien Bonjean's avatar
Julien Bonjean committed
170
 * the settings for the ip2ip profile.
171
 */
172
GHashTable *sflphone_get_ip2ip_properties(void);
Julien Bonjean's avatar
Julien Bonjean committed
173

174
/**
Tristan Matthews's avatar
Tristan Matthews committed
175
176
 * Get a list of accounts from the daemon and load them into account_t
 * structures.
177
 */
Tristan Matthews's avatar
Tristan Matthews committed
178
void sflphone_fill_account_list();
179

Tristan Matthews's avatar
Tristan Matthews committed
180
void sflphone_fill_call_list(void);
181

182
183
/**
 * Set an account as current. The current account is to one used to place calls with by default
Tristan Matthews's avatar
Tristan Matthews committed
184
 * The current account is the first in the account list( index 0 )
Julien Bonjean's avatar
Julien Bonjean committed
185
 */
186
void sflphone_set_current_account();
187

188
189
190
/**
 * Initialialize the codecs data structure
 */
Tristan Matthews's avatar
Tristan Matthews committed
191
void sflphone_fill_codec_list_per_account(account_t *);
192

193
194
void sflphone_add_participant();

Tristan Matthews's avatar
Tristan Matthews committed
195
void sflphone_record(callable_obj_t *c);
196

Tristan Matthews's avatar
Tristan Matthews committed
197
void sflphone_rec_call(void);
Alexandre Savard's avatar
Alexandre Savard committed
198

Tristan Matthews's avatar
Tristan Matthews committed
199
void sflphone_mute_call(void);
200

Tristan Matthews's avatar
Tristan Matthews committed
201
void status_bar_display_account();
202

Tristan Matthews's avatar
Tristan Matthews committed
203
void sflphone_fill_history(void);
Emmanuel Milou's avatar
Emmanuel Milou committed
204

205
206
207
/**
 * Action called when a new participant is dragged in
 */
Tristan Matthews's avatar
Tristan Matthews committed
208
void sflphone_add_participant(const gchar* callID, const gchar* confID);
209

210
211
212
/**
 * Action called when a conference participant is draged out
 */
Tristan Matthews's avatar
Tristan Matthews committed
213
void sflphone_detach_participant(const gchar* callID);
214

Julien Bonjean's avatar
Julien Bonjean committed
215
216
/**
 * Nofity that the communication is
217
 * now secured using SRTP/SDES.
218
219
 * @param c* The current call
 */
Tristan Matthews's avatar
Tristan Matthews committed
220
void sflphone_srtp_sdes_on(callable_obj_t * c);
221

Julien Bonjean's avatar
Julien Bonjean committed
222
/**
223
224
225
226
 * Notify that the SRTP/SDES session
 * is not secured
 */

Julien Bonjean's avatar
Julien Bonjean committed
227
228
/**
 * Nofity that the communication is
229
230
231
 * now secured using ZRTP.
 * @param c* The current call
 */
Tristan Matthews's avatar
Tristan Matthews committed
232
void sflphone_srtp_zrtp_on(callable_obj_t * c);
233

Julien Bonjean's avatar
Julien Bonjean committed
234
/**
235
 * Called when the ZRTP session goes
236
237
238
 * unsecured.
 * @param c* The current call
 */
Tristan Matthews's avatar
Tristan Matthews committed
239
void sflphone_srtp_zrtp_off(callable_obj_t * c);
240

Julien Bonjean's avatar
Julien Bonjean committed
241
/**
242
 * Called when the sas has been computed
243
244
245
246
247
 * and is ready to be displayed.
 * @param c* The current call
 * @param sas* The Short Authentication String
 * @param verified* Weather the SAS was confirmed or not.
 */
Tristan Matthews's avatar
Tristan Matthews committed
248
void sflphone_srtp_zrtp_show_sas(callable_obj_t * c, const gchar* sas, const gboolean verified);
249

250
251
/**
 * Called when user wants to clear.
252
253
 * @param c* The call on which to go clear
 */
Tristan Matthews's avatar
Tristan Matthews committed
254
255

void sflphone_request_go_clear(void);
256

Julien Bonjean's avatar
Julien Bonjean committed
257
258
/**
 * Called when the UI needs to be refreshed to
259
 * better inform the user about the current
Julien Bonjean's avatar
Julien Bonjean committed
260
 * state of the call.
261
262
263
264
 * @param c A pointer to the call that needs to be updated
 * @param description A textual description of the code
 * @param code The status code as in SIP or IAX
 */
Tristan Matthews's avatar
Tristan Matthews committed
265
void sflphone_call_state_changed(callable_obj_t * c, const gchar * description, const guint code);
266

Tristan Matthews's avatar
Tristan Matthews committed
267
void sflphone_add_main_participant(const conference_obj_t * c);
Julien Bonjean's avatar
Julien Bonjean committed
268

Tristan Matthews's avatar
Tristan Matthews committed
269
void sflphone_srtp_sdes_off(callable_obj_t * c);
Julien Bonjean's avatar
Julien Bonjean committed
270

Tristan Matthews's avatar
Tristan Matthews committed
271
void sflphone_fill_conference_list(void);
Julien Bonjean's avatar
Julien Bonjean committed
272

Julien Bonjean's avatar
Julien Bonjean committed
273
#endif