~ubuntu-branches/ubuntu/saucy/sflphone/saucy

« back to all changes in this revision

Viewing changes to sflphone-client-gnome/src/accountlist.h

  • Committer: Bazaar Package Importer
  • Author(s): Francois Marier
  • Date: 2010-12-24 16:33:55 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20101224163355-tkvvikqxbrbav6up
Tags: 0.9.11-1
* New upstream release
* Add new build dependencies on libwebkit-dev and libyaml-dev

* Bump Standards-Version up to 3.9.1
* Bump debhelper compatibility to 8
* Patch another typo in the upstream code (lintian notice)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *  Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010 Savoir-Faire Linux Inc.
3
3
 *  Author: Pierre-Luc Beaudoin <pierre-luc@savoirfairelinux.com>
4
4
 *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
5
 
 *                                                                              
 
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
8
8
 *  the Free Software Foundation; either version 3 of the License, or
9
9
 *  (at your option) any later version.
10
 
 *                                                                                
 
10
 *
11
11
 *  This program is distributed in the hope that it will be useful,
12
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
14
 *  GNU General Public License for more details.
15
 
 *                                                                              
 
15
 *
16
16
 *  You should have received a copy of the GNU General Public License
17
17
 *  along with this program; if not, write to the Free Software
18
18
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28
28
 *  shall include the source code for the parts of OpenSSL used as well
29
29
 *  as that of the covered work.
30
30
 */
31
 
 
 
31
 
32
32
#ifndef __ACCOUNTLIST_H__
33
33
#define __ACCOUNTLIST_H__
34
34
 
37
37
  * @brief A list to hold accounts.
38
38
  */
39
39
 
40
 
/** @enum account_state_t 
 
40
/** @enum account_state_t
41
41
  * This enum have all the states an account can take.
42
42
  */
43
 
typedef enum
44
 
{
45
 
  /** Invalid state */
46
 
   ACCOUNT_STATE_INVALID = 0,
47
 
   /** The account is registered  */
48
 
   ACCOUNT_STATE_REGISTERED,   
49
 
   /** The account is not registered */
50
 
   ACCOUNT_STATE_UNREGISTERED,   
51
 
   /** The account is trying to register */
52
 
   ACCOUNT_STATE_TRYING, 
53
 
   /** Error state. The account is not registered */
54
 
   ACCOUNT_STATE_ERROR,
55
 
   /** An authentification error occured. Wrong password or wrong username. The account is not registered */
56
 
   ACCOUNT_STATE_ERROR_AUTH,
57
 
   /** The network is unreachable. The account is not registered */
58
 
   ACCOUNT_STATE_ERROR_NETWORK,
59
 
   /** Host is unreachable. The account is not registered */
60
 
   ACCOUNT_STATE_ERROR_HOST,
61
 
   /** Stun server configuration error. The account is not registered */
62
 
   ACCOUNT_STATE_ERROR_CONF_STUN,
63
 
   /** Stun server is not existing. The account is not registered */
64
 
   ACCOUNT_STATE_ERROR_EXIST_STUN,
65
 
   /** IP profile status **/
66
 
   IP2IP_PROFILE_STATUS
 
43
typedef enum {
 
44
    /** Invalid state */
 
45
    ACCOUNT_STATE_INVALID = 0,
 
46
    /** The account is registered  */
 
47
    ACCOUNT_STATE_REGISTERED,
 
48
    /** The account is not registered */
 
49
    ACCOUNT_STATE_UNREGISTERED,
 
50
    /** The account is trying to register */
 
51
    ACCOUNT_STATE_TRYING,
 
52
    /** Error state. The account is not registered */
 
53
    ACCOUNT_STATE_ERROR,
 
54
    /** An authentification error occured. Wrong password or wrong username. The account is not registered */
 
55
    ACCOUNT_STATE_ERROR_AUTH,
 
56
    /** The network is unreachable. The account is not registered */
 
57
    ACCOUNT_STATE_ERROR_NETWORK,
 
58
    /** Host is unreachable. The account is not registered */
 
59
    ACCOUNT_STATE_ERROR_HOST,
 
60
    /** Stun server configuration error. The account is not registered */
 
61
    ACCOUNT_STATE_ERROR_CONF_STUN,
 
62
    /** Stun server is not existing. The account is not registered */
 
63
    ACCOUNT_STATE_ERROR_EXIST_STUN,
 
64
    /** IP profile status **/
 
65
    IP2IP_PROFILE_STATUS
67
66
} account_state_t;
68
67
 
69
68
/** @struct account_t
70
69
  * @brief Account information.
71
 
  * This struct holds information about an account.  All values are stored in the 
72
 
  * properties GHashTable except the accountID and state.  This match how the 
 
70
  * This struct holds information about an account.  All values are stored in the
 
71
  * properties GHashTable except the accountID and state.  This match how the
73
72
  * server internally works and the dbus API to save and retrieve the accounts details.
74
 
  * 
75
 
  * To retrieve the Alias for example, use g_hash_table_lookup(a->properties, ACCOUNT_ALIAS).  
 
73
  *
 
74
  * To retrieve the Alias for example, use g_hash_table_lookup(a->properties, ACCOUNT_ALIAS).
76
75
  */
77
76
 
78
77
typedef struct  {
79
 
        gchar * accountID;
80
 
        account_state_t state;
81
 
        gchar * protocol_state_description;
82
 
        guint protocol_state_code;  
83
 
        GHashTable * properties;
84
 
        GPtrArray * credential_information;
 
78
    gchar * accountID;
 
79
    account_state_t state;
 
80
    gchar * protocol_state_description;
 
81
    guint protocol_state_code;
 
82
    GHashTable * properties;
 
83
    GPtrArray * credential_information;
85
84
 
86
 
        /* The codec list */
87
 
        GQueue *codecs;
88
 
        guint _messages_number;
 
85
    /* The codec list */
 
86
    GQueue *codecs;
 
87
    guint _messages_number;
89
88
} account_t;
90
89
 
91
90
 
92
 
/** 
93
 
 * This function initialize the account list. 
 
91
/**
 
92
 * This function initialize the account list.
94
93
 */
95
94
void account_list_init ();
96
95
 
97
 
/** 
98
 
 * This function empty and free the account list. 
 
96
/**
 
97
 * This function empty and free the account list.
99
98
 */
100
99
void account_list_clean ();
101
100
 
102
 
/** 
103
 
 * This function append an account to list. 
104
 
 * @param a The account you want to add 
 
101
/**
 
102
 * This function append an account to list.
 
103
 * @param a The account you want to add
105
104
 */
106
105
void account_list_add (account_t * a);
107
106
 
108
 
/** 
109
 
 * This function append an account to list at a given position. 
 
107
/**
 
108
 * This function append an account to list at a given position.
110
109
 * @param a The account you want to add
111
110
 * @param pos THe position in the list to insert the account
112
111
 */
113
112
void account_list_add_at_nth (account_t * a, guint pos);
114
113
 
115
 
/** 
116
 
 * This function remove an account from list. 
 
114
/**
 
115
 * This function remove an account from list.
117
116
 * @param accountID The accountID of the account you want to remove
118
117
 */
119
118
void account_list_remove (const gchar * accountID);
120
119
 
121
 
/** 
122
 
 * Return the first account that corresponds to the state 
 
120
/**
 
121
 * Return the first account that corresponds to the state
123
122
 * @param state The state
124
 
 * @return account_t* An account or NULL 
 
123
 * @return account_t* An account or NULL
125
124
 */
126
 
account_t * account_list_get_by_state ( account_state_t state);
 
125
account_t * account_list_get_by_state (account_state_t state);
127
126
 
128
127
/**
129
128
 * @return guint The number of registered accounts in the list
130
129
 */
131
 
guint account_list_get_registered_accounts( );
 
130
guint account_list_get_registered_accounts();
132
131
 
133
 
/** 
 
132
/**
134
133
 * Return the number of accounts in the list
135
 
 * @return guint The number of accounts in the list 
 
134
 * @return guint The number of accounts in the list
136
135
 */
137
 
guint account_list_get_size ( );
 
136
guint account_list_get_size ();
138
137
 
139
 
/** 
 
138
/**
140
139
 * Return the account at the nth position in the list
141
140
 * @param n The position of the account you want
142
 
 * @return An account or NULL 
 
141
 * @return An account or NULL
143
142
 */
144
 
account_t * account_list_get_nth ( guint n );
 
143
account_t * account_list_get_nth (guint n);
145
144
 
146
 
/** 
 
145
/**
147
146
 * Return the current account struct
148
147
 *  @return The current account struct
149
148
 */
150
 
account_t * account_list_get_current( );
 
149
account_t * account_list_get_current();
151
150
 
152
 
/** 
 
151
/**
153
152
 * This function sets an account as the current one
154
153
 * @param current the account you want to set as current
155
154
 */
156
155
void account_list_set_current (account_t *current);
157
156
 
158
 
/** 
 
157
/**
159
158
 * This function maps account_state_t enums to a description.
160
159
 * @param s The state
161
 
 * @return The full text description of the state 
 
160
 * @return The full text description of the state
162
161
 */
163
 
const gchar * account_state_name(account_state_t s);
 
162
const gchar * account_state_name (account_state_t s);
164
163
 
165
 
/** 
 
164
/**
166
165
 * This function clear the list
167
166
 */
168
 
void account_list_clear ( );
 
167
void account_list_clear ();
169
168
 
170
 
/** 
 
169
/**
171
170
 * Return the account associated with an ID
172
171
 * @param accountID The ID of the account
173
 
 * @return An account or NULL 
 
172
 * @return An account or NULL
174
173
 */
175
 
account_t * account_list_get_by_id(gchar * accountID); 
 
174
account_t * account_list_get_by_id (gchar * accountID);
176
175
 
177
 
/** 
 
176
/**
178
177
 * Move the account from an unit up in the account_list
179
178
 * @param index The current index in the list
180
179
 */
181
 
void account_list_move_up( guint index );
 
180
void account_list_move_up (guint index);
182
181
 
183
 
/** 
 
182
/**
184
183
 * Move the account from an unit down in the account_list
185
184
 * @param index The current index in the list
186
185
 */
187
 
void account_list_move_down( guint index );
 
186
void account_list_move_down (guint index);
188
187
 
189
188
/**
190
189
 * Return the ID of the current default account
191
190
 * @return gchar* The id
192
191
 */
193
 
gchar* account_list_get_current_id( void );
 
192
gchar* account_list_get_current_id (void);
194
193
 
195
194
/**
196
195
 * Returns the number of SIP accounts that have been configured
197
196
 */
198
 
int account_list_get_sip_account_number( void );
 
197
int account_list_get_sip_account_number (void);
199
198
 
200
199
/**
201
200
 * Returns the number of IAX accounts that have been configured
202
201
 */
203
 
int account_list_get_iax_account_number( void );
 
202
int account_list_get_iax_account_number (void);
204
203
 
205
204
gchar * account_list_get_ordered_list (void);
206
205
 
207
206
guint account_list_get_position (account_t *account);
208
207
 
209
 
gboolean account_list_current_account_has_mailbox (void);
 
208
gboolean current_account_has_mailbox (void);
210
209
 
211
210
guint current_account_get_message_number (void);
212
211
 
214
213
 
215
214
gboolean current_account_has_new_message (void);
216
215
 
217
 
#endif 
 
216
#endif