Mercurial > pidgin
annotate src/protocols/msn/session.h @ 19841:6fc33ac621d9
[gaim-migrate @ 17483]
add some function prototype
committer: Ethan Blanton <elb@pidgin.im>
author | Ma Yuan <mayuan2006@gmail.com> |
---|---|
date | Sun, 15 Oct 2006 13:26:34 +0000 |
parents | 5568b3ac6fce |
children |
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" |
19784 | 41 #include "contact.h" |
19788 | 42 #include "oim.h" |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
43 |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
44 #include "userlist.h" |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
45 #include "sync.h" |
5309 | 46 |
10481 | 47 /** |
48 * Types of errors. | |
49 */ | |
50 typedef enum | |
51 { | |
52 MSN_ERROR_SERVCONN, | |
10519 | 53 MSN_ERROR_UNSUPPORTED_PROTOCOL, |
10481 | 54 MSN_ERROR_HTTP_MALFORMED, |
55 MSN_ERROR_AUTH, | |
56 MSN_ERROR_BAD_BLIST, | |
57 MSN_ERROR_SIGN_OTHER, | |
10568 | 58 MSN_ERROR_SERV_DOWN, |
59 MSN_ERROR_SERV_UNAVAILABLE | |
10481 | 60 |
61 } MsnErrorType; | |
62 | |
63 /** | |
64 * Login steps. | |
65 */ | |
66 typedef enum | |
67 { | |
68 MSN_LOGIN_STEP_START, | |
69 MSN_LOGIN_STEP_HANDSHAKE, | |
70 MSN_LOGIN_STEP_TRANSFER, | |
10514 | 71 MSN_LOGIN_STEP_HANDSHAKE2, |
10481 | 72 MSN_LOGIN_STEP_AUTH_START, |
73 MSN_LOGIN_STEP_AUTH, | |
74 MSN_LOGIN_STEP_GET_COOKIE, | |
75 MSN_LOGIN_STEP_AUTH_END, | |
76 MSN_LOGIN_STEP_SYN, | |
77 MSN_LOGIN_STEP_END | |
78 | |
79 } MsnLoginStep; | |
80 | |
81 #define MSN_LOGIN_STEPS MSN_LOGIN_STEP_END | |
82 | |
5309 | 83 struct _MsnSession |
84 { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
85 GaimAccount *account; |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
86 MsnUser *user; |
5309 | 87 |
7631 | 88 guint protocol_ver; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
89 |
10481 | 90 MsnLoginStep login_step; /**< The current step in the login process. */ |
5309 | 91 |
92 gboolean connected; | |
10296 | 93 gboolean logged_in; /**< A temporal flag to ignore local buddy list adds. */ |
94 gboolean destroying; /**< A flag that states if the session is being destroyed. */ | |
10481 | 95 gboolean http_method; |
5309 | 96 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
97 MsnNotification *notification; |
8171
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
7631
diff
changeset
|
98 MsnNexus *nexus; |
19784 | 99 MsnContact *contact; |
19788 | 100 MsnOim *oim; |
10481 | 101 MsnSync *sync; |
7288
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
102 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
103 MsnUserList *userlist; |
5309 | 104 |
10403 | 105 int servconns_count; /**< The count of server connections. */ |
106 GList *switches; /**< The list of all the switchboards. */ | |
107 GList *directconns; /**< The list of all the directconnections. */ | |
10481 | 108 GList *slplinks; /**< The list of all the slplinks. */ |
5309 | 109 |
10481 | 110 int conv_seq; /**< The current conversation sequence number. */ |
5309 | 111 |
19786 | 112 /*psm info*/ |
113 char *psm; | |
19840 | 114 |
115 /*first blist contact node*/ | |
116 GaimBlistNode *bnode; | |
117 | |
5309 | 118 struct |
119 { | |
19784 | 120 /*t and p, get via USR TWN*/ |
121 char *t; | |
122 char *p; | |
123 | |
5309 | 124 char *kv; |
125 char *sid; | |
126 char *mspauth; | |
127 unsigned long sl; | |
128 char *file; | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
129 char *client_ip; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
130 int client_port; |
5309 | 131 } passport_info; |
132 }; | |
133 | |
134 /** | |
135 * Creates an MSN session. | |
136 * | |
137 * @param account The account. | |
138 * | |
139 * @return The new MSN session. | |
140 */ | |
10481 | 141 MsnSession *msn_session_new(GaimAccount *account); |
5309 | 142 |
143 /** | |
144 * Destroys an MSN session. | |
145 * | |
146 * @param session The MSN session to destroy. | |
147 */ | |
148 void msn_session_destroy(MsnSession *session); | |
149 | |
150 /** | |
151 * Connects to and initiates an MSN session. | |
152 * | |
10481 | 153 * @param session The MSN session. |
154 * @param host The dispatch server host. | |
155 * @param port The dispatch server port. | |
156 * @param http_method Whether to use or not http_method. | |
5309 | 157 * |
158 * @return @c TRUE on success, @c FALSE on failure. | |
159 */ | |
10481 | 160 gboolean msn_session_connect(MsnSession *session, |
161 const char *host, int port, | |
162 gboolean http_method); | |
5309 | 163 |
164 /** | |
165 * Disconnects from an MSN session. | |
166 * | |
167 * @param session The MSN session. | |
168 */ | |
169 void msn_session_disconnect(MsnSession *session); | |
170 | |
10602 | 171 /** |
172 * Finds a switchboard with the given username. | |
173 * | |
174 * @param session The MSN session. | |
175 * @param username The username to search for. | |
176 * | |
177 * @return The switchboard, if found. | |
178 */ | |
179 MsnSwitchBoard *msn_session_find_swboard(MsnSession *session, | |
10621 | 180 const char *username); |
10602 | 181 |
10621 | 182 /** |
183 * Finds a switchboard with the given conversation. | |
184 * | |
185 * @param session The MSN session. | |
186 * @param conv The conversation to search for. | |
187 * | |
188 * @return The switchboard, if found. | |
189 */ | |
190 MsnSwitchBoard *msn_session_find_swboard_with_conv(MsnSession *session, | |
191 GaimConversation *conv); | |
5309 | 192 /** |
193 * Finds a switchboard with the given chat ID. | |
194 * | |
195 * @param session The MSN session. | |
196 * @param chat_id The chat ID to search for. | |
197 * | |
198 * @return The switchboard, if found. | |
199 */ | |
10602 | 200 MsnSwitchBoard *msn_session_find_swboard_with_id(const MsnSession *session, |
10621 | 201 int chat_id); |
5309 | 202 |
10602 | 203 /** |
204 * Returns a switchboard to communicate with certain username. | |
205 * | |
206 * @param session The MSN session. | |
207 * @param username The username to search for. | |
10773 | 208 * @param flag The flag of the switchboard |
10602 | 209 * |
210 * @return The switchboard. | |
211 */ | |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
212 MsnSwitchBoard *msn_session_get_swboard(MsnSession *session, |
10773 | 213 const char *username, MsnSBFlag flag); |
5309 | 214 |
10481 | 215 /** |
216 * Sets an error for the MSN session. | |
217 * | |
218 * @param session The MSN session. | |
219 * @param error The error. | |
220 * @param info Extra information. | |
221 */ | |
222 void msn_session_set_error(MsnSession *session, MsnErrorType error, | |
223 const char *info); | |
224 | |
225 /** | |
226 * Sets the current step in the login proccess. | |
227 * | |
228 * @param session The MSN session. | |
229 * @param step The current step. | |
230 */ | |
231 void msn_session_set_login_step(MsnSession *session, MsnLoginStep step); | |
232 | |
233 /** | |
234 * Finish the login proccess. | |
235 * | |
236 * @param session The MSN session. | |
237 */ | |
10044 | 238 void msn_session_finish_login(MsnSession *session); |
239 | |
19801 | 240 /*get conversation via session, |
241 * If has one, return that,else create a new one; | |
242 */ | |
243 GaimConversation *msn_session_get_conv(MsnSession *session,const char *passport); | |
244 | |
245 /*post message to User*/ | |
246 void msn_session_report_user(MsnSession *session,const char *passport, | |
247 char *msg,GaimMessageFlags flags); | |
19841 | 248 |
249 void msn_session_set_bnode(MsnSession *session); | |
250 | |
251 GaimBlistNode *msn_session_get_bnode(MsnSession *session); | |
252 | |
5309 | 253 #endif /* _MSN_SESSION_H_ */ |