Mercurial > pidgin
comparison src/protocols/msn/session.h @ 10481:bcfea6c3d5c9
[gaim-migrate @ 11769]
Patch 1093958 from Felipe Contreras. It fixes stuff.
I also made some tweaks to make valgrind a bit happier.
committer: Tailor Script <tailor@pidgin.im>
| author | Stu Tomlinson <stu@nosnilmot.com> |
|---|---|
| date | Fri, 07 Jan 2005 02:48:33 +0000 |
| parents | 9bed28273ec7 |
| children | 8f1316d77315 |
comparison
equal
deleted
inserted
replaced
| 10480:8e0a91d11362 | 10481:bcfea6c3d5c9 |
|---|---|
| 38 #include "httpconn.h" | 38 #include "httpconn.h" |
| 39 | 39 |
| 40 #include "userlist.h" | 40 #include "userlist.h" |
| 41 #include "sync.h" | 41 #include "sync.h" |
| 42 | 42 |
| 43 /** | |
| 44 * Types of errors. | |
| 45 */ | |
| 46 typedef enum | |
| 47 { | |
| 48 MSN_ERROR_SERVCONN, | |
| 49 MSN_ERROR_UNSUPORTED_PROTOCOL, | |
| 50 MSN_ERROR_HTTP_MALFORMED, | |
| 51 MSN_ERROR_AUTH, | |
| 52 MSN_ERROR_BAD_BLIST, | |
| 53 MSN_ERROR_SIGN_OTHER, | |
| 54 MSN_ERROR_SERV_DOWN | |
| 55 | |
| 56 } MsnErrorType; | |
| 57 | |
| 58 /** | |
| 59 * Login steps. | |
| 60 */ | |
| 61 typedef enum | |
| 62 { | |
| 63 MSN_LOGIN_STEP_START, | |
| 64 MSN_LOGIN_STEP_HANDSHAKE, | |
| 65 MSN_LOGIN_STEP_TRANSFER, | |
| 66 MSN_LOGIN_STEP_AUTH_START, | |
| 67 MSN_LOGIN_STEP_AUTH, | |
| 68 MSN_LOGIN_STEP_GET_COOKIE, | |
| 69 MSN_LOGIN_STEP_AUTH_END, | |
| 70 MSN_LOGIN_STEP_SYN, | |
| 71 MSN_LOGIN_STEP_END | |
| 72 | |
| 73 } MsnLoginStep; | |
| 74 | |
| 75 #define MSN_LOGIN_STEPS MSN_LOGIN_STEP_END | |
| 76 | |
| 43 struct _MsnSession | 77 struct _MsnSession |
| 44 { | 78 { |
| 45 GaimAccount *account; | 79 GaimAccount *account; |
| 46 MsnUser *user; | 80 MsnUser *user; |
| 47 int state; | 81 int state; |
| 48 | 82 |
| 49 guint protocol_ver; | 83 guint protocol_ver; |
| 50 | 84 |
| 51 char *dispatch_host; | 85 MsnLoginStep login_step; /**< The current step in the login process. */ |
| 52 int dispatch_port; | |
| 53 | 86 |
| 54 gboolean connected; | 87 gboolean connected; |
| 55 gboolean logged_in; /**< A temporal flag to ignore local buddy list adds. */ | 88 gboolean logged_in; /**< A temporal flag to ignore local buddy list adds. */ |
| 56 gboolean destroying; /**< A flag that states if the session is being destroyed. */ | 89 gboolean destroying; /**< A flag that states if the session is being destroyed. */ |
| 90 gboolean http_method; | |
| 57 | 91 |
| 58 MsnNotification *notification; | 92 MsnNotification *notification; |
| 59 MsnNexus *nexus; | 93 MsnNexus *nexus; |
| 60 | 94 MsnSync *sync; |
| 61 gboolean http_method; | |
| 62 gint http_poll_timer; | |
| 63 | 95 |
| 64 MsnUserList *userlist; | 96 MsnUserList *userlist; |
| 65 MsnUserList *sync_userlist; | 97 MsnUserList *sync_userlist; |
| 66 | 98 |
| 67 int servconns_count; /**< The count of server connections. */ | 99 int servconns_count; /**< The count of server connections. */ |
| 68 GList *switches; /**< The list of all the switchboards. */ | 100 GList *switches; /**< The list of all the switchboards. */ |
| 69 GList *directconns; /**< The list of all the directconnections. */ | 101 GList *directconns; /**< The list of all the directconnections. */ |
| 102 GList *slplinks; /**< The list of all the slplinks. */ | |
| 70 | 103 |
| 71 int conv_seq; | 104 int conv_seq; /**< The current conversation sequence number. */ |
| 72 | 105 |
| 73 struct | 106 struct |
| 74 { | 107 { |
| 75 char *kv; | 108 char *kv; |
| 76 char *sid; | 109 char *sid; |
| 79 char *file; | 112 char *file; |
| 80 char *client_ip; | 113 char *client_ip; |
| 81 int client_port; | 114 int client_port; |
| 82 | 115 |
| 83 } passport_info; | 116 } passport_info; |
| 84 | |
| 85 /* You have no idea how much I hate all that is below. */ | |
| 86 /* shx: What? ;) */ | |
| 87 | |
| 88 MsnSync *sync; | |
| 89 | |
| 90 GList *slplinks; | |
| 91 }; | 117 }; |
| 92 | 118 |
| 93 /** | 119 /** |
| 94 * Creates an MSN session. | 120 * Creates an MSN session. |
| 95 * | 121 * |
| 96 * @param account The account. | 122 * @param account The account. |
| 97 * @param host The dispatch server host. | |
| 98 * @param port The dispatch server port. | |
| 99 * | 123 * |
| 100 * @return The new MSN session. | 124 * @return The new MSN session. |
| 101 */ | 125 */ |
| 102 MsnSession *msn_session_new(GaimAccount *account, | 126 MsnSession *msn_session_new(GaimAccount *account); |
| 103 const char *host, int port, | |
| 104 gboolean http_method); | |
| 105 | 127 |
| 106 /** | 128 /** |
| 107 * Destroys an MSN session. | 129 * Destroys an MSN session. |
| 108 * | 130 * |
| 109 * @param session The MSN session to destroy. | 131 * @param session The MSN session to destroy. |
| 111 void msn_session_destroy(MsnSession *session); | 133 void msn_session_destroy(MsnSession *session); |
| 112 | 134 |
| 113 /** | 135 /** |
| 114 * Connects to and initiates an MSN session. | 136 * Connects to and initiates an MSN session. |
| 115 * | 137 * |
| 116 * @param session The MSN session. | 138 * @param session The MSN session. |
| 139 * @param host The dispatch server host. | |
| 140 * @param port The dispatch server port. | |
| 141 * @param http_method Whether to use or not http_method. | |
| 117 * | 142 * |
| 118 * @return @c TRUE on success, @c FALSE on failure. | 143 * @return @c TRUE on success, @c FALSE on failure. |
| 119 */ | 144 */ |
| 120 gboolean msn_session_connect(MsnSession *session); | 145 gboolean msn_session_connect(MsnSession *session, |
| 146 const char *host, int port, | |
| 147 gboolean http_method); | |
| 121 | 148 |
| 122 /** | 149 /** |
| 123 * Disconnects from an MSN session. | 150 * Disconnects from an MSN session. |
| 124 * | 151 * |
| 125 * @param session The MSN session. | 152 * @param session The MSN session. |
| 140 MsnSwitchBoard *msn_session_find_swboard(MsnSession *session, | 167 MsnSwitchBoard *msn_session_find_swboard(MsnSession *session, |
| 141 const char *username); | 168 const char *username); |
| 142 MsnSwitchBoard *msn_session_get_swboard(MsnSession *session, | 169 MsnSwitchBoard *msn_session_get_swboard(MsnSession *session, |
| 143 const char *username); | 170 const char *username); |
| 144 | 171 |
| 172 /** | |
| 173 * Sets an error for the MSN session. | |
| 174 * | |
| 175 * @param session The MSN session. | |
| 176 * @param error The error. | |
| 177 * @param info Extra information. | |
| 178 */ | |
| 179 void msn_session_set_error(MsnSession *session, MsnErrorType error, | |
| 180 const char *info); | |
| 181 | |
| 182 /** | |
| 183 * Sets the current step in the login proccess. | |
| 184 * | |
| 185 * @param session The MSN session. | |
| 186 * @param step The current step. | |
| 187 */ | |
| 188 void msn_session_set_login_step(MsnSession *session, MsnLoginStep step); | |
| 189 | |
| 190 /** | |
| 191 * Finish the login proccess. | |
| 192 * | |
| 193 * @param session The MSN session. | |
| 194 */ | |
| 145 void msn_session_finish_login(MsnSession *session); | 195 void msn_session_finish_login(MsnSession *session); |
| 146 | 196 |
| 147 #endif /* _MSN_SESSION_H_ */ | 197 #endif /* _MSN_SESSION_H_ */ |
