Mercurial > pidgin.yaz
annotate src/connection.h @ 6448:fd3c96c0c2d6
[gaim-migrate @ 6957]
italian.nsh added to EXTRA_DIST
committer: Tailor Script <tailor@pidgin.im>
author | Herman Bloggs <hermanator12002@yahoo.com> |
---|---|
date | Wed, 13 Aug 2003 15:21:33 +0000 |
parents | 74ca311ceb2a |
children | ff4551719cc7 |
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> | |
8 * | |
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 | |
22 */ | |
23 #ifndef _GAIM_CONNECTION_H_ | |
24 #define _GAIM_CONNECTION_H_ | |
25 | |
26 #include <stdlib.h> | |
5733
4350b62bac45
[gaim-migrate @ 6157]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
27 #include <time.h> |
5563 | 28 |
29 typedef struct _GaimConnection GaimConnection; | |
30 | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5733
diff
changeset
|
31 #define OPT_CONN_HTML 0x00000001 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5733
diff
changeset
|
32 /* 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
|
33 #define OPT_CONN_AUTO_RESP 0x00000002 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5733
diff
changeset
|
34 |
5563 | 35 typedef enum |
36 { | |
37 GAIM_DISCONNECTED = 0, /**< Disconnected. */ | |
38 GAIM_CONNECTED, /**< Connected. */ | |
39 GAIM_CONNECTING /**< Connecting. */ | |
40 | |
41 } GaimConnectionState; | |
42 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
43 #include "account.h" |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
44 #include "plugin.h" |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
45 |
5563 | 46 typedef struct |
47 { | |
48 void (*connect_progress)(GaimConnection *gc, const char *text, | |
49 size_t step, size_t step_count); | |
50 void (*connected)(GaimConnection *gc); | |
51 void (*disconnected)(GaimConnection *gc, const char *reason); | |
5571
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
52 void (*notice)(GaimConnection *gc, const char *text); |
5563 | 53 |
54 } GaimConnectionUiOps; | |
55 | |
56 struct _GaimConnection | |
57 { | |
58 GaimPlugin *prpl; /**< The protocol plugin. */ | |
59 guint32 flags; /**< Connection flags. */ | |
60 | |
61 GaimConnectionState state; /**< The connection state. */ | |
62 | |
63 GaimAccount *account; /**< The account being connected to. */ | |
64 int inpa; /**< The input watcher. */ | |
65 | |
66 GSList *buddy_chats; /**< A list of active chats. */ | |
67 void *proto_data; /**< Protocol-specific data. */ | |
68 | |
69 char *display_name; /**< The name displayed. */ | |
70 guint keep_alive; /**< Keep-alive. */ | |
71 | |
72 guint idle_timer; /**< The idle timer. */ | |
73 time_t login_time; /**< Time of login. */ | |
74 time_t login_time_official; /**< Official time of login. */ | |
75 time_t last_sent_time; /**< The time something was last sent. */ | |
76 int is_idle; /**< Idle state of the connection. */ | |
77 | |
78 char *away; /**< The current away message, or NULL */ | |
79 char *away_state; /**< The last away type. */ | |
80 gboolean is_auto_away; /**< Whether or not it's auto-away. */ | |
81 | |
82 int evil; /**< Warning level for AIM (why is | |
83 this here?) */ | |
84 | |
85 gboolean wants_to_die; /**< Wants to Die state. */ | |
6393 | 86 guint disconnect_timeout; /**< Timer used for nasty stack tricks */ |
5563 | 87 }; |
88 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
89 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
90 extern "C" { |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
91 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
92 |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
93 /**************************************************************************/ |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
94 /** @name Connection API */ |
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 |
5563 | 97 /** |
98 * Creates a connection to the specified account. | |
99 * | |
100 * @param account The account the connection should be connecting to. | |
101 * | |
102 * @return The gaim connection. | |
103 */ | |
104 GaimConnection *gaim_connection_new(GaimAccount *account); | |
105 | |
106 /** | |
107 * Destroys and closes a gaim connection. | |
108 * | |
109 * @param gc The gaim connection to destroy. | |
110 */ | |
111 void gaim_connection_destroy(GaimConnection *gc); | |
112 | |
113 /** | |
114 * Signs a connection on. | |
115 * | |
116 * @param gc The connection to sign on. | |
117 * | |
118 * @see gaim_connection_disconnect() | |
119 */ | |
120 void gaim_connection_connect(GaimConnection *gc); | |
121 | |
122 /** | |
123 * Signs a connection off. | |
124 * | |
125 * @param gc The connection to sign off. | |
126 * | |
127 * @see gaim_connection_connect() | |
128 */ | |
129 void gaim_connection_disconnect(GaimConnection *gc); | |
130 | |
131 /** | |
132 * Sets the connection state. | |
133 * | |
134 * @param gc The connection. | |
135 * @param state The connection state. | |
136 */ | |
137 void gaim_connection_set_state(GaimConnection *gc, GaimConnectionState state); | |
138 | |
139 /** | |
140 * Sets the connection's account. | |
141 * | |
142 * @param gc The connection. | |
143 * @param account The account. | |
144 */ | |
145 void gaim_connection_set_account(GaimConnection *gc, GaimAccount *account); | |
146 | |
147 /** | |
148 * Sets the connection's displayed name. | |
149 * | |
150 * @param gc The connection. | |
151 * @param name The displayed name. | |
152 */ | |
153 void gaim_connection_set_display_name(GaimConnection *gc, const char *name); | |
154 | |
155 /** | |
156 * Returns the connection state. | |
157 * | |
158 * @param gc The connection. | |
159 * | |
160 * @return The connection state. | |
161 */ | |
162 GaimConnectionState gaim_connection_get_state(const GaimConnection *gc); | |
163 | |
164 /** | |
165 * Returns the connection's account. | |
166 * | |
167 * @param gc The connection. | |
168 * | |
169 * @return The connection's account. | |
170 */ | |
171 GaimAccount *gaim_connection_get_account(const GaimConnection *gc); | |
172 | |
173 /** | |
174 * Returns the connection's displayed name. | |
175 * | |
176 * @param gc The connection. | |
177 * | |
178 * @return The connection's displayed name. | |
179 */ | |
180 const char *gaim_connection_get_display_name(const GaimConnection *gc); | |
181 | |
182 /** | |
183 * Updates the connection progress. | |
184 * | |
185 * @param gc The connection. | |
186 * @param text Information on the current step. | |
187 * @param step The current step. | |
188 * @param count The total number of steps. | |
189 */ | |
190 void gaim_connection_update_progress(GaimConnection *gc, const char *text, | |
191 size_t step, size_t count); | |
192 | |
193 /** | |
5571
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
194 * Displays a connection-specific notice. |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
195 * |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
196 * @param gc The connection. |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
197 * @param text The notice text. |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
198 */ |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
199 void gaim_connection_notice(GaimConnection *gc, const char *text); |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
200 |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
201 /** |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
202 * Closes a connection with an error. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
203 * |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
204 * @param gc The connection. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
205 * @param reason The error text. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
206 */ |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
207 void gaim_connection_error(GaimConnection *gc, const char *reason); |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
208 |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
209 /*@}*/ |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
210 |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
211 /**************************************************************************/ |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
212 /** @name Connections API */ |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
213 /**************************************************************************/ |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
214 /*@{*/ |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
215 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
216 /** |
5563 | 217 * Disconnects from all connections. |
218 */ | |
219 void gaim_connections_disconnect_all(void); | |
220 | |
221 /** | |
222 * Returns a list of all active connections. | |
223 * | |
224 * @return A list of all active connections. | |
225 */ | |
226 GList *gaim_connections_get_all(void); | |
227 | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
228 /** |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
229 * Returns a list of all connections in the process of connecting. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
230 * |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
231 * @return A list of connecting connections. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
232 */ |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
233 GList *gaim_connections_get_connecting(void); |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
234 |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
235 /*@}*/ |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
236 |
5563 | 237 /**************************************************************************/ |
238 /** @name UI Operations API */ | |
239 /**************************************************************************/ | |
240 /*@{*/ | |
241 | |
242 /** | |
243 * Sets the UI operations structure to be used for connections. | |
244 * | |
245 * @param ops The UI operations structure. | |
246 */ | |
247 void gaim_set_connection_ui_ops(GaimConnectionUiOps *ops); | |
248 | |
249 /** | |
250 * Returns the UI operations structure used for connections. | |
251 * | |
252 * @return The UI operations structure in use. | |
253 */ | |
254 GaimConnectionUiOps *gaim_get_connection_ui_ops(void); | |
255 | |
256 /*@}*/ | |
257 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
258 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
259 } |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
260 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
261 |
5563 | 262 #endif /* _GAIM_CONNECTION_H_ */ |