Mercurial > pidgin
annotate src/connection.h @ 6285:0d6a54dc4dee
[gaim-migrate @ 6784]
Bjoern Voigt updated the de.po and german.nsh
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 23 Jul 2003 14:37:21 +0000 |
parents | 0922bb7a7bbc |
children | 74ca311ceb2a |
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. */ | |
86 }; | |
87 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
88 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
89 extern "C" { |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
90 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
91 |
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 /** @name Connection API */ |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
94 /**************************************************************************/ |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
95 |
5563 | 96 /** |
97 * Creates a connection to the specified account. | |
98 * | |
99 * @param account The account the connection should be connecting to. | |
100 * | |
101 * @return The gaim connection. | |
102 */ | |
103 GaimConnection *gaim_connection_new(GaimAccount *account); | |
104 | |
105 /** | |
106 * Destroys and closes a gaim connection. | |
107 * | |
108 * @param gc The gaim connection to destroy. | |
109 */ | |
110 void gaim_connection_destroy(GaimConnection *gc); | |
111 | |
112 /** | |
113 * Signs a connection on. | |
114 * | |
115 * @param gc The connection to sign on. | |
116 * | |
117 * @see gaim_connection_disconnect() | |
118 */ | |
119 void gaim_connection_connect(GaimConnection *gc); | |
120 | |
121 /** | |
122 * Signs a connection off. | |
123 * | |
124 * @param gc The connection to sign off. | |
125 * | |
126 * @see gaim_connection_connect() | |
127 */ | |
128 void gaim_connection_disconnect(GaimConnection *gc); | |
129 | |
130 /** | |
131 * Sets the connection state. | |
132 * | |
133 * @param gc The connection. | |
134 * @param state The connection state. | |
135 */ | |
136 void gaim_connection_set_state(GaimConnection *gc, GaimConnectionState state); | |
137 | |
138 /** | |
139 * Sets the connection's account. | |
140 * | |
141 * @param gc The connection. | |
142 * @param account The account. | |
143 */ | |
144 void gaim_connection_set_account(GaimConnection *gc, GaimAccount *account); | |
145 | |
146 /** | |
147 * Sets the connection's displayed name. | |
148 * | |
149 * @param gc The connection. | |
150 * @param name The displayed name. | |
151 */ | |
152 void gaim_connection_set_display_name(GaimConnection *gc, const char *name); | |
153 | |
154 /** | |
155 * Returns the connection state. | |
156 * | |
157 * @param gc The connection. | |
158 * | |
159 * @return The connection state. | |
160 */ | |
161 GaimConnectionState gaim_connection_get_state(const GaimConnection *gc); | |
162 | |
163 /** | |
164 * Returns the connection's account. | |
165 * | |
166 * @param gc The connection. | |
167 * | |
168 * @return The connection's account. | |
169 */ | |
170 GaimAccount *gaim_connection_get_account(const GaimConnection *gc); | |
171 | |
172 /** | |
173 * Returns the connection's displayed name. | |
174 * | |
175 * @param gc The connection. | |
176 * | |
177 * @return The connection's displayed name. | |
178 */ | |
179 const char *gaim_connection_get_display_name(const GaimConnection *gc); | |
180 | |
181 /** | |
182 * Updates the connection progress. | |
183 * | |
184 * @param gc The connection. | |
185 * @param text Information on the current step. | |
186 * @param step The current step. | |
187 * @param count The total number of steps. | |
188 */ | |
189 void gaim_connection_update_progress(GaimConnection *gc, const char *text, | |
190 size_t step, size_t count); | |
191 | |
192 /** | |
5571
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
193 * Displays a connection-specific notice. |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
194 * |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
195 * @param gc The connection. |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
196 * @param text The notice text. |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
197 */ |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
198 void gaim_connection_notice(GaimConnection *gc, const char *text); |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
199 |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
200 /** |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
201 * Closes a connection with an error. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
202 * |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
203 * @param gc The connection. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
204 * @param reason The error text. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
205 */ |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
206 void gaim_connection_error(GaimConnection *gc, const char *reason); |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
207 |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
208 /*@}*/ |
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 /** @name Connections API */ |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
212 /**************************************************************************/ |
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 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
215 /** |
5563 | 216 * Disconnects from all connections. |
217 */ | |
218 void gaim_connections_disconnect_all(void); | |
219 | |
220 /** | |
221 * Returns a list of all active connections. | |
222 * | |
223 * @return A list of all active connections. | |
224 */ | |
225 GList *gaim_connections_get_all(void); | |
226 | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
227 /** |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
228 * Returns a list of all connections in the process of connecting. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
229 * |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
230 * @return A list of connecting connections. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
231 */ |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
232 GList *gaim_connections_get_connecting(void); |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
233 |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
234 /*@}*/ |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
235 |
5563 | 236 /**************************************************************************/ |
237 /** @name UI Operations API */ | |
238 /**************************************************************************/ | |
239 /*@{*/ | |
240 | |
241 /** | |
242 * Sets the UI operations structure to be used for connections. | |
243 * | |
244 * @param ops The UI operations structure. | |
245 */ | |
246 void gaim_set_connection_ui_ops(GaimConnectionUiOps *ops); | |
247 | |
248 /** | |
249 * Returns the UI operations structure used for connections. | |
250 * | |
251 * @return The UI operations structure in use. | |
252 */ | |
253 GaimConnectionUiOps *gaim_get_connection_ui_ops(void); | |
254 | |
255 /*@}*/ | |
256 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
257 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
258 } |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
259 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
260 |
5563 | 261 #endif /* _GAIM_CONNECTION_H_ */ |