1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/Frameworks/libpurple.framework/Versions/0.6.2/Headers/session.h Fri Aug 21 13:25:11 2009 -0700
1.3 @@ -0,0 +1,241 @@
1.4 +/**
1.5 + * @file session.h MSN session functions
1.6 + *
1.7 + * purple
1.8 + *
1.9 + * Purple is the legal property of its developers, whose names are too numerous
1.10 + * to list here. Please refer to the COPYRIGHT file distributed with this
1.11 + * source distribution.
1.12 + *
1.13 + * This program is free software; you can redistribute it and/or modify
1.14 + * it under the terms of the GNU General Public License as published by
1.15 + * the Free Software Foundation; either version 2 of the License, or
1.16 + * (at your option) any later version.
1.17 + *
1.18 + * This program is distributed in the hope that it will be useful,
1.19 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.20 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.21 + * GNU General Public License for more details.
1.22 + *
1.23 + * You should have received a copy of the GNU General Public License
1.24 + * along with this program; if not, write to the Free Software
1.25 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
1.26 + */
1.27 +#ifndef _MSN_SESSION_H_
1.28 +#define _MSN_SESSION_H_
1.29 +
1.30 +typedef struct _MsnSession MsnSession;
1.31 +
1.32 +#include "sslconn.h"
1.33 +
1.34 +#include "user.h"
1.35 +#include "slpcall.h"
1.36 +
1.37 +#include "notification.h"
1.38 +#include "switchboard.h"
1.39 +#include "group.h"
1.40 +
1.41 +#include "nexus.h"
1.42 +#include "httpconn.h"
1.43 +#include "oim.h"
1.44 +
1.45 +#include "userlist.h"
1.46 +#include "sync.h"
1.47 +
1.48 +/**
1.49 + * Types of errors.
1.50 + */
1.51 +typedef enum
1.52 +{
1.53 + MSN_ERROR_SERVCONN,
1.54 + MSN_ERROR_UNSUPPORTED_PROTOCOL,
1.55 + MSN_ERROR_HTTP_MALFORMED,
1.56 + MSN_ERROR_AUTH,
1.57 + MSN_ERROR_BAD_BLIST,
1.58 + MSN_ERROR_SIGN_OTHER,
1.59 + MSN_ERROR_SERV_DOWN,
1.60 + MSN_ERROR_SERV_UNAVAILABLE
1.61 +
1.62 +} MsnErrorType;
1.63 +
1.64 +/**
1.65 + * Login steps.
1.66 + */
1.67 +typedef enum
1.68 +{
1.69 + MSN_LOGIN_STEP_START,
1.70 + MSN_LOGIN_STEP_HANDSHAKE,
1.71 + MSN_LOGIN_STEP_TRANSFER,
1.72 + MSN_LOGIN_STEP_HANDSHAKE2,
1.73 + MSN_LOGIN_STEP_AUTH_START,
1.74 + MSN_LOGIN_STEP_AUTH,
1.75 + MSN_LOGIN_STEP_GET_COOKIE,
1.76 + MSN_LOGIN_STEP_AUTH_END,
1.77 + MSN_LOGIN_STEP_SYN,
1.78 + MSN_LOGIN_STEP_END
1.79 +
1.80 +} MsnLoginStep;
1.81 +
1.82 +#define MSN_LOGIN_STEPS MSN_LOGIN_STEP_END
1.83 +
1.84 +struct _MsnSession
1.85 +{
1.86 + PurpleAccount *account;
1.87 + MsnUser *user;
1.88 +
1.89 + guint protocol_ver;
1.90 +
1.91 + MsnLoginStep login_step; /**< The current step in the login process. */
1.92 +
1.93 + gboolean connected;
1.94 + gboolean logged_in; /**< A temporal flag to ignore local buddy list adds. */
1.95 + int adl_fqy; /**< A count of ADL/FQY so status is only changed once. */
1.96 + gboolean destroying; /**< A flag that states if the session is being destroyed. */
1.97 + gboolean http_method;
1.98 +
1.99 + MsnNotification *notification;
1.100 + MsnNexus *nexus;
1.101 + MsnOim *oim;
1.102 + MsnSync *sync;
1.103 + MsnUserList *userlist;
1.104 + char *abch_cachekey;
1.105 +
1.106 + int servconns_count; /**< The count of server connections. */
1.107 + GList *switches; /**< The list of all the switchboards. */
1.108 + GList *slplinks; /**< The list of all the slplinks. */
1.109 +
1.110 + /*psm info*/
1.111 + char *psm;
1.112 +
1.113 +#if 0
1.114 + char *blocked_text;
1.115 +#endif
1.116 +
1.117 + struct
1.118 + {
1.119 + char *kv;
1.120 + char *sid;
1.121 + char *mspauth;
1.122 + unsigned long sl;
1.123 + char *client_ip;
1.124 + int client_port;
1.125 + char *mail_url;
1.126 + gulong mail_timestamp;
1.127 + gboolean email_enabled;
1.128 + } passport_info;
1.129 +
1.130 + GHashTable *soap_table;
1.131 + guint soap_cleanup_handle;
1.132 +};
1.133 +
1.134 +/**
1.135 + * Creates an MSN session.
1.136 + *
1.137 + * @param account The account.
1.138 + *
1.139 + * @return The new MSN session.
1.140 + */
1.141 +MsnSession *msn_session_new(PurpleAccount *account);
1.142 +
1.143 +/**
1.144 + * Destroys an MSN session.
1.145 + *
1.146 + * @param session The MSN session to destroy.
1.147 + */
1.148 +void msn_session_destroy(MsnSession *session);
1.149 +
1.150 +/**
1.151 + * Connects to and initiates an MSN session.
1.152 + *
1.153 + * @param session The MSN session.
1.154 + * @param host The dispatch server host.
1.155 + * @param port The dispatch server port.
1.156 + * @param http_method Whether to use or not http_method.
1.157 + *
1.158 + * @return @c TRUE on success, @c FALSE on failure.
1.159 + */
1.160 +gboolean msn_session_connect(MsnSession *session,
1.161 + const char *host, int port,
1.162 + gboolean http_method);
1.163 +
1.164 +/**
1.165 + * Disconnects from an MSN session.
1.166 + *
1.167 + * @param session The MSN session.
1.168 + */
1.169 +void msn_session_disconnect(MsnSession *session);
1.170 +
1.171 + /**
1.172 + * Finds a switchboard with the given username.
1.173 + *
1.174 + * @param session The MSN session.
1.175 + * @param username The username to search for.
1.176 + *
1.177 + * @return The switchboard, if found.
1.178 + */
1.179 +MsnSwitchBoard *msn_session_find_swboard(MsnSession *session,
1.180 + const char *username);
1.181 +
1.182 + /**
1.183 + * Finds a switchboard with the given conversation.
1.184 + *
1.185 + * @param session The MSN session.
1.186 + * @param conv The conversation to search for.
1.187 + *
1.188 + * @return The switchboard, if found.
1.189 + */
1.190 +MsnSwitchBoard *msn_session_find_swboard_with_conv(MsnSession *session,
1.191 + PurpleConversation *conv);
1.192 +/**
1.193 + * Finds a switchboard with the given chat ID.
1.194 + *
1.195 + * @param session The MSN session.
1.196 + * @param chat_id The chat ID to search for.
1.197 + *
1.198 + * @return The switchboard, if found.
1.199 + */
1.200 +MsnSwitchBoard *msn_session_find_swboard_with_id(const MsnSession *session,
1.201 + int chat_id);
1.202 +
1.203 +/**
1.204 + * Returns a switchboard to communicate with certain username.
1.205 + *
1.206 + * @param session The MSN session.
1.207 + * @param username The username to search for.
1.208 + * @param flag The flag of the switchboard
1.209 + *
1.210 + * @return The switchboard.
1.211 + */
1.212 +MsnSwitchBoard *msn_session_get_swboard(MsnSession *session,
1.213 + const char *username, MsnSBFlag flag);
1.214 +
1.215 +/**
1.216 + * Sets an error for the MSN session.
1.217 + *
1.218 + * @param session The MSN session.
1.219 + * @param error The error.
1.220 + * @param info Extra information.
1.221 + */
1.222 +void msn_session_set_error(MsnSession *session, MsnErrorType error,
1.223 + const char *info);
1.224 +
1.225 +/**
1.226 + * Sets the current step in the login proccess.
1.227 + *
1.228 + * @param session The MSN session.
1.229 + * @param step The current step.
1.230 + */
1.231 +void msn_session_set_login_step(MsnSession *session, MsnLoginStep step);
1.232 +
1.233 +/**
1.234 + * Finish the login proccess.
1.235 + *
1.236 + * @param session The MSN session.
1.237 + */
1.238 +void msn_session_finish_login(MsnSession *session);
1.239 +
1.240 +/*post message to User*/
1.241 +void msn_session_report_user(MsnSession *session,const char *passport,
1.242 + const char *msg,PurpleMessageFlags flags);
1.243 +
1.244 +#endif /* _MSN_SESSION_H_ */