Mercurial > pidgin.yaz
annotate src/protocols/msn/session.h @ 13500:e66846dafeca
[gaim-migrate @ 15876]
making grim happy
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Mon, 13 Mar 2006 22:08:53 +0000 |
parents | 442b23efba54 |
children | bc30c6270d9f |
rev | line source |
---|---|
5309 | 1 /** |
2 * @file session.h MSN session functions | |
3 * | |
4 * gaim | |
5 * | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
6 * Gaim is the legal property of its developers, whose names are too numerous |
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
8 * source distribution. |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
9 * |
5309 | 10 * This program is free software; you can redistribute it and/or modify |
11 * it under the terms of the GNU General Public License as published by | |
12 * the Free Software Foundation; either version 2 of the License, or | |
13 * (at your option) any later version. | |
14 * | |
15 * This program is distributed in the hope that it will be useful, | |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 * GNU General Public License for more details. | |
19 * | |
20 * You should have received a copy of the GNU General Public License | |
21 * along with this program; if not, write to the Free Software | |
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
23 */ | |
24 #ifndef _MSN_SESSION_H_ | |
25 #define _MSN_SESSION_H_ | |
26 | |
27 typedef struct _MsnSession MsnSession; | |
28 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
29 #include "sslconn.h" |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
30 |
13125 | 31 #include "user.h" |
32 #include "slpcall.h" | |
33 | |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
34 #include "notification.h" |
5309 | 35 #include "switchboard.h" |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
36 #include "group.h" |
8171
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
7631
diff
changeset
|
37 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
38 #include "cmdproc.h" |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
39 #include "nexus.h" |
10463 | 40 #include "httpconn.h" |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
41 |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
42 #include "userlist.h" |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
43 #include "sync.h" |
5309 | 44 |
10481 | 45 /** |
46 * Types of errors. | |
47 */ | |
48 typedef enum | |
49 { | |
50 MSN_ERROR_SERVCONN, | |
10519 | 51 MSN_ERROR_UNSUPPORTED_PROTOCOL, |
10481 | 52 MSN_ERROR_HTTP_MALFORMED, |
53 MSN_ERROR_AUTH, | |
54 MSN_ERROR_BAD_BLIST, | |
55 MSN_ERROR_SIGN_OTHER, | |
10568 | 56 MSN_ERROR_SERV_DOWN, |
57 MSN_ERROR_SERV_UNAVAILABLE | |
10481 | 58 |
59 } MsnErrorType; | |
60 | |
61 /** | |
62 * Login steps. | |
63 */ | |
64 typedef enum | |
65 { | |
66 MSN_LOGIN_STEP_START, | |
67 MSN_LOGIN_STEP_HANDSHAKE, | |
68 MSN_LOGIN_STEP_TRANSFER, | |
10514 | 69 MSN_LOGIN_STEP_HANDSHAKE2, |
10481 | 70 MSN_LOGIN_STEP_AUTH_START, |
71 MSN_LOGIN_STEP_AUTH, | |
72 MSN_LOGIN_STEP_GET_COOKIE, | |
73 MSN_LOGIN_STEP_AUTH_END, | |
74 MSN_LOGIN_STEP_SYN, | |
75 MSN_LOGIN_STEP_END | |
76 | |
77 } MsnLoginStep; | |
78 | |
79 #define MSN_LOGIN_STEPS MSN_LOGIN_STEP_END | |
80 | |
5309 | 81 struct _MsnSession |
82 { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
83 GaimAccount *account; |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
84 MsnUser *user; |
5309 | 85 |
7631 | 86 guint protocol_ver; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
87 |
10481 | 88 MsnLoginStep login_step; /**< The current step in the login process. */ |
5309 | 89 |
90 gboolean connected; | |
10296 | 91 gboolean logged_in; /**< A temporal flag to ignore local buddy list adds. */ |
92 gboolean destroying; /**< A flag that states if the session is being destroyed. */ | |
10481 | 93 gboolean http_method; |
5309 | 94 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
95 MsnNotification *notification; |
8171
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
7631
diff
changeset
|
96 MsnNexus *nexus; |
10481 | 97 MsnSync *sync; |
7288
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
98 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
99 MsnUserList *userlist; |
5309 | 100 |
10403 | 101 int servconns_count; /**< The count of server connections. */ |
102 GList *switches; /**< The list of all the switchboards. */ | |
103 GList *directconns; /**< The list of all the directconnections. */ | |
10481 | 104 GList *slplinks; /**< The list of all the slplinks. */ |
5309 | 105 |
10481 | 106 int conv_seq; /**< The current conversation sequence number. */ |
5309 | 107 |
108 struct | |
109 { | |
110 char *kv; | |
111 char *sid; | |
112 char *mspauth; | |
113 unsigned long sl; | |
114 char *file; | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
115 char *client_ip; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
116 int client_port; |
5309 | 117 |
118 } passport_info; | |
119 }; | |
120 | |
121 /** | |
122 * Creates an MSN session. | |
123 * | |
124 * @param account The account. | |
125 * | |
126 * @return The new MSN session. | |
127 */ | |
10481 | 128 MsnSession *msn_session_new(GaimAccount *account); |
5309 | 129 |
130 /** | |
131 * Destroys an MSN session. | |
132 * | |
133 * @param session The MSN session to destroy. | |
134 */ | |
135 void msn_session_destroy(MsnSession *session); | |
136 | |
137 /** | |
138 * Connects to and initiates an MSN session. | |
139 * | |
10481 | 140 * @param session The MSN session. |
141 * @param host The dispatch server host. | |
142 * @param port The dispatch server port. | |
143 * @param http_method Whether to use or not http_method. | |
5309 | 144 * |
145 * @return @c TRUE on success, @c FALSE on failure. | |
146 */ | |
10481 | 147 gboolean msn_session_connect(MsnSession *session, |
148 const char *host, int port, | |
149 gboolean http_method); | |
5309 | 150 |
151 /** | |
152 * Disconnects from an MSN session. | |
153 * | |
154 * @param session The MSN session. | |
155 */ | |
156 void msn_session_disconnect(MsnSession *session); | |
157 | |
10602 | 158 /** |
159 * Finds a switchboard with the given username. | |
160 * | |
161 * @param session The MSN session. | |
162 * @param username The username to search for. | |
163 * | |
164 * @return The switchboard, if found. | |
165 */ | |
166 MsnSwitchBoard *msn_session_find_swboard(MsnSession *session, | |
10621 | 167 const char *username); |
10602 | 168 |
10621 | 169 /** |
170 * Finds a switchboard with the given conversation. | |
171 * | |
172 * @param session The MSN session. | |
173 * @param conv The conversation to search for. | |
174 * | |
175 * @return The switchboard, if found. | |
176 */ | |
177 MsnSwitchBoard *msn_session_find_swboard_with_conv(MsnSession *session, | |
178 GaimConversation *conv); | |
5309 | 179 /** |
180 * Finds a switchboard with the given chat ID. | |
181 * | |
182 * @param session The MSN session. | |
183 * @param chat_id The chat ID to search for. | |
184 * | |
185 * @return The switchboard, if found. | |
186 */ | |
10602 | 187 MsnSwitchBoard *msn_session_find_swboard_with_id(const MsnSession *session, |
10621 | 188 int chat_id); |
5309 | 189 |
10602 | 190 /** |
191 * Returns a switchboard to communicate with certain username. | |
192 * | |
193 * @param session The MSN session. | |
194 * @param username The username to search for. | |
10773 | 195 * @param flag The flag of the switchboard |
10602 | 196 * |
197 * @return The switchboard. | |
198 */ | |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
199 MsnSwitchBoard *msn_session_get_swboard(MsnSession *session, |
10773 | 200 const char *username, MsnSBFlag flag); |
5309 | 201 |
10481 | 202 /** |
203 * Sets an error for the MSN session. | |
204 * | |
205 * @param session The MSN session. | |
206 * @param error The error. | |
207 * @param info Extra information. | |
208 */ | |
209 void msn_session_set_error(MsnSession *session, MsnErrorType error, | |
210 const char *info); | |
211 | |
212 /** | |
213 * Sets the current step in the login proccess. | |
214 * | |
215 * @param session The MSN session. | |
216 * @param step The current step. | |
217 */ | |
218 void msn_session_set_login_step(MsnSession *session, MsnLoginStep step); | |
219 | |
220 /** | |
221 * Finish the login proccess. | |
222 * | |
223 * @param session The MSN session. | |
224 */ | |
10044 | 225 void msn_session_finish_login(MsnSession *session); |
226 | |
5309 | 227 #endif /* _MSN_SESSION_H_ */ |