Mercurial > pidgin
annotate src/protocols/msn/session.h @ 19839:2b36697b05ea
[gaim-migrate @ 17288]
Update the contact update soap request method,
committer: Ethan Blanton <elb@pidgin.im>
| author | Ma Yuan <mayuan2006@gmail.com> |
|---|---|
| date | Sat, 16 Sep 2006 18:27:25 +0000 |
| parents | 90f89601d6d3 |
| children | 5568b3ac6fce |
| 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; | |
| 114 | |
| 5309 | 115 struct |
| 116 { | |
| 19784 | 117 /*t and p, get via USR TWN*/ |
| 118 char *t; | |
| 119 char *p; | |
| 120 | |
| 5309 | 121 char *kv; |
| 122 char *sid; | |
| 123 char *mspauth; | |
| 124 unsigned long sl; | |
| 125 char *file; | |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
126 char *client_ip; |
|
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
127 int client_port; |
| 5309 | 128 } passport_info; |
| 129 }; | |
| 130 | |
| 131 /** | |
| 132 * Creates an MSN session. | |
| 133 * | |
| 134 * @param account The account. | |
| 135 * | |
| 136 * @return The new MSN session. | |
| 137 */ | |
| 10481 | 138 MsnSession *msn_session_new(GaimAccount *account); |
| 5309 | 139 |
| 140 /** | |
| 141 * Destroys an MSN session. | |
| 142 * | |
| 143 * @param session The MSN session to destroy. | |
| 144 */ | |
| 145 void msn_session_destroy(MsnSession *session); | |
| 146 | |
| 147 /** | |
| 148 * Connects to and initiates an MSN session. | |
| 149 * | |
| 10481 | 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. | |
| 5309 | 154 * |
| 155 * @return @c TRUE on success, @c FALSE on failure. | |
| 156 */ | |
| 10481 | 157 gboolean msn_session_connect(MsnSession *session, |
| 158 const char *host, int port, | |
| 159 gboolean http_method); | |
| 5309 | 160 |
| 161 /** | |
| 162 * Disconnects from an MSN session. | |
| 163 * | |
| 164 * @param session The MSN session. | |
| 165 */ | |
| 166 void msn_session_disconnect(MsnSession *session); | |
| 167 | |
| 10602 | 168 /** |
| 169 * Finds a switchboard with the given username. | |
| 170 * | |
| 171 * @param session The MSN session. | |
| 172 * @param username The username to search for. | |
| 173 * | |
| 174 * @return The switchboard, if found. | |
| 175 */ | |
| 176 MsnSwitchBoard *msn_session_find_swboard(MsnSession *session, | |
| 10621 | 177 const char *username); |
| 10602 | 178 |
| 10621 | 179 /** |
| 180 * Finds a switchboard with the given conversation. | |
| 181 * | |
| 182 * @param session The MSN session. | |
| 183 * @param conv The conversation to search for. | |
| 184 * | |
| 185 * @return The switchboard, if found. | |
| 186 */ | |
| 187 MsnSwitchBoard *msn_session_find_swboard_with_conv(MsnSession *session, | |
| 188 GaimConversation *conv); | |
| 5309 | 189 /** |
| 190 * Finds a switchboard with the given chat ID. | |
| 191 * | |
| 192 * @param session The MSN session. | |
| 193 * @param chat_id The chat ID to search for. | |
| 194 * | |
| 195 * @return The switchboard, if found. | |
| 196 */ | |
| 10602 | 197 MsnSwitchBoard *msn_session_find_swboard_with_id(const MsnSession *session, |
| 10621 | 198 int chat_id); |
| 5309 | 199 |
| 10602 | 200 /** |
| 201 * Returns a switchboard to communicate with certain username. | |
| 202 * | |
| 203 * @param session The MSN session. | |
| 204 * @param username The username to search for. | |
| 10773 | 205 * @param flag The flag of the switchboard |
| 10602 | 206 * |
| 207 * @return The switchboard. | |
| 208 */ | |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
209 MsnSwitchBoard *msn_session_get_swboard(MsnSession *session, |
| 10773 | 210 const char *username, MsnSBFlag flag); |
| 5309 | 211 |
| 10481 | 212 /** |
| 213 * Sets an error for the MSN session. | |
| 214 * | |
| 215 * @param session The MSN session. | |
| 216 * @param error The error. | |
| 217 * @param info Extra information. | |
| 218 */ | |
| 219 void msn_session_set_error(MsnSession *session, MsnErrorType error, | |
| 220 const char *info); | |
| 221 | |
| 222 /** | |
| 223 * Sets the current step in the login proccess. | |
| 224 * | |
| 225 * @param session The MSN session. | |
| 226 * @param step The current step. | |
| 227 */ | |
| 228 void msn_session_set_login_step(MsnSession *session, MsnLoginStep step); | |
| 229 | |
| 230 /** | |
| 231 * Finish the login proccess. | |
| 232 * | |
| 233 * @param session The MSN session. | |
| 234 */ | |
| 10044 | 235 void msn_session_finish_login(MsnSession *session); |
| 236 | |
| 19801 | 237 /*get conversation via session, |
| 238 * If has one, return that,else create a new one; | |
| 239 */ | |
| 240 GaimConversation *msn_session_get_conv(MsnSession *session,const char *passport); | |
| 241 | |
| 242 /*post message to User*/ | |
| 243 void msn_session_report_user(MsnSession *session,const char *passport, | |
| 244 char *msg,GaimMessageFlags flags); | |
| 5309 | 245 #endif /* _MSN_SESSION_H_ */ |
