Mercurial > pidgin.yaz
comparison src/protocols/msn/nexus.c @ 9193:502707ca1836
[gaim-migrate @ 9988]
Patch by Felipe Contreras to add MSN file transfer and buddy icons. Please
test and report any bugs!
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 06 Jun 2004 02:39:08 +0000 |
parents | 577c76e1442d |
children | ab6636c5a136 |
comparison
equal
deleted
inserted
replaced
9192:5655dcd94d0f | 9193:502707ca1836 |
---|---|
63 login_connect_cb(gpointer data, GaimSslConnection *gsc, | 63 login_connect_cb(gpointer data, GaimSslConnection *gsc, |
64 GaimInputCondition cond) | 64 GaimInputCondition cond) |
65 { | 65 { |
66 MsnNexus *nexus; | 66 MsnNexus *nexus; |
67 MsnSession *session; | 67 MsnSession *session; |
68 GaimConnection *gc; | |
69 char *username, *password; | 68 char *username, *password; |
70 char *request_str; | 69 char *request_str; |
71 char *buffer = NULL; | 70 char *buffer = NULL; |
72 size_t s; | 71 size_t s; |
73 | 72 |
74 nexus = data; | 73 nexus = data; |
75 g_return_if_fail(nexus != NULL); | 74 g_return_if_fail(nexus != NULL); |
76 | 75 |
77 session = nexus->session; | 76 session = nexus->session; |
78 g_return_if_fail(session != NULL); | 77 g_return_if_fail(session != NULL); |
79 | |
80 gc = gaim_account_get_connection(session->account); | |
81 g_return_if_fail(gc != NULL); | |
82 | 78 |
83 username = | 79 username = |
84 g_strdup(gaim_url_encode(gaim_account_get_username(session->account))); | 80 g_strdup(gaim_url_encode(gaim_account_get_username(session->account))); |
85 | 81 |
86 password = | 82 password = |
116 g_free(password); | 112 g_free(password); |
117 | 113 |
118 if ((s = gaim_ssl_write(gsc, request_str, strlen(request_str))) <= 0) | 114 if ((s = gaim_ssl_write(gsc, request_str, strlen(request_str))) <= 0) |
119 { | 115 { |
120 g_free(request_str); | 116 g_free(request_str); |
121 gaim_connection_error(gc, _("Unable to write to MSN Nexus server.")); | |
122 | 117 |
123 return; | 118 return; |
124 } | 119 } |
125 | 120 |
126 g_free(request_str); | 121 g_free(request_str); |
127 | 122 |
128 if ((s = msn_ssl_read(gsc, &buffer)) <= 0) | 123 if ((s = msn_ssl_read(gsc, &buffer)) <= 0) |
129 { | 124 return; |
130 gaim_connection_error(gc, _("Unable to write to MSN Nexus server.")); | |
131 return; | |
132 } | |
133 | 125 |
134 gaim_ssl_close(gsc); | 126 gaim_ssl_close(gsc); |
135 | 127 |
136 gaim_debug(GAIM_DEBUG_MISC, "msn", "ssl buffer: {%s}", buffer); | 128 gaim_debug(GAIM_DEBUG_MISC, "msn", "ssl buffer: {%s}", buffer); |
137 | 129 |
141 char *location, *c; | 133 char *location, *c; |
142 | 134 |
143 location = strstr(buffer, "Location: "); | 135 location = strstr(buffer, "Location: "); |
144 if (location == NULL) | 136 if (location == NULL) |
145 { | 137 { |
146 gaim_connection_error(gc, | |
147 _("MSN Nexus server returned invalid redirect information.")); | |
148 | |
149 g_free(buffer); | 138 g_free(buffer); |
150 | 139 |
151 return; | 140 return; |
152 } | 141 } |
153 | |
154 location = strchr(location, ' ') + 1; | 142 location = strchr(location, ' ') + 1; |
155 | 143 |
156 if ((c = strchr(location, '\r')) != NULL) | 144 if ((c = strchr(location, '\r')) != NULL) |
157 *c = '\0'; | 145 *c = '\0'; |
158 | 146 |
207 else | 195 else |
208 gaim_connection_error(gc, error); | 196 gaim_connection_error(gc, error); |
209 } | 197 } |
210 else if (strstr(buffer, "HTTP/1.1 200 OK")) | 198 else if (strstr(buffer, "HTTP/1.1 200 OK")) |
211 { | 199 { |
212 MsnCmdProc *cmdproc; | |
213 char *base, *c; | 200 char *base, *c; |
214 char *login_params; | 201 char *login_params; |
215 | 202 |
216 #if 0 | 203 #if 0 |
217 /* All your base are belong to us. */ | 204 /* All your base are belong to us. */ |
228 g_list_append(session->login_cookies, | 215 g_list_append(session->login_cookies, |
229 g_strndup(base, c - base)); | 216 g_strndup(base, c - base)); |
230 } | 217 } |
231 #endif | 218 #endif |
232 | 219 |
233 cmdproc = session->notification_conn->cmdproc; | |
234 base = strstr(buffer, "Authentication-Info: "); | 220 base = strstr(buffer, "Authentication-Info: "); |
235 | 221 |
236 if (base == NULL) | 222 g_return_if_fail(base != NULL); |
237 { | |
238 gaim_debug(GAIM_DEBUG_ERROR, "msn", | |
239 "Authentication information was not found. This did " | |
240 "not just happen, but if it did, you're screwed. " | |
241 "Report this.\n"); | |
242 | |
243 return; | |
244 } | |
245 | 223 |
246 base = strstr(base, "from-PP='"); | 224 base = strstr(base, "from-PP='"); |
247 base += strlen("from-PP='"); | 225 base += strlen("from-PP='"); |
248 c = strchr(base, '\''); | 226 c = strchr(base, '\''); |
249 | 227 |
250 login_params = g_strndup(base, c - base); | 228 login_params = g_strndup(base, c - base); |
251 | 229 |
252 msn_cmdproc_send(cmdproc, "USR", "TWN S %s", login_params); | 230 msn_got_login_params(session, login_params); |
253 | 231 |
254 g_free(login_params); | 232 g_free(login_params); |
255 | 233 |
256 msn_nexus_destroy(nexus); | 234 msn_nexus_destroy(nexus); |
257 session->nexus = NULL; | 235 session->nexus = NULL; |