connection.h
Go to the documentation of this file.
1 
7 /* purple
8  *
9  * Purple is the legal property of its developers, whose names are too numerous
10  * to list here. Please refer to the COPYRIGHT file distributed with this
11  * source distribution.
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26  */
27 #ifndef _PURPLE_CONNECTION_H_
28 #define _PURPLE_CONNECTION_H_
29 
32 
36 typedef enum
37 {
51 
52 typedef enum
53 {
59 
65 typedef enum
66 {
96 
107 
127 
131  /* purple_connection_error_reason() in connection.c uses the fact that
132  * this is the last member of the enum when sanity-checking; if other
133  * reasons are added after it, the check must be updated.
134  */
137 
139 typedef struct
140 {
144  char *description;
146 
147 #include <time.h>
148 
149 #include "account.h"
150 #include "plugin.h"
151 #include "status.h"
152 #include "sslconn.h"
153 
162 typedef struct
163 {
171  void (*connect_progress)(PurpleConnection *gc,
172  const char *text,
173  size_t step,
174  size_t step_count);
175 
180  void (*connected)(PurpleConnection *gc);
181 
186  void (*disconnected)(PurpleConnection *gc);
187 
194  void (*notice)(PurpleConnection *gc, const char *text);
195 
204  void (*report_disconnect)(PurpleConnection *gc, const char *text);
205 
212  void (*network_connected)(void);
213 
218  void (*network_disconnected)(void);
219 
234  void (*report_disconnect_reason)(PurpleConnection *gc,
235  PurpleConnectionError reason,
236  const char *text);
237 
238  void (*_purple_reserved1)(void);
239  void (*_purple_reserved2)(void);
240  void (*_purple_reserved3)(void);
242 
243 
244 /* Represents an active connection on an account. */
246 {
253  char *password;
254  int inpa;
256  GSList *buddy_chats;
259  void *proto_data;
261  char *display_name;
262  guint keepalive;
271  gboolean wants_to_die;
272 
274  time_t last_received;
276 };
277 
278 #ifdef __cplusplus
279 extern "C" {
280 #endif
281 
282 /**************************************************************************/
284 /**************************************************************************/
287 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_)
288 
307 void purple_connection_new(PurpleAccount *account, gboolean regist,
308  const char *password);
309 #endif
310 
311 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_)
312 
326 void purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data);
327 #endif
328 
329 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_)
330 
342 #endif
343 
355 
363 
370 void purple_connection_set_display_name(PurpleConnection *gc, const char *name);
371 
380 void purple_connection_set_protocol_data(PurpleConnection *connection, void *proto_data);
381 
390 
396 #define PURPLE_CONNECTION_IS_CONNECTED(gc) \
397  (purple_connection_get_state(gc) == PURPLE_CONNECTED)
398 
407 
418 
426 const char *purple_connection_get_password(const PurpleConnection *gc);
427 
436 
447 
456 void purple_connection_update_progress(PurpleConnection *gc, const char *text,
457  size_t step, size_t count);
458 
465 void purple_connection_notice(PurpleConnection *gc, const char *text);
466 
480 void purple_connection_error(PurpleConnection *gc, const char *reason);
481 
494 void
496  PurpleConnectionError reason,
497  const char *description);
498 
506 void
508  PurpleSslErrorType ssl_error);
509 
530 gboolean
532 
535 /**************************************************************************/
537 /**************************************************************************/
544 
551 GList *purple_connections_get_all(void);
552 
559 
568 /*
569  * TODO: Eventually this bad boy will be removed, because it is
570  * a gross fix for a crashy problem.
571  */
572 #define PURPLE_CONNECTION_IS_VALID(gc) (g_list_find(purple_connections_get_all(), (gc)) != NULL)
573 
576 /**************************************************************************/
578 /**************************************************************************/
587 
594 
597 /**************************************************************************/
599 /**************************************************************************/
605 void purple_connections_init(void);
606 
610 void purple_connections_uninit(void);
611 
618 
622 #ifdef __cplusplus
623 }
624 #endif
625 
626 #endif /* _PURPLE_CONNECTION_H_ */