2 * @file session.h MSN session functions
6 * Purple 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
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
24 #ifndef _MSN_SESSION_H_
25 #define _MSN_SESSION_H_
27 typedef struct _MsnSession MsnSession;
34 #include "notification.h"
35 #include "switchboard.h"
51 MSN_ERROR_UNSUPPORTED_PROTOCOL,
52 MSN_ERROR_HTTP_MALFORMED,
57 MSN_ERROR_SERV_UNAVAILABLE
67 MSN_LOGIN_STEP_HANDSHAKE,
68 MSN_LOGIN_STEP_TRANSFER,
69 MSN_LOGIN_STEP_HANDSHAKE2,
70 MSN_LOGIN_STEP_AUTH_START,
72 MSN_LOGIN_STEP_GET_COOKIE,
73 MSN_LOGIN_STEP_AUTH_END,
79 #define MSN_LOGIN_STEPS MSN_LOGIN_STEP_END
83 PurpleAccount *account;
88 MsnLoginStep login_step; /**< The current step in the login process. */
91 gboolean logged_in; /**< A temporal flag to ignore local buddy list adds. */
92 int adl_fqy; /**< A count of ADL/FQY so status is only changed once. */
93 gboolean destroying; /**< A flag that states if the session is being destroyed. */
96 MsnNotification *notification;
100 MsnUserList *userlist;
103 int servconns_count; /**< The count of server connections. */
104 GList *switches; /**< The list of all the switchboards. */
105 GList *slplinks; /**< The list of all the slplinks. */
123 gulong mail_timestamp;
124 gboolean email_enabled;
127 GHashTable *soap_table;
128 guint soap_cleanup_handle;
132 * Creates an MSN session.
134 * @param account The account.
136 * @return The new MSN session.
138 MsnSession *msn_session_new(PurpleAccount *account);
141 * Destroys an MSN session.
143 * @param session The MSN session to destroy.
145 void msn_session_destroy(MsnSession *session);
148 * Connects to and initiates an MSN session.
150 * @param session The MSN session.
151 * @param host The dispatch server host.
152 * @param port The dispatch server port.
153 * @param http_method Whether to use or not http_method.
155 * @return @c TRUE on success, @c FALSE on failure.
157 gboolean msn_session_connect(MsnSession *session,
158 const char *host, int port,
159 gboolean http_method);
162 * Disconnects from an MSN session.
164 * @param session The MSN session.
166 void msn_session_disconnect(MsnSession *session);
169 * Finds a switchboard with the given username.
171 * @param session The MSN session.
172 * @param username The username to search for.
174 * @return The switchboard, if found.
176 MsnSwitchBoard *msn_session_find_swboard(MsnSession *session,
177 const char *username);
180 * Finds a switchboard with the given conversation.
182 * @param session The MSN session.
183 * @param conv The conversation to search for.
185 * @return The switchboard, if found.
187 MsnSwitchBoard *msn_session_find_swboard_with_conv(MsnSession *session,
188 PurpleConversation *conv);
190 * Finds a switchboard with the given chat ID.
192 * @param session The MSN session.
193 * @param chat_id The chat ID to search for.
195 * @return The switchboard, if found.
197 MsnSwitchBoard *msn_session_find_swboard_with_id(const MsnSession *session,
201 * Returns a switchboard to communicate with certain username.
203 * @param session The MSN session.
204 * @param username The username to search for.
205 * @param flag The flag of the switchboard
207 * @return The switchboard.
209 MsnSwitchBoard *msn_session_get_swboard(MsnSession *session,
210 const char *username, MsnSBFlag flag);
213 * Sets an error for the MSN session.
215 * @param session The MSN session.
216 * @param error The error.
217 * @param info Extra information.
219 void msn_session_set_error(MsnSession *session, MsnErrorType error,
223 * Sets the current step in the login proccess.
225 * @param session The MSN session.
226 * @param step The current step.
228 void msn_session_set_login_step(MsnSession *session, MsnLoginStep step);
231 * Finish the login proccess.
233 * @param session The MSN session.
235 void msn_session_finish_login(MsnSession *session);
237 /*post message to User*/
238 void msn_session_report_user(MsnSession *session,const char *passport,
239 const char *msg,PurpleMessageFlags flags);
241 #endif /* _MSN_SESSION_H_ */