Mercurial > pidgin
annotate src/connection.h @ 6605:943b03bcecf5
[gaim-migrate @ 7129]
Added some signal documentation. The conversation signal docs are taking
forever. Who wants to help? :)
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Sun, 24 Aug 2003 06:32:28 +0000 |
| parents | e07c66073b6d |
| children | a4622f1fb5a1 |
| rev | line source |
|---|---|
| 5563 | 1 /** |
| 2 * @file connection.h Connection API | |
| 3 * @ingroup core | |
| 4 * | |
| 5 * gaim | |
| 6 * | |
| 7 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> | |
|
6460
ff4551719cc7
[gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents:
6393
diff
changeset
|
8 * |
| 5563 | 9 * This program is free software; you can redistribute it and/or modify |
| 10 * it under the terms of the GNU General Public License as published by | |
| 11 * the Free Software Foundation; either version 2 of the License, or | |
| 12 * (at your option) any later version. | |
| 13 * | |
| 14 * This program is distributed in the hope that it will be useful, | |
| 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 * GNU General Public License for more details. | |
| 18 * | |
| 19 * You should have received a copy of the GNU General Public License | |
| 20 * along with this program; if not, write to the Free Software | |
| 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
|
6488
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
22 * |
|
6605
943b03bcecf5
[gaim-migrate @ 7129]
Christian Hammond <chipx86@chipx86.com>
parents:
6583
diff
changeset
|
23 * @see @ref connection-signals |
| 5563 | 24 */ |
| 25 #ifndef _GAIM_CONNECTION_H_ | |
| 26 #define _GAIM_CONNECTION_H_ | |
| 27 | |
| 28 #include <stdlib.h> | |
|
5733
4350b62bac45
[gaim-migrate @ 6157]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
29 #include <time.h> |
| 5563 | 30 |
| 31 typedef struct _GaimConnection GaimConnection; | |
| 32 | |
|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5733
diff
changeset
|
33 #define OPT_CONN_HTML 0x00000001 |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5733
diff
changeset
|
34 /* set this flag on a gc if you want serv_got_im to autoreply when away */ |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5733
diff
changeset
|
35 #define OPT_CONN_AUTO_RESP 0x00000002 |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5733
diff
changeset
|
36 |
| 5563 | 37 typedef enum |
| 38 { | |
| 39 GAIM_DISCONNECTED = 0, /**< Disconnected. */ | |
| 40 GAIM_CONNECTED, /**< Connected. */ | |
| 41 GAIM_CONNECTING /**< Connecting. */ | |
| 42 | |
| 43 } GaimConnectionState; | |
| 44 | |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
45 #include "account.h" |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
46 #include "plugin.h" |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
47 |
| 5563 | 48 typedef struct |
| 49 { | |
| 50 void (*connect_progress)(GaimConnection *gc, const char *text, | |
| 51 size_t step, size_t step_count); | |
| 52 void (*connected)(GaimConnection *gc); | |
|
6460
ff4551719cc7
[gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents:
6393
diff
changeset
|
53 void (*disconnected)(GaimConnection *gc); |
|
5571
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
54 void (*notice)(GaimConnection *gc, const char *text); |
|
6460
ff4551719cc7
[gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents:
6393
diff
changeset
|
55 void (*report_disconnect)(GaimConnection *gc, const char *text); |
| 5563 | 56 |
| 57 } GaimConnectionUiOps; | |
| 58 | |
| 59 struct _GaimConnection | |
| 60 { | |
| 61 GaimPlugin *prpl; /**< The protocol plugin. */ | |
| 62 guint32 flags; /**< Connection flags. */ | |
| 63 | |
| 64 GaimConnectionState state; /**< The connection state. */ | |
| 65 | |
| 66 GaimAccount *account; /**< The account being connected to. */ | |
| 67 int inpa; /**< The input watcher. */ | |
| 68 | |
| 69 GSList *buddy_chats; /**< A list of active chats. */ | |
| 70 void *proto_data; /**< Protocol-specific data. */ | |
| 71 | |
| 72 char *display_name; /**< The name displayed. */ | |
| 73 guint keep_alive; /**< Keep-alive. */ | |
| 74 | |
| 75 guint idle_timer; /**< The idle timer. */ | |
| 76 time_t login_time; /**< Time of login. */ | |
| 77 time_t login_time_official; /**< Official time of login. */ | |
| 78 time_t last_sent_time; /**< The time something was last sent. */ | |
| 79 int is_idle; /**< Idle state of the connection. */ | |
| 80 | |
| 81 char *away; /**< The current away message, or NULL */ | |
| 82 char *away_state; /**< The last away type. */ | |
| 83 gboolean is_auto_away; /**< Whether or not it's auto-away. */ | |
| 84 | |
| 85 int evil; /**< Warning level for AIM (why is | |
| 86 this here?) */ | |
| 87 | |
| 88 gboolean wants_to_die; /**< Wants to Die state. */ | |
| 6393 | 89 guint disconnect_timeout; /**< Timer used for nasty stack tricks */ |
| 5563 | 90 }; |
| 91 | |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
92 #ifdef __cplusplus |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
93 extern "C" { |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
94 #endif |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
95 |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
96 /**************************************************************************/ |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
97 /** @name Connection API */ |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
98 /**************************************************************************/ |
|
6488
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
99 /*@{*/ |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
100 |
| 5563 | 101 /** |
| 102 * Creates a connection to the specified account. | |
| 103 * | |
| 104 * @param account The account the connection should be connecting to. | |
| 105 * | |
| 106 * @return The gaim connection. | |
| 107 */ | |
| 108 GaimConnection *gaim_connection_new(GaimAccount *account); | |
| 109 | |
| 110 /** | |
| 111 * Destroys and closes a gaim connection. | |
| 112 * | |
| 113 * @param gc The gaim connection to destroy. | |
| 114 */ | |
| 115 void gaim_connection_destroy(GaimConnection *gc); | |
| 116 | |
| 117 /** | |
| 118 * Signs a connection on. | |
| 119 * | |
| 120 * @param gc The connection to sign on. | |
| 121 * | |
| 122 * @see gaim_connection_disconnect() | |
| 123 */ | |
| 124 void gaim_connection_connect(GaimConnection *gc); | |
| 125 | |
| 126 /** | |
| 6581 | 127 * Registers a connection. |
| 128 * | |
| 129 * @param gc The connection to register. | |
| 130 */ | |
| 131 void gaim_connection_register(GaimConnection *gc); | |
| 132 | |
| 133 /** | |
| 5563 | 134 * Signs a connection off. |
|
6583
e07c66073b6d
[gaim-migrate @ 7105]
Christian Hammond <chipx86@chipx86.com>
parents:
6581
diff
changeset
|
135 * |
| 5563 | 136 * @param gc The connection to sign off. |
| 137 * | |
| 138 * @see gaim_connection_connect() | |
| 139 */ | |
| 140 void gaim_connection_disconnect(GaimConnection *gc); | |
| 141 | |
| 142 /** | |
| 143 * Sets the connection state. | |
| 144 * | |
| 145 * @param gc The connection. | |
| 146 * @param state The connection state. | |
| 147 */ | |
| 148 void gaim_connection_set_state(GaimConnection *gc, GaimConnectionState state); | |
| 149 | |
| 150 /** | |
| 151 * Sets the connection's account. | |
| 152 * | |
| 153 * @param gc The connection. | |
| 154 * @param account The account. | |
| 155 */ | |
| 156 void gaim_connection_set_account(GaimConnection *gc, GaimAccount *account); | |
| 157 | |
| 158 /** | |
| 159 * Sets the connection's displayed name. | |
| 160 * | |
| 161 * @param gc The connection. | |
| 162 * @param name The displayed name. | |
| 163 */ | |
| 164 void gaim_connection_set_display_name(GaimConnection *gc, const char *name); | |
| 165 | |
| 166 /** | |
| 167 * Returns the connection state. | |
| 168 * | |
| 169 * @param gc The connection. | |
| 170 * | |
| 171 * @return The connection state. | |
| 172 */ | |
| 173 GaimConnectionState gaim_connection_get_state(const GaimConnection *gc); | |
| 174 | |
| 175 /** | |
| 176 * Returns the connection's account. | |
| 177 * | |
| 178 * @param gc The connection. | |
| 179 * | |
| 180 * @return The connection's account. | |
| 181 */ | |
| 182 GaimAccount *gaim_connection_get_account(const GaimConnection *gc); | |
| 183 | |
| 184 /** | |
| 185 * Returns the connection's displayed name. | |
| 186 * | |
| 187 * @param gc The connection. | |
| 188 * | |
| 189 * @return The connection's displayed name. | |
| 190 */ | |
| 191 const char *gaim_connection_get_display_name(const GaimConnection *gc); | |
| 192 | |
| 193 /** | |
| 194 * Updates the connection progress. | |
| 195 * | |
| 196 * @param gc The connection. | |
| 197 * @param text Information on the current step. | |
| 198 * @param step The current step. | |
| 199 * @param count The total number of steps. | |
| 200 */ | |
| 201 void gaim_connection_update_progress(GaimConnection *gc, const char *text, | |
| 202 size_t step, size_t count); | |
| 203 | |
| 204 /** | |
|
5571
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
205 * Displays a connection-specific notice. |
|
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
206 * |
|
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
207 * @param gc The connection. |
|
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
208 * @param text The notice text. |
|
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
209 */ |
|
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
210 void gaim_connection_notice(GaimConnection *gc, const char *text); |
|
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
211 |
|
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
212 /** |
|
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
213 * Closes a connection with an error. |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
214 * |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
215 * @param gc The connection. |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
216 * @param reason The error text. |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
217 */ |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
218 void gaim_connection_error(GaimConnection *gc, const char *reason); |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
219 |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
220 /*@}*/ |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
221 |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
222 /**************************************************************************/ |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
223 /** @name Connections API */ |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
224 /**************************************************************************/ |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
225 /*@{*/ |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
226 |
|
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
227 /** |
| 5563 | 228 * Disconnects from all connections. |
| 229 */ | |
| 230 void gaim_connections_disconnect_all(void); | |
| 231 | |
| 232 /** | |
| 233 * Returns a list of all active connections. | |
| 234 * | |
| 235 * @return A list of all active connections. | |
| 236 */ | |
| 237 GList *gaim_connections_get_all(void); | |
| 238 | |
|
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
239 /** |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
240 * Returns a list of all connections in the process of connecting. |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
241 * |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
242 * @return A list of connecting connections. |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
243 */ |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
244 GList *gaim_connections_get_connecting(void); |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
245 |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
246 /*@}*/ |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
247 |
| 5563 | 248 /**************************************************************************/ |
| 249 /** @name UI Operations API */ | |
| 250 /**************************************************************************/ | |
| 251 /*@{*/ | |
| 252 | |
| 253 /** | |
| 254 * Sets the UI operations structure to be used for connections. | |
| 255 * | |
| 256 * @param ops The UI operations structure. | |
| 257 */ | |
| 258 void gaim_set_connection_ui_ops(GaimConnectionUiOps *ops); | |
| 259 | |
| 260 /** | |
| 261 * Returns the UI operations structure used for connections. | |
| 262 * | |
| 263 * @return The UI operations structure in use. | |
| 264 */ | |
| 265 GaimConnectionUiOps *gaim_get_connection_ui_ops(void); | |
| 266 | |
| 267 /*@}*/ | |
| 268 | |
|
6488
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
269 /**************************************************************************/ |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
270 /** @name Connections Subsystem */ |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
271 /**************************************************************************/ |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
272 /*@{*/ |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
273 |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
274 /** |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
275 * Initializes the connections subsystem. |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
276 */ |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
277 void gaim_connections_init(void); |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
278 |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
279 /** |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
280 * Uninitializes the connections subsystem. |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
281 */ |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
282 void gaim_connections_uninit(void); |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
283 |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
284 /** |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
285 * Returns the handle to the connections subsystem. |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
286 * |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
287 * @return The connections subsystem handle. |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
288 */ |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
289 void *gaim_connections_get_handle(void); |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
290 |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
291 /*@}*/ |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
292 |
|
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
293 |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
294 #ifdef __cplusplus |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
295 } |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
296 #endif |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
297 |
| 5563 | 298 #endif /* _GAIM_CONNECTION_H_ */ |
