37
37
* @brief A list to hold accounts.
40
/** @enum account_state_t
40
/** @enum account_state_t
41
41
* This enum have all the states an account can take.
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 */
53
/** Error state. The account is not registered */
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 **/
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 */
52
/** Error state. The account is not registered */
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 **/
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.
75
* To retrieve the Alias for example, use g_hash_table_lookup(a->properties, ACCOUNT_ALIAS).
74
* To retrieve the Alias for example, use g_hash_table_lookup(a->properties, ACCOUNT_ALIAS).
80
account_state_t state;
81
gchar * protocol_state_description;
82
guint protocol_state_code;
83
GHashTable * properties;
84
GPtrArray * credential_information;
79
account_state_t state;
80
gchar * protocol_state_description;
81
guint protocol_state_code;
82
GHashTable * properties;
83
GPtrArray * credential_information;
88
guint _messages_number;
87
guint _messages_number;
93
* This function initialize the account list.
92
* This function initialize the account list.
95
94
void account_list_init ();
98
* This function empty and free the account list.
97
* This function empty and free the account list.
100
99
void account_list_clean ();
103
* This function append an account to list.
104
* @param a The account you want to add
102
* This function append an account to list.
103
* @param a The account you want to add
106
105
void account_list_add (account_t * a);
109
* This function append an account to list at a given position.
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
113
112
void account_list_add_at_nth (account_t * a, guint pos);
116
* This function remove an account from list.
115
* This function remove an account from list.
117
116
* @param accountID The accountID of the account you want to remove
119
118
void account_list_remove (const gchar * accountID);
122
* Return the first account that corresponds to the state
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
126
account_t * account_list_get_by_state ( account_state_t state);
125
account_t * account_list_get_by_state (account_state_t state);
129
128
* @return guint The number of registered accounts in the list
131
guint account_list_get_registered_accounts( );
130
guint account_list_get_registered_accounts();
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
137
guint account_list_get_size ( );
136
guint account_list_get_size ();
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
144
account_t * account_list_get_nth ( guint n );
143
account_t * account_list_get_nth (guint n);
147
146
* Return the current account struct
148
147
* @return The current account struct
150
account_t * account_list_get_current( );
149
account_t * account_list_get_current();
153
152
* This function sets an account as the current one
154
153
* @param current the account you want to set as current
156
155
void account_list_set_current (account_t *current);
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
163
const gchar * account_state_name(account_state_t s);
162
const gchar * account_state_name (account_state_t s);
166
165
* This function clear the list
168
void account_list_clear ( );
167
void account_list_clear ();
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
175
account_t * account_list_get_by_id(gchar * accountID);
174
account_t * account_list_get_by_id (gchar * accountID);
178
177
* Move the account from an unit up in the account_list
179
178
* @param index The current index in the list
181
void account_list_move_up( guint index );
180
void account_list_move_up (guint index);
184
183
* Move the account from an unit down in the account_list
185
184
* @param index The current index in the list
187
void account_list_move_down( guint index );
186
void account_list_move_down (guint index);
190
189
* Return the ID of the current default account
191
190
* @return gchar* The id
193
gchar* account_list_get_current_id( void );
192
gchar* account_list_get_current_id (void);
196
195
* Returns the number of SIP accounts that have been configured
198
int account_list_get_sip_account_number( void );
197
int account_list_get_sip_account_number (void);
201
200
* Returns the number of IAX accounts that have been configured
203
int account_list_get_iax_account_number( void );
202
int account_list_get_iax_account_number (void);
205
204
gchar * account_list_get_ordered_list (void);
207
206
guint account_list_get_position (account_t *account);
209
gboolean account_list_current_account_has_mailbox (void);
208
gboolean current_account_has_mailbox (void);
211
210
guint current_account_get_message_number (void);