Mercurial > pidgin
annotate src/connection.h @ 5686:861565bed110
[gaim-migrate @ 6107]
The modify account dialog now better complies with the HIG, and proxy
options are being implemented again. Also, a few improvements to utility
functions and to the label for the protocol options.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Tue, 03 Jun 2003 04:33:04 +0000 |
parents | 113090160626 |
children | 1d140b31d4b3 |
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> | |
27 | |
28 typedef struct _GaimConnection GaimConnection; | |
29 | |
30 #include "account.h" | |
31 #include "plugin.h" | |
32 #include "multi.h" | |
33 | |
34 typedef enum | |
35 { | |
36 GAIM_DISCONNECTED = 0, /**< Disconnected. */ | |
37 GAIM_CONNECTED, /**< Connected. */ | |
38 GAIM_CONNECTING /**< Connecting. */ | |
39 | |
40 } GaimConnectionState; | |
41 | |
42 typedef struct | |
43 { | |
44 void (*connect_progress)(GaimConnection *gc, const char *text, | |
45 size_t step, size_t step_count); | |
46 void (*connected)(GaimConnection *gc); | |
47 void (*request_pass)(GaimConnection *gc); | |
48 void (*disconnected)(GaimConnection *gc, const char *reason); | |
5571
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
49 void (*notice)(GaimConnection *gc, const char *text); |
5563 | 50 |
51 } GaimConnectionUiOps; | |
52 | |
53 struct _GaimConnection | |
54 { | |
55 GaimPlugin *prpl; /**< The protocol plugin. */ | |
56 guint32 flags; /**< Connection flags. */ | |
57 | |
58 GaimConnectionState state; /**< The connection state. */ | |
59 | |
60 GaimAccount *account; /**< The account being connected to. */ | |
61 int inpa; /**< The input watcher. */ | |
62 | |
63 GSList *buddy_chats; /**< A list of active chats. */ | |
64 void *proto_data; /**< Protocol-specific data. */ | |
65 | |
66 char *display_name; /**< The name displayed. */ | |
67 guint keep_alive; /**< Keep-alive. */ | |
68 | |
69 guint idle_timer; /**< The idle timer. */ | |
70 time_t login_time; /**< Time of login. */ | |
71 time_t login_time_official; /**< Official time of login. */ | |
72 time_t last_sent_time; /**< The time something was last sent. */ | |
73 int is_idle; /**< Idle state of the connection. */ | |
74 | |
75 char *away; /**< The current away message, or NULL */ | |
76 char *away_state; /**< The last away type. */ | |
77 gboolean is_auto_away; /**< Whether or not it's auto-away. */ | |
78 | |
79 int evil; /**< Warning level for AIM (why is | |
80 this here?) */ | |
81 | |
82 gboolean wants_to_die; /**< Wants to Die state. */ | |
83 }; | |
84 | |
85 /** | |
86 * Creates a connection to the specified account. | |
87 * | |
88 * @param account The account the connection should be connecting to. | |
89 * | |
90 * @return The gaim connection. | |
91 */ | |
92 GaimConnection *gaim_connection_new(GaimAccount *account); | |
93 | |
94 /** | |
95 * Destroys and closes a gaim connection. | |
96 * | |
97 * @param gc The gaim connection to destroy. | |
98 */ | |
99 void gaim_connection_destroy(GaimConnection *gc); | |
100 | |
101 /** | |
102 * Signs a connection on. | |
103 * | |
104 * @param gc The connection to sign on. | |
105 * | |
106 * @see gaim_connection_disconnect() | |
107 */ | |
108 void gaim_connection_connect(GaimConnection *gc); | |
109 | |
110 /** | |
111 * Signs a connection off. | |
112 * | |
113 * @param gc The connection to sign off. | |
114 * | |
115 * @see gaim_connection_connect() | |
116 */ | |
117 void gaim_connection_disconnect(GaimConnection *gc); | |
118 | |
119 /** | |
120 * Sets the connection state. | |
121 * | |
122 * @param gc The connection. | |
123 * @param state The connection state. | |
124 */ | |
125 void gaim_connection_set_state(GaimConnection *gc, GaimConnectionState state); | |
126 | |
127 /** | |
128 * Sets the connection's account. | |
129 * | |
130 * @param gc The connection. | |
131 * @param account The account. | |
132 */ | |
133 void gaim_connection_set_account(GaimConnection *gc, GaimAccount *account); | |
134 | |
135 /** | |
136 * Sets the connection's displayed name. | |
137 * | |
138 * @param gc The connection. | |
139 * @param name The displayed name. | |
140 */ | |
141 void gaim_connection_set_display_name(GaimConnection *gc, const char *name); | |
142 | |
143 /** | |
144 * Returns the connection state. | |
145 * | |
146 * @param gc The connection. | |
147 * | |
148 * @return The connection state. | |
149 */ | |
150 GaimConnectionState gaim_connection_get_state(const GaimConnection *gc); | |
151 | |
152 /** | |
153 * Returns the connection's account. | |
154 * | |
155 * @param gc The connection. | |
156 * | |
157 * @return The connection's account. | |
158 */ | |
159 GaimAccount *gaim_connection_get_account(const GaimConnection *gc); | |
160 | |
161 /** | |
162 * Returns the connection's displayed name. | |
163 * | |
164 * @param gc The connection. | |
165 * | |
166 * @return The connection's displayed name. | |
167 */ | |
168 const char *gaim_connection_get_display_name(const GaimConnection *gc); | |
169 | |
170 /** | |
171 * Updates the connection progress. | |
172 * | |
173 * @param gc The connection. | |
174 * @param text Information on the current step. | |
175 * @param step The current step. | |
176 * @param count The total number of steps. | |
177 */ | |
178 void gaim_connection_update_progress(GaimConnection *gc, const char *text, | |
179 size_t step, size_t count); | |
180 | |
181 /** | |
5571
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
182 * Displays a connection-specific notice. |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
183 * |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
184 * @param gc The connection. |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
185 * @param text The notice text. |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
186 */ |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
187 void gaim_connection_notice(GaimConnection *gc, const char *text); |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
188 |
113090160626
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
189 /** |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
190 * Closes a connection with an error. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
191 * |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
192 * @param gc The connection. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
193 * @param reason The error text. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
194 */ |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
195 void gaim_connection_error(GaimConnection *gc, const char *reason); |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
196 |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
197 /** |
5563 | 198 * Disconnects from all connections. |
199 */ | |
200 void gaim_connections_disconnect_all(void); | |
201 | |
202 /** | |
203 * Returns a list of all active connections. | |
204 * | |
205 * @return A list of all active connections. | |
206 */ | |
207 GList *gaim_connections_get_all(void); | |
208 | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
209 /** |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
210 * Returns a list of all connections in the process of connecting. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
211 * |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
212 * @return A list of connecting connections. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
213 */ |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
214 GList *gaim_connections_get_connecting(void); |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
215 |
5563 | 216 /**************************************************************************/ |
217 /** @name UI Operations API */ | |
218 /**************************************************************************/ | |
219 /*@{*/ | |
220 | |
221 /** | |
222 * Sets the UI operations structure to be used for connections. | |
223 * | |
224 * @param ops The UI operations structure. | |
225 */ | |
226 void gaim_set_connection_ui_ops(GaimConnectionUiOps *ops); | |
227 | |
228 /** | |
229 * Returns the UI operations structure used for connections. | |
230 * | |
231 * @return The UI operations structure in use. | |
232 */ | |
233 GaimConnectionUiOps *gaim_get_connection_ui_ops(void); | |
234 | |
235 /*@}*/ | |
236 | |
237 #endif /* _GAIM_CONNECTION_H_ */ |