Mercurial > pidgin.yaz
annotate libgaim/protocols/msn/session.h @ 20392:9ba7dee775e1
The first msn-p13-merge-head.diff.gz from SF Patch #1621854 from Ka-Hing Cheung.
"uploaded a diff, this diff is unchanged from the last tarball that I
previously uploaded, except that it's against HEAD. This should be a little
easier for most people."
(This was apparently msn-p13-merge-head.diff, which SourceForge didn't allow to
be uploaded.)
PLUS
"Updated the diff with basically no change, except with simom's icon fix.
The previous diff was broken because some of the files were not added"
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sun, 15 Apr 2007 03:01:41 +0000 |
parents | e354528c4163 |
children |
rev | line source |
---|---|
14192 | 1 /** |
2 * @file session.h MSN session functions | |
3 * | |
4 * gaim | |
5 * | |
6 * Gaim is the legal property of its developers, whose names are too numerous | |
7 * to list here. Please refer to the COPYRIGHT file distributed with this | |
8 * source distribution. | |
9 * | |
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 | |
29 #include "sslconn.h" | |
30 | |
31 #include "user.h" | |
32 #include "slpcall.h" | |
33 | |
34 #include "notification.h" | |
35 #include "switchboard.h" | |
36 #include "group.h" | |
37 | |
38 #include "cmdproc.h" | |
39 #include "nexus.h" | |
40 #include "httpconn.h" | |
20389
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
41 #include "contact.h" |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
42 #include "oim.h" |
14192 | 43 |
44 #include "userlist.h" | |
45 #include "sync.h" | |
46 | |
47 /** | |
48 * Types of errors. | |
49 */ | |
50 typedef enum | |
51 { | |
52 MSN_ERROR_SERVCONN, | |
53 MSN_ERROR_UNSUPPORTED_PROTOCOL, | |
54 MSN_ERROR_HTTP_MALFORMED, | |
55 MSN_ERROR_AUTH, | |
56 MSN_ERROR_BAD_BLIST, | |
57 MSN_ERROR_SIGN_OTHER, | |
58 MSN_ERROR_SERV_DOWN, | |
59 MSN_ERROR_SERV_UNAVAILABLE | |
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, | |
71 MSN_LOGIN_STEP_HANDSHAKE2, | |
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 | |
83 struct _MsnSession | |
84 { | |
85 GaimAccount *account; | |
86 MsnUser *user; | |
87 | |
88 guint protocol_ver; | |
89 | |
90 MsnLoginStep login_step; /**< The current step in the login process. */ | |
91 | |
92 gboolean connected; | |
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. */ | |
95 gboolean http_method; | |
96 | |
97 MsnNotification *notification; | |
98 MsnNexus *nexus; | |
20389
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
99 MsnContact *contact; |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
100 MsnOim *oim; |
14192 | 101 MsnSync *sync; |
102 | |
103 MsnUserList *userlist; | |
104 | |
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. */ | |
108 GList *slplinks; /**< The list of all the slplinks. */ | |
109 | |
110 int conv_seq; /**< The current conversation sequence number. */ | |
111 | |
20389
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
112 /*psm info*/ |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
113 char *psm; |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
114 |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
115 /*first blist contact node*/ |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
116 GaimBlistNode *bnode; |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
117 |
14192 | 118 struct |
119 { | |
20389
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
120 /*t and p, get via USR TWN*/ |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
121 char *t; |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
122 char *p; |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
123 |
14192 | 124 char *kv; |
125 char *sid; | |
126 char *mspauth; | |
127 unsigned long sl; | |
128 char *file; | |
129 char *client_ip; | |
130 int client_port; | |
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 */ | |
141 MsnSession *msn_session_new(GaimAccount *account); | |
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 * | |
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. | |
157 * | |
158 * @return @c TRUE on success, @c FALSE on failure. | |
159 */ | |
160 gboolean msn_session_connect(MsnSession *session, | |
161 const char *host, int port, | |
162 gboolean http_method); | |
163 | |
164 /** | |
165 * Disconnects from an MSN session. | |
166 * | |
167 * @param session The MSN session. | |
168 */ | |
169 void msn_session_disconnect(MsnSession *session); | |
170 | |
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, | |
180 const char *username); | |
181 | |
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); | |
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 */ | |
200 MsnSwitchBoard *msn_session_find_swboard_with_id(const MsnSession *session, | |
201 int chat_id); | |
202 | |
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. | |
208 * @param flag The flag of the switchboard | |
209 * | |
210 * @return The switchboard. | |
211 */ | |
212 MsnSwitchBoard *msn_session_get_swboard(MsnSession *session, | |
213 const char *username, MsnSBFlag flag); | |
214 | |
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 */ | |
238 void msn_session_finish_login(MsnSession *session); | |
239 | |
20389
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
240 /*get conversation via session, |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
241 * If has one, return that,else create a new one; |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
242 */ |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
243 GaimConversation *msn_session_get_conv(MsnSession *session,const char *passport); |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
244 |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
245 /*post message to User*/ |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
246 void msn_session_report_user(MsnSession *session,const char *passport, |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
247 char *msg,GaimMessageFlags flags); |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
248 |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
249 void msn_session_set_bnode(MsnSession *session); |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
250 |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
251 GaimBlistNode *msn_session_get_bnode(MsnSession *session); |
e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
Richard Laager <rlaager@wiktel.com>
parents:
14192
diff
changeset
|
252 |
14192 | 253 #endif /* _MSN_SESSION_H_ */ |