Mercurial > pidgin
annotate src/protocols/msn/notification.c @ 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 | ef06a1fb425e |
| children | 5568b3ac6fce |
| rev | line source |
|---|---|
| 5309 | 1 /** |
| 2 * @file notification.c Notification server functions | |
| 3 * | |
| 4 * gaim | |
| 5 * | |
|
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9197
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:
9197
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:
9197
diff
changeset
|
8 * source distribution. |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
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 #include "msn.h" | |
| 25 #include "notification.h" | |
|
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
26 #include "state.h" |
| 5309 | 27 #include "error.h" |
|
13627
3cfdf1653a64
[gaim-migrate @ 16014]
Evan Schoenberg <evan.s@dreskin.net>
parents:
11992
diff
changeset
|
28 #include "msn-utils.h" |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
29 #include "page.h" |
|
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
30 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
31 #include "userlist.h" |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
32 #include "sync.h" |
| 10296 | 33 #include "slplink.h" |
| 5309 | 34 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
35 static MsnTable *cbs_table; |
| 5309 | 36 |
| 19796 | 37 /**************************************************************************** |
| 38 * Local Function Prototype | |
| 39 ****************************************************************************/ | |
| 19803 | 40 void msn_notification_post_adl(MsnCmdProc *cmdproc,char *payload ,int payload_len); |
| 41 | |
| 19798 | 42 void msn_add_contact_xml(xmlnode *mlNode,const char *passport,int list_op,int type); |
| 19796 | 43 |
| 5309 | 44 /************************************************************************** |
| 10463 | 45 * Main |
| 46 **************************************************************************/ | |
| 10481 | 47 |
| 10463 | 48 static void |
| 49 destroy_cb(MsnServConn *servconn) | |
| 50 { | |
| 51 MsnNotification *notification; | |
| 52 | |
| 53 notification = servconn->cmdproc->data; | |
| 54 g_return_if_fail(notification != NULL); | |
| 55 | |
| 56 msn_notification_destroy(notification); | |
| 57 } | |
| 58 | |
| 59 MsnNotification * | |
| 60 msn_notification_new(MsnSession *session) | |
| 61 { | |
| 62 MsnNotification *notification; | |
| 63 MsnServConn *servconn; | |
| 64 | |
| 65 g_return_val_if_fail(session != NULL, NULL); | |
| 66 | |
| 67 notification = g_new0(MsnNotification, 1); | |
| 68 | |
| 69 notification->session = session; | |
| 10481 | 70 notification->servconn = servconn = msn_servconn_new(session, MSN_SERVCONN_NS); |
| 10463 | 71 msn_servconn_set_destroy_cb(servconn, destroy_cb); |
| 72 | |
| 73 notification->cmdproc = servconn->cmdproc; | |
| 74 notification->cmdproc->data = notification; | |
| 75 notification->cmdproc->cbs_table = cbs_table; | |
| 76 | |
| 77 return notification; | |
| 78 } | |
| 79 | |
| 80 void | |
| 81 msn_notification_destroy(MsnNotification *notification) | |
| 82 { | |
| 10481 | 83 notification->cmdproc->data = NULL; |
| 10463 | 84 |
| 10481 | 85 msn_servconn_set_destroy_cb(notification->servconn, NULL); |
| 10463 | 86 |
| 87 msn_servconn_destroy(notification->servconn); | |
| 88 | |
| 89 g_free(notification); | |
| 90 } | |
| 91 | |
| 92 /************************************************************************** | |
| 93 * Connect | |
| 94 **************************************************************************/ | |
| 10481 | 95 |
| 10463 | 96 static void |
| 97 connect_cb(MsnServConn *servconn) | |
| 98 { | |
| 99 MsnCmdProc *cmdproc; | |
| 100 MsnSession *session; | |
| 101 GaimAccount *account; | |
| 102 char **a, **c, *vers; | |
| 103 int i; | |
| 104 | |
| 105 g_return_if_fail(servconn != NULL); | |
| 106 | |
| 107 cmdproc = servconn->cmdproc; | |
| 108 session = servconn->session; | |
| 109 account = session->account; | |
| 110 | |
| 111 /* Allocate an array for CVR0, NULL, and all the versions */ | |
| 19785 | 112 // a = c = g_new0(char *, session->protocol_ver - WLM_MIN_PROTOCOL + 3); |
| 113 a = c = g_new0(char *, WLM_MAX_PROTOCOL - WLM_MIN_PROTOCOL + 3); | |
| 10463 | 114 |
| 19785 | 115 // for (i = session->protocol_ver; i >= WLM_MIN_PROTOCOL; i--) |
| 116 for (i = WLM_MAX_PROTOCOL; i >= WLM_MIN_PROTOCOL; i--) | |
| 10463 | 117 *c++ = g_strdup_printf("MSNP%d", i); |
| 118 | |
| 119 *c++ = g_strdup("CVR0"); | |
| 120 | |
| 121 vers = g_strjoinv(" ", a); | |
| 122 | |
| 19786 | 123 if (session->login_step == MSN_LOGIN_STEP_START){ |
| 10519 | 124 msn_session_set_login_step(session, MSN_LOGIN_STEP_HANDSHAKE); |
| 19786 | 125 }else{ |
| 10519 | 126 msn_session_set_login_step(session, MSN_LOGIN_STEP_HANDSHAKE2); |
| 19786 | 127 } |
| 10514 | 128 |
| 10463 | 129 msn_cmdproc_send(cmdproc, "VER", "%s", vers); |
| 130 | |
| 131 g_strfreev(a); | |
| 132 g_free(vers); | |
| 133 } | |
| 134 | |
| 135 gboolean | |
| 136 msn_notification_connect(MsnNotification *notification, const char *host, int port) | |
| 137 { | |
| 138 MsnServConn *servconn; | |
| 139 | |
| 140 g_return_val_if_fail(notification != NULL, FALSE); | |
| 141 | |
| 142 servconn = notification->servconn; | |
| 143 | |
| 144 msn_servconn_set_connect_cb(servconn, connect_cb); | |
| 145 notification->in_use = msn_servconn_connect(servconn, host, port); | |
| 146 | |
| 147 return notification->in_use; | |
| 148 } | |
| 149 | |
| 150 void | |
| 151 msn_notification_disconnect(MsnNotification *notification) | |
| 152 { | |
| 153 g_return_if_fail(notification != NULL); | |
| 154 g_return_if_fail(notification->in_use); | |
| 155 | |
| 156 msn_servconn_disconnect(notification->servconn); | |
| 157 | |
| 158 notification->in_use = FALSE; | |
| 159 } | |
| 160 | |
| 161 /************************************************************************** | |
| 10451 | 162 * Util |
| 163 **************************************************************************/ | |
| 10481 | 164 |
| 10451 | 165 static void |
| 19800 | 166 group_error_helper(MsnSession *session, const char *msg, const char *group_id, int error) |
| 10451 | 167 { |
| 168 GaimAccount *account; | |
| 169 GaimConnection *gc; | |
| 170 char *reason = NULL; | |
| 171 char *title = NULL; | |
| 172 | |
| 173 account = session->account; | |
| 174 gc = gaim_account_get_connection(account); | |
| 175 | |
| 19785 | 176 if (error == 224){ |
| 177 if (group_id == 0){ | |
| 10451 | 178 return; |
| 19785 | 179 }else{ |
| 10451 | 180 const char *group_name; |
| 19785 | 181 group_name = msn_userlist_find_group_name(session->userlist,group_id); |
| 10451 | 182 reason = g_strdup_printf(_("%s is not a valid group."), |
| 183 group_name); | |
| 184 } | |
| 19785 | 185 }else{ |
| 10451 | 186 reason = g_strdup(_("Unknown error.")); |
| 187 } | |
| 188 | |
| 189 title = g_strdup_printf(_("%s on %s (%s)"), msg, | |
| 190 gaim_account_get_username(account), | |
| 191 gaim_account_get_protocol_name(account)); | |
| 192 gaim_notify_error(gc, NULL, title, reason); | |
| 193 g_free(title); | |
| 194 g_free(reason); | |
| 195 } | |
| 196 | |
| 197 /************************************************************************** | |
| 5309 | 198 * Login |
| 199 **************************************************************************/ | |
| 10481 | 200 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
201 void |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
202 msn_got_login_params(MsnSession *session, const char *login_params) |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
203 { |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
204 MsnCmdProc *cmdproc; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
205 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
206 cmdproc = session->notification->cmdproc; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
207 |
| 10519 | 208 msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_END); |
| 10481 | 209 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
210 msn_cmdproc_send(cmdproc, "USR", "TWN S %s", login_params); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
211 } |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
212 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
213 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
214 cvr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 5309 | 215 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
216 GaimAccount *account; |
| 5309 | 217 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
218 account = cmdproc->session->account; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
219 msn_cmdproc_send(cmdproc, "USR", "TWN I %s", |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
220 gaim_account_get_username(account)); |
| 5309 | 221 } |
| 222 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
223 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
224 usr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 5309 | 225 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
226 MsnSession *session; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
227 GaimAccount *account; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
228 GaimConnection *gc; |
| 5309 | 229 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
230 session = cmdproc->session; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
231 account = session->account; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
232 gc = gaim_account_get_connection(account); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
233 |
| 19783 | 234 if (!g_ascii_strcasecmp(cmd->params[1], "OK")){ |
| 235 /* authenticate OK */ | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
236 const char *friendly = gaim_url_decode(cmd->params[3]); |
|
5508
2a57266df5f6
[gaim-migrate @ 5907]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
237 |
|
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
238 gaim_connection_set_display_name(gc, friendly); |
|
5508
2a57266df5f6
[gaim-migrate @ 5907]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
239 |
| 10519 | 240 msn_session_set_login_step(session, MSN_LOGIN_STEP_SYN); |
| 5309 | 241 |
| 19784 | 242 // msn_cmdproc_send(cmdproc, "SYN", "%s", "0"); |
| 243 //TODO we should use SOAP contact to fetch contact list | |
| 19783 | 244 }else if (!g_ascii_strcasecmp(cmd->params[1], "TWN")){ |
| 10481 | 245 /* Passport authentication */ |
|
8171
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
8029
diff
changeset
|
246 char **elems, **cur, **tokens; |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
247 |
|
8171
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
8029
diff
changeset
|
248 session->nexus = msn_nexus_new(session); |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
249 |
|
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
250 /* Parse the challenge data. */ |
| 19808 | 251 session->nexus->challenge_data_str = g_strdup(cmd->params[3]); |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
252 elems = g_strsplit(cmd->params[3], ",", 0); |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
253 |
| 19783 | 254 for (cur = elems; *cur != NULL; cur++){ |
| 19786 | 255 tokens = g_strsplit(*cur, "=", 2); |
| 19808 | 256 if(tokens[0]&&tokens[1]){ |
| 257 gaim_debug_info("MaYuan","challenge %p,key:%s,value:%s\n", | |
| 258 session->nexus->challenge_data,tokens[0],tokens[1]); | |
|
8171
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
8029
diff
changeset
|
259 g_hash_table_insert(session->nexus->challenge_data, tokens[0], tokens[1]); |
| 19808 | 260 } |
| 19786 | 261 /* Don't free each of the tokens, only the array. */ |
| 262 g_free(tokens); | |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
263 } |
|
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
264 |
|
8171
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
8029
diff
changeset
|
265 g_strfreev(elems); |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
266 |
| 10519 | 267 msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_START); |
| 5309 | 268 |
| 10481 | 269 msn_nexus_connect(session->nexus); |
| 5309 | 270 } |
| 271 } | |
| 272 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
273 static void |
| 10568 | 274 usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) |
| 275 { | |
| 276 MsnErrorType msnerr = 0; | |
| 277 | |
| 278 switch (error) | |
| 279 { | |
| 280 case 500: | |
| 281 case 601: | |
| 282 case 910: | |
| 283 case 921: | |
| 284 msnerr = MSN_ERROR_SERV_UNAVAILABLE; | |
| 285 break; | |
| 286 case 911: | |
| 287 msnerr = MSN_ERROR_AUTH; | |
| 288 break; | |
| 289 default: | |
| 290 return; | |
| 291 break; | |
| 292 } | |
| 293 | |
| 294 msn_session_set_error(cmdproc->session, msnerr, NULL); | |
| 295 } | |
| 296 | |
| 297 static void | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
298 ver_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
299 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
300 MsnSession *session; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
301 GaimAccount *account; |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
302 gboolean protocol_supported = FALSE; |
|
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
303 char proto_str[8]; |
|
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
304 size_t i; |
|
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
305 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
306 session = cmdproc->session; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
307 account = session->account; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
308 |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
309 g_snprintf(proto_str, sizeof(proto_str), "MSNP%d", session->protocol_ver); |
|
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
310 |
| 19786 | 311 for (i = 1; i < cmd->param_count -1; i++){ |
| 19795 | 312 gaim_debug_info("MaYuan","%s,proto_str:%s\n",cmd->params[i],proto_str); |
| 19786 | 313 if (strcmp(cmd->params[i], proto_str) >= 0) { |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
314 protocol_supported = TRUE; |
|
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
315 break; |
|
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
316 } |
|
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
317 } |
|
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
318 |
| 19785 | 319 if (!protocol_supported){ |
| 10519 | 320 msn_session_set_error(session, MSN_ERROR_UNSUPPORTED_PROTOCOL, |
| 10481 | 321 NULL); |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
322 return; |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
323 } |
|
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
324 |
| 19783 | 325 /* |
| 326 * Windows Live Messenger 8.0 | |
| 327 * Notice :CVR String discriminate! | |
| 19786 | 328 * reference of http://www.microsoft.com/globaldev/reference/oslocversion.mspx |
| 329 * to see the Local ID | |
| 19783 | 330 */ |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
331 msn_cmdproc_send(cmdproc, "CVR", |
| 19785 | 332 // "0x0409 winnt 5.1 i386 MSG80BETA 8.0.0689 msmsgs %s", |
| 333 "0x0804 winnt 5.1 i386 MSNMSGR 8.0.0792 msmsgs %s", | |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
334 gaim_account_get_username(account)); |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
335 } |
|
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
336 |
| 5309 | 337 /************************************************************************** |
| 338 * Log out | |
| 339 **************************************************************************/ | |
| 10481 | 340 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
341 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
342 out_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 5309 | 343 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
344 if (!g_ascii_strcasecmp(cmd->params[0], "OTH")) |
| 10481 | 345 msn_session_set_error(cmdproc->session, MSN_ERROR_SIGN_OTHER, |
| 346 NULL); | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
347 else if (!g_ascii_strcasecmp(cmd->params[0], "SSD")) |
| 10481 | 348 msn_session_set_error(cmdproc->session, MSN_ERROR_SERV_DOWN, NULL); |
| 5309 | 349 } |
| 350 | |
| 10463 | 351 void |
| 352 msn_notification_close(MsnNotification *notification) | |
| 353 { | |
| 354 g_return_if_fail(notification != NULL); | |
| 355 | |
| 10568 | 356 if (!notification->in_use) |
| 357 return; | |
| 358 | |
| 10463 | 359 msn_cmdproc_send_quick(notification->cmdproc, "OUT", NULL, NULL); |
| 360 | |
| 361 msn_notification_disconnect(notification); | |
| 362 } | |
| 363 | |
| 5309 | 364 /************************************************************************** |
| 365 * Messages | |
| 366 **************************************************************************/ | |
| 10481 | 367 |
|
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
368 static void |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
369 msg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
370 size_t len) |
|
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
371 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
372 MsnMessage *msg; |
|
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
373 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
374 msg = msn_message_new_from_cmd(cmdproc->session, cmd); |
|
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
375 |
| 19816 | 376 msn_message_parse_payload(msg, payload, len,MSG_LINE_DEM,MSG_BODY_DEM); |
| 11321 | 377 #ifdef MSN_DEBUG_NS |
| 378 msn_message_show_readable(msg, "Notification", TRUE); | |
| 379 #endif | |
|
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
380 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
381 msn_cmdproc_process_msg(cmdproc, msg); |
|
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
382 |
|
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
383 msn_message_destroy(msg); |
|
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
384 } |
|
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
385 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
386 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
387 msg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 5309 | 388 { |
| 19783 | 389 gaim_debug_info("MaYuan","Processing MSG... \n"); |
| 390 if(cmd->payload_len == 0){ | |
| 391 return; | |
| 392 } | |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
393 /* NOTE: cmd is not always cmdproc->last_cmd, sometimes cmd is a queued |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
394 * command and we are processing it */ |
| 19783 | 395 if (cmd->payload == NULL){ |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
396 cmdproc->last_cmd->payload_cb = msg_cmd_post; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
397 cmdproc->servconn->payload_len = atoi(cmd->params[2]); |
| 19783 | 398 }else{ |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
399 g_return_if_fail(cmd->payload_cb != NULL); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
400 |
| 19788 | 401 gaim_debug_info("MaYuan","MSG payload:{%s}\n",cmd->payload); |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
402 cmd->payload_cb(cmdproc, cmd, cmd->payload, cmd->payload_len); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
403 } |
| 5309 | 404 } |
| 405 | |
| 19800 | 406 /*send Message to Yahoo Messenger*/ |
| 407 void | |
| 408 uum_send_msg(MsnSession *session,MsnMessage *msg) | |
| 409 { | |
| 410 MsnCmdProc *cmdproc; | |
| 411 MsnTransaction *trans; | |
| 412 char *payload; | |
| 413 gsize payload_len; | |
| 414 int type; | |
| 415 | |
| 416 cmdproc = session->notification->cmdproc; | |
| 417 g_return_if_fail(msg != NULL); | |
| 418 payload = msn_message_gen_payload(msg, &payload_len); | |
| 19811 | 419 gaim_debug_info("MaYuan","send UUM,payload{%s},strlen:%d,len:%d\n", |
| 420 payload,strlen(payload),payload_len); | |
| 19800 | 421 type = msg->type; |
| 19820 | 422 trans = msn_transaction_new(cmdproc, "UUM","%s 32 %d %d",msg->remote_user,type,payload_len); |
| 19817 | 423 msn_transaction_set_payload(trans, payload, strlen(payload)); |
| 19800 | 424 msn_cmdproc_send_trans(cmdproc, trans); |
| 425 } | |
| 426 | |
| 427 static void | |
| 428 ubm_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, | |
| 429 size_t len) | |
| 430 { | |
| 431 MsnMessage *msg; | |
| 432 GaimConnection *gc; | |
| 19801 | 433 const char *passport; |
| 434 const char *content_type; | |
| 19800 | 435 |
| 436 gaim_debug_info("MaYuan","Process UBM payload:%s\n",payload); | |
| 437 msg = msn_message_new_from_cmd(cmdproc->session, cmd); | |
| 438 | |
| 19816 | 439 msn_message_parse_payload(msg, payload, len,MSG_LINE_DEM,MSG_BODY_DEM); |
| 19800 | 440 #ifdef MSN_DEBUG_NS |
| 441 msn_message_show_readable(msg, "Notification", TRUE); | |
| 442 #endif | |
| 443 | |
| 19801 | 444 gc = cmdproc->session->account->gc; |
| 445 passport = msg->remote_user; | |
| 446 | |
| 447 content_type = msn_message_get_content_type(msg); | |
| 448 gaim_debug_info("MaYuan","type:%d\n",content_type); | |
| 449 if(!strcmp(content_type,"text/plain")){ | |
| 19800 | 450 const char *value; |
| 451 const char *body; | |
| 452 char *body_str; | |
| 453 char *body_enc; | |
| 19803 | 454 char *body_final = NULL; |
| 19800 | 455 size_t body_len; |
| 456 | |
| 457 body = msn_message_get_bin_data(msg, &body_len); | |
| 458 body_str = g_strndup(body, body_len); | |
| 459 body_enc = g_markup_escape_text(body_str, -1); | |
| 460 g_free(body_str); | |
| 461 | |
| 19801 | 462 if ((value = msn_message_get_attr(msg, "X-MMS-IM-Format")) != NULL) { |
| 463 char *pre, *post; | |
| 19800 | 464 |
| 19801 | 465 msn_parse_format(value, &pre, &post); |
| 466 body_final = g_strdup_printf("%s%s%s", pre ? pre : "", | |
| 467 body_enc ? body_enc : "", post ? post : ""); | |
| 468 g_free(pre); | |
| 469 g_free(post); | |
| 470 g_free(body_enc); | |
| 19800 | 471 } |
| 472 serv_got_im(gc, passport, body_final, 0, time(NULL)); | |
| 473 } | |
| 19801 | 474 if(!strcmp(content_type,"text/x-msmsgscontrol")){ |
| 475 if(msn_message_get_attr(msg, "TypingUser") != NULL){ | |
| 476 serv_got_typing(gc, passport, MSN_TYPING_RECV_TIMEOUT, | |
| 477 GAIM_TYPING); | |
| 478 } | |
| 479 } | |
| 480 if(!strcmp(content_type,"text/x-msnmsgr-datacast")){ | |
| 481 char *username, *str; | |
| 482 GaimAccount *account; | |
| 483 GaimBuddy *buddy; | |
| 484 const char *user; | |
| 485 | |
| 486 account = cmdproc->session->account; | |
| 487 user = msg->remote_user; | |
| 488 | |
| 489 if ((buddy = gaim_find_buddy(account, user)) != NULL){ | |
| 490 username = g_markup_escape_text(gaim_buddy_get_alias(buddy), -1); | |
| 491 }else{ | |
| 492 username = g_markup_escape_text(user, -1); | |
| 493 } | |
| 494 | |
| 495 str = g_strdup_printf(_("%s just sent you a Nudge!"), username); | |
| 496 g_free(username); | |
| 497 msn_session_report_user(cmdproc->session,user,str,GAIM_MESSAGE_SYSTEM); | |
| 498 g_free(str); | |
| 499 } | |
| 19800 | 500 msn_message_destroy(msg); |
| 501 } | |
| 502 | |
| 503 /*Yahoo msg process*/ | |
| 504 static void | |
| 505 ubm_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) | |
| 506 { | |
| 507 gaim_debug_info("MaYuan","Processing UBM... \n"); | |
| 508 if(cmd->payload_len == 0){ | |
| 509 return; | |
| 510 } | |
| 511 /* NOTE: cmd is not always cmdproc->last_cmd, sometimes cmd is a queued | |
| 512 * command and we are processing it */ | |
| 513 if (cmd->payload == NULL){ | |
| 514 cmdproc->last_cmd->payload_cb = ubm_cmd_post; | |
| 515 cmdproc->servconn->payload_len = atoi(cmd->params[2]); | |
| 516 }else{ | |
| 517 g_return_if_fail(cmd->payload_cb != NULL); | |
| 518 | |
| 519 gaim_debug_info("MaYuan","UBM payload:{%s}\n",cmd->payload); | |
| 520 ubm_cmd_post(cmdproc, cmd, cmd->payload, cmd->payload_len); | |
| 521 } | |
| 522 } | |
| 523 | |
| 5309 | 524 /************************************************************************** |
| 525 * Challenges | |
| 19784 | 526 * we use MD5 to caculate the Chanllenges |
| 5309 | 527 **************************************************************************/ |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
528 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
529 chl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 5309 | 530 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
531 MsnTransaction *trans; |
|
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
532 char buf[33]; |
| 5309 | 533 |
| 19785 | 534 #if 0 |
|
10684
72a5babfa8b4
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10647
diff
changeset
|
535 cipher = gaim_ciphers_find_cipher("md5"); |
|
72a5babfa8b4
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10647
diff
changeset
|
536 context = gaim_cipher_context_new(cipher, NULL); |
| 11183 | 537 gaim_cipher_context_append(context, (const guchar *)cmd->params[1], |
|
10684
72a5babfa8b4
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10647
diff
changeset
|
538 strlen(cmd->params[1])); |
| 19784 | 539 challenge_resp = MSNP13_WLM_PRODUCT_KEY; |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
540 |
| 11183 | 541 gaim_cipher_context_append(context, (const guchar *)challenge_resp, |
|
10684
72a5babfa8b4
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10647
diff
changeset
|
542 strlen(challenge_resp)); |
|
10687
b256ce6b85b8
[gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10684
diff
changeset
|
543 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); |
|
10684
72a5babfa8b4
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10647
diff
changeset
|
544 gaim_cipher_context_destroy(context); |
| 5309 | 545 |
| 19785 | 546 for (i = 0; i < 16; i++){ |
|
10684
72a5babfa8b4
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10647
diff
changeset
|
547 g_snprintf(buf + (i*2), 3, "%02x", digest[i]); |
| 19785 | 548 } |
| 549 #else | |
| 550 msn_handle_chl(cmd->params[1], buf); | |
| 551 #endif | |
| 19786 | 552 // gaim_debug_info("MaYuan","<<challenge:{%s}:{%s}\n",cmd->params[1],buf); |
| 19784 | 553 trans = msn_transaction_new(cmdproc, "QRY", "%s 32", MSNP13_WLM_PRODUCT_ID); |
| 5309 | 554 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
555 msn_transaction_set_payload(trans, buf, 32); |
| 5309 | 556 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
557 msn_cmdproc_send_trans(cmdproc, trans); |
| 5309 | 558 } |
| 559 | |
| 560 /************************************************************************** | |
| 561 * Buddy Lists | |
| 562 **************************************************************************/ | |
| 19796 | 563 /* add contact to xmlnode */ |
| 564 void | |
| 19798 | 565 msn_add_contact_xml(xmlnode *mlNode,const char *passport,int list_op,int type) |
| 19796 | 566 { |
| 567 xmlnode *d_node,*c_node; | |
| 568 char **tokens; | |
| 569 char *email,*domain; | |
| 570 char *list_op_str,*type_str; | |
| 571 | |
| 572 gaim_debug_info("MaYuan","passport:%s\n",passport); | |
| 573 tokens = g_strsplit(passport, "@", 2); | |
| 574 email = tokens[0]; | |
| 575 domain = tokens[1]; | |
| 576 | |
| 577 /*find a domain Node*/ | |
| 578 for(d_node = xmlnode_get_child(mlNode,"d"); d_node; d_node = xmlnode_get_next_twin(d_node)){ | |
| 579 const char * attr = NULL; | |
| 580 gaim_debug_info("MaYuan","d_node:%s\n",d_node->name); | |
| 581 attr = xmlnode_get_attrib(d_node,"n"); | |
| 582 if(attr == NULL){ | |
| 583 continue; | |
| 584 } | |
| 585 if(!strcmp(attr,domain)){ | |
| 586 break; | |
| 587 } | |
| 588 } | |
| 589 if(d_node == NULL){ | |
| 590 /*domain not found, create a new domain Node*/ | |
| 591 gaim_debug_info("MaYuan","get No d_node\n"); | |
| 592 d_node = xmlnode_new("d"); | |
| 593 xmlnode_set_attrib(d_node,"n",domain); | |
| 594 xmlnode_insert_child(mlNode,d_node); | |
| 595 } | |
| 596 | |
| 597 /*create contact node*/ | |
| 598 c_node = xmlnode_new("c"); | |
| 599 xmlnode_set_attrib(c_node,"n",email); | |
| 600 | |
| 601 list_op_str = g_strdup_printf("%d",list_op); | |
| 602 gaim_debug_info("MaYuan","list_op:%d\n",list_op_str); | |
| 603 xmlnode_set_attrib(c_node,"l",list_op_str); | |
| 604 g_free(list_op_str); | |
| 19800 | 605 #if 0 |
| 19796 | 606 type_str = g_strdup_printf("%d",type); |
| 607 xmlnode_set_attrib(c_node,"t",type_str); | |
| 608 #else | |
| 19799 | 609 if(g_strrstr(domain,"yahoo") != NULL){ |
| 19800 | 610 type_str = g_strdup_printf("32"); |
| 19799 | 611 }else{ |
| 612 /*passport*/ | |
| 613 type_str = g_strdup_printf("1"); | |
| 614 } | |
| 615 /*mobile*/ | |
| 616 //type_str = g_strdup_printf("4"); | |
| 19796 | 617 xmlnode_set_attrib(c_node,"t",type_str); |
| 618 g_free(type_str); | |
| 619 #endif | |
| 620 xmlnode_insert_child(d_node, c_node); | |
| 19803 | 621 |
| 622 g_free(tokens); | |
| 623 } | |
| 624 | |
| 625 void | |
| 626 msn_notification_post_adl(MsnCmdProc *cmdproc,char *payload, int payload_len) | |
| 627 { | |
| 628 MsnTransaction *trans; | |
| 629 | |
| 630 gaim_debug_info("MaYuan","Send ADL{%s}\n",payload); | |
| 631 trans = msn_transaction_new(cmdproc, "ADL","%d",strlen(payload)); | |
| 632 msn_transaction_set_payload(trans, payload, strlen(payload)); | |
| 633 msn_cmdproc_send_trans(cmdproc, trans); | |
| 19796 | 634 } |
| 635 | |
| 636 /*dump contact info to NS*/ | |
| 19785 | 637 void |
| 19796 | 638 msn_notification_dump_contact(MsnSession *session) |
| 19785 | 639 { |
| 640 MsnUserList *userlist; | |
| 641 MsnUser *user; | |
| 642 GList *l; | |
| 19796 | 643 xmlnode *adl_node; |
| 19786 | 644 char *payload; |
| 19785 | 645 int payload_len; |
| 646 | |
| 647 userlist = session->userlist; | |
| 648 adl_node = xmlnode_new("ml"); | |
| 649 adl_node->child = NULL; | |
| 650 xmlnode_set_attrib(adl_node, "l", "1"); | |
| 651 | |
| 652 /*get the userlist*/ | |
| 653 for (l = userlist->users; l != NULL; l = l->next){ | |
| 654 user = l->data; | |
| 19799 | 655 msn_add_contact_xml(adl_node,user->passport,user->list_op&MSN_LIST_OP_MASK,user->type); |
| 19785 | 656 } |
| 657 | |
| 19786 | 658 payload = xmlnode_to_str(adl_node,&payload_len); |
| 19796 | 659 xmlnode_free(adl_node); |
| 19785 | 660 |
| 19803 | 661 msn_notification_post_adl(session->notification->cmdproc,payload,payload_len); |
| 662 } | |
| 663 | |
| 664 /*Post FQY to NS,Inform add a Yahoo User*/ | |
| 665 void | |
| 666 msn_notification_fqy_yahoo(MsnSession *session,char *passport) | |
| 667 { | |
| 668 MsnTransaction *trans; | |
| 669 MsnCmdProc *cmdproc; | |
| 670 char* email,*domain,*payload; | |
| 671 char **tokens; | |
| 672 | |
| 673 cmdproc = session->notification->cmdproc; | |
| 674 | |
| 675 tokens = g_strsplit(passport, "@", 2); | |
| 676 email = tokens[0]; | |
| 677 domain = tokens[1]; | |
| 678 | |
| 679 payload = g_strdup_printf("<ml><d n=\"%s\"><c n=\"%s\"/></d></ml>",domain,email); | |
| 680 trans = msn_transaction_new(cmdproc, "FQY","%d",strlen(payload)); | |
| 19785 | 681 msn_transaction_set_payload(trans, payload, strlen(payload)); |
| 682 msn_cmdproc_send_trans(cmdproc, trans); | |
| 19803 | 683 |
| 684 g_free(payload); | |
| 685 g_free(tokens); | |
| 19785 | 686 } |
| 687 | |
| 688 static void | |
| 19786 | 689 blp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 690 { | |
| 691 gaim_debug_info("MaYuan","Process BLP\n"); | |
| 692 } | |
| 693 | |
| 694 static void | |
| 19785 | 695 adl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 696 { | |
| 19786 | 697 gaim_debug_info("MaYuan","Process ADL\n"); |
| 19785 | 698 } |
| 699 | |
| 700 static void | |
| 19803 | 701 fqy_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, |
| 702 size_t len) | |
| 703 { | |
| 704 gaim_debug_info("MaYuan","FQY payload{%s}\n",payload); | |
| 705 msn_notification_post_adl(cmdproc,payload,len); | |
| 706 } | |
| 707 | |
| 708 static void | |
| 709 fqy_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) | |
| 710 { | |
| 711 gaim_debug_info("MaYuan","Process FQY\n"); | |
| 712 cmdproc->last_cmd->payload_cb = fqy_cmd_post; | |
| 713 } | |
| 714 | |
| 715 static void | |
| 19785 | 716 rml_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 717 { | |
| 718 MsnTransaction *trans; | |
| 719 char * payload; | |
| 720 | |
| 19795 | 721 gaim_debug_info("MaYuan","Process ADL\n"); |
| 722 #if 0 | |
| 19785 | 723 trans = msn_transaction_new(cmdproc, "RML",""); |
| 724 | |
| 725 msn_transaction_set_payload(trans, payload, strlen(payload)); | |
| 726 | |
| 727 msn_cmdproc_send_trans(cmdproc, trans); | |
| 19795 | 728 #endif |
| 19785 | 729 } |
| 730 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
731 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
732 add_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
733 { |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
734 MsnSession *session; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
735 GaimAccount *account; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
736 GaimConnection *gc; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
737 const char *list, *passport; |
| 9897 | 738 char *reason = NULL; |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
739 char *msg = NULL; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
740 char **params; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
741 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
742 session = cmdproc->session; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
743 account = session->account; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
744 gc = gaim_account_get_connection(account); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
745 params = g_strsplit(trans->params, " ", 0); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
746 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
747 list = params[0]; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
748 passport = params[1]; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
749 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
750 if (!strcmp(list, "FL")) |
| 10451 | 751 msg = g_strdup_printf(_("Unable to add user on %s (%s)"), |
| 9900 | 752 gaim_account_get_username(account), |
| 753 gaim_account_get_protocol_name(account)); | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
754 else if (!strcmp(list, "BL")) |
| 10451 | 755 msg = g_strdup_printf(_("Unable to block user on %s (%s)"), |
| 9900 | 756 gaim_account_get_username(account), |
| 757 gaim_account_get_protocol_name(account)); | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
758 else if (!strcmp(list, "AL")) |
| 10451 | 759 msg = g_strdup_printf(_("Unable to permit user on %s (%s)"), |
| 9900 | 760 gaim_account_get_username(account), |
| 761 gaim_account_get_protocol_name(account)); | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
762 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
763 if (!strcmp(list, "FL")) |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
764 { |
| 9900 | 765 if (error == 210) |
| 9897 | 766 { |
| 10451 | 767 reason = g_strdup_printf(_("%s could not be added because " |
| 768 "your buddy list is full."), passport); | |
| 9897 | 769 } |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
770 } |
| 9897 | 771 |
| 772 if (reason == NULL) | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
773 { |
| 9897 | 774 if (error == 208) |
| 775 { | |
| 10451 | 776 reason = g_strdup_printf(_("%s is not a valid passport account."), |
| 9897 | 777 passport); |
| 778 } | |
| 11862 | 779 else if (error == 500) |
| 780 { | |
| 781 reason = g_strdup(_("Service Temporarily Unavailable.")); | |
| 782 } | |
| 9897 | 783 else |
| 784 { | |
| 11862 | 785 reason = g_strdup(_("Unknown error.")); |
| 9897 | 786 } |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
787 } |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
788 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
789 if (msg != NULL) |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
790 { |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
791 gaim_notify_error(gc, NULL, msg, reason); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
792 g_free(msg); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
793 } |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
794 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
795 if (!strcmp(list, "FL")) |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
796 { |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
797 GaimBuddy *buddy; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
798 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
799 buddy = gaim_find_buddy(account, passport); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
800 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
801 if (buddy != NULL) |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
802 gaim_blist_remove_buddy(buddy); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
803 } |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
804 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
805 g_free(reason); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
806 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
807 g_strfreev(params); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
808 } |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
809 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
810 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
811 adg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
|
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
812 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
813 MsnSession *session; |
|
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
814 gint group_id; |
| 7162 | 815 const char *group_name; |
|
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
816 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
817 session = cmdproc->session; |
|
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
818 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
819 group_id = atoi(cmd->params[3]); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
820 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
821 group_name = gaim_url_decode(cmd->params[2]); |
|
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
822 |
|
13711
967ef719cb62
[gaim-migrate @ 16115]
Richard Laager <rlaager@wiktel.com>
parents:
13627
diff
changeset
|
823 msn_group_new(session->userlist, group_id, group_name); |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
824 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
825 /* There is a user that must me moved to this group */ |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
826 if (cmd->trans->data) |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
827 { |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
828 /* msn_userlist_move_buddy(); */ |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
829 MsnUserList *userlist = cmdproc->session->userlist; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
830 MsnMoveBuddy *data = cmd->trans->data; |
| 5309 | 831 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
832 if (data->old_group_name != NULL) |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
833 { |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
834 msn_userlist_rem_buddy(userlist, data->who, MSN_LIST_FL, data->old_group_name); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
835 g_free(data->old_group_name); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
836 } |
|
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9197
diff
changeset
|
837 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
838 msn_userlist_add_buddy(userlist, data->who, MSN_LIST_FL, group_name); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
839 g_free(data->who); |
|
5963
eb336b2c451f
[gaim-migrate @ 6410]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
840 |
|
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
841 } |
|
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
842 } |
|
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
843 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
844 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
845 fln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 5309 | 846 { |
| 10296 | 847 MsnSlpLink *slplink; |
| 10451 | 848 MsnUser *user; |
| 10296 | 849 |
| 10451 | 850 user = msn_userlist_find_user(cmdproc->session->userlist, cmd->params[0]); |
| 5309 | 851 |
| 10451 | 852 user->status = "offline"; |
| 853 msn_user_update(user); | |
| 10296 | 854 |
| 855 slplink = msn_session_find_slplink(cmdproc->session, cmd->params[0]); | |
| 856 | |
| 857 if (slplink != NULL) | |
| 858 msn_slplink_destroy(slplink); | |
| 859 | |
| 5309 | 860 } |
| 861 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
862 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
863 iln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 5309 | 864 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
865 MsnSession *session; |
| 10010 | 866 GaimAccount *account; |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
867 GaimConnection *gc; |
|
6800
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
868 MsnUser *user; |
|
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
869 MsnObject *msnobj; |
| 19787 | 870 int wlmclient; |
| 10451 | 871 const char *state, *passport, *friendly; |
| 5309 | 872 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
873 session = cmdproc->session; |
| 10010 | 874 account = session->account; |
| 875 gc = gaim_account_get_connection(account); | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
876 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
877 state = cmd->params[1]; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
878 passport = cmd->params[2]; |
| 19799 | 879 /*if a contact is actually on the WLM part or the yahoo part*/ |
| 19787 | 880 wlmclient = atoi(cmd->params[3]); |
| 881 friendly = gaim_url_decode(cmd->params[4]); | |
| 5309 | 882 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
883 user = msn_userlist_find_user(session->userlist, passport); |
|
6858
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
884 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
885 serv_got_alias(gc, passport, friendly); |
|
6833
ccfbd7c552ba
[gaim-migrate @ 7378]
Christian Hammond <chipx86@chipx86.com>
parents:
6830
diff
changeset
|
886 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
887 msn_user_set_friendly_name(user, friendly); |
|
6858
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
888 |
| 19832 | 889 if (session->protocol_ver >= 9 && cmd->param_count == 8){ |
| 19787 | 890 msnobj = msn_object_new_from_string(gaim_url_decode(cmd->params[6])); |
|
6800
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
891 msn_user_set_object(user, msnobj); |
|
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
892 } |
|
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
893 |
| 10451 | 894 msn_user_set_state(user, state); |
| 895 msn_user_update(user); | |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
896 } |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
897 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
898 static void |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
899 ipg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
900 { |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
901 #if 0 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
902 gaim_debug_misc("msn", "Incoming Page: {%s}\n", payload); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
903 #endif |
| 5309 | 904 } |
| 905 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
906 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
907 ipg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
|
5960
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
908 { |
| 8926 | 909 cmdproc->servconn->payload_len = atoi(cmd->params[0]); |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
910 cmdproc->last_cmd->payload_cb = ipg_cmd_post; |
| 5309 | 911 } |
| 912 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
913 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
914 nln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 5309 | 915 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
916 MsnSession *session; |
| 10010 | 917 GaimAccount *account; |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
918 GaimConnection *gc; |
|
6829
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
919 MsnUser *user; |
|
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
920 MsnObject *msnobj; |
|
11819
1452a3a9f07a
[gaim-migrate @ 14110]
Richard Laager <rlaager@wiktel.com>
parents:
11321
diff
changeset
|
921 int clientid; |
| 19787 | 922 int wlmclient; |
| 10451 | 923 const char *state, *passport, *friendly; |
| 5309 | 924 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
925 session = cmdproc->session; |
| 10010 | 926 account = session->account; |
| 927 gc = gaim_account_get_connection(account); | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
928 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
929 state = cmd->params[0]; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
930 passport = cmd->params[1]; |
| 19787 | 931 wlmclient = atoi(cmd->params[2]); |
| 932 friendly = gaim_url_decode(cmd->params[3]); | |
| 5309 | 933 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
934 user = msn_userlist_find_user(session->userlist, passport); |
|
6858
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
935 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
936 serv_got_alias(gc, passport, friendly); |
|
6833
ccfbd7c552ba
[gaim-migrate @ 7378]
Christian Hammond <chipx86@chipx86.com>
parents:
6830
diff
changeset
|
937 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
938 msn_user_set_friendly_name(user, friendly); |
|
6858
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
939 |
| 19785 | 940 if (session->protocol_ver >= 9){ |
| 19832 | 941 if (cmd->param_count == 7){ |
| 19787 | 942 msnobj = msn_object_new_from_string(gaim_url_decode(cmd->params[5])); |
| 9859 | 943 msn_user_set_object(user, msnobj); |
| 19785 | 944 }else{ |
| 9859 | 945 msn_user_set_object(user, NULL); |
| 946 } | |
|
6829
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
947 } |
|
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
948 |
| 19787 | 949 clientid = atoi(cmd->params[4]); |
|
11819
1452a3a9f07a
[gaim-migrate @ 14110]
Richard Laager <rlaager@wiktel.com>
parents:
11321
diff
changeset
|
950 user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE); |
|
1452a3a9f07a
[gaim-migrate @ 14110]
Richard Laager <rlaager@wiktel.com>
parents:
11321
diff
changeset
|
951 |
| 10451 | 952 msn_user_set_state(user, state); |
| 953 msn_user_update(user); | |
|
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
954 } |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
955 |
| 11992 | 956 #if 0 |
|
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
957 static void |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
958 chg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
959 { |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
960 char *state = cmd->params[1]; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
961 int state_id = 0; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
962 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
963 if (!strcmp(state, "NLN")) |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
964 state_id = MSN_ONLINE; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
965 else if (!strcmp(state, "BSY")) |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
966 state_id = MSN_BUSY; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
967 else if (!strcmp(state, "IDL")) |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
968 state_id = MSN_IDLE; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
969 else if (!strcmp(state, "BRB")) |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
970 state_id = MSN_BRB; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
971 else if (!strcmp(state, "AWY")) |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
972 state_id = MSN_AWAY; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
973 else if (!strcmp(state, "PHN")) |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
974 state_id = MSN_PHONE; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
975 else if (!strcmp(state, "LUN")) |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
976 state_id = MSN_LUNCH; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
977 else if (!strcmp(state, "HDN")) |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
978 state_id = MSN_HIDDEN; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
979 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
980 cmdproc->session->state = state_id; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
981 } |
| 11992 | 982 #endif |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
983 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
984 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
985 static void |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
986 not_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) |
|
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
987 { |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
988 #if 0 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
989 MSN_SET_PARAMS("NOT %d\r\n%s", cmdproc->servconn->payload, payload); |
|
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
990 gaim_debug_misc("msn", "Notification: {%s}\n", payload); |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
991 #endif |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
992 } |
| 5309 | 993 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
994 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
995 not_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
996 { |
| 8926 | 997 cmdproc->servconn->payload_len = atoi(cmd->params[0]); |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
998 cmdproc->last_cmd->payload_cb = not_cmd_post; |
|
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
999 } |
|
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1000 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1001 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1002 rea_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 5309 | 1003 { |
| 10451 | 1004 /* TODO: This might be for us too */ |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1005 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1006 MsnSession *session; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1007 GaimConnection *gc; |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1008 const char *friendly; |
| 5309 | 1009 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1010 session = cmdproc->session; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1011 gc = session->account->gc; |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1012 friendly = gaim_url_decode(cmd->params[3]); |
| 5309 | 1013 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1014 gaim_connection_set_display_name(gc, friendly); |
| 5309 | 1015 } |
| 1016 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1017 static void |
| 10833 | 1018 prp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 1019 { | |
| 1020 MsnSession *session = cmdproc->session; | |
| 1021 const char *type, *value; | |
| 1022 | |
| 1023 g_return_if_fail(cmd->param_count >= 3); | |
| 1024 | |
| 1025 type = cmd->params[2]; | |
| 1026 | |
| 1027 if (cmd->param_count == 4) | |
| 1028 { | |
| 1029 value = cmd->params[3]; | |
| 1030 if (!strcmp(type, "PHH")) | |
| 1031 msn_user_set_home_phone(session->user, gaim_url_decode(value)); | |
| 1032 else if (!strcmp(type, "PHW")) | |
| 1033 msn_user_set_work_phone(session->user, gaim_url_decode(value)); | |
| 1034 else if (!strcmp(type, "PHM")) | |
| 1035 msn_user_set_mobile_phone(session->user, gaim_url_decode(value)); | |
| 1036 } | |
| 1037 else | |
| 1038 { | |
| 1039 if (!strcmp(type, "PHH")) | |
| 1040 msn_user_set_home_phone(session->user, NULL); | |
| 1041 else if (!strcmp(type, "PHW")) | |
| 1042 msn_user_set_work_phone(session->user, NULL); | |
| 1043 else if (!strcmp(type, "PHM")) | |
| 1044 msn_user_set_mobile_phone(session->user, NULL); | |
| 1045 } | |
| 1046 } | |
| 1047 | |
| 1048 static void | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1049 reg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
|
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1050 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1051 MsnSession *session; |
|
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1052 int group_id; |
| 7162 | 1053 const char *group_name; |
|
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1054 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1055 session = cmdproc->session; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1056 group_id = atoi(cmd->params[2]); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1057 group_name = gaim_url_decode(cmd->params[3]); |
|
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1058 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1059 msn_userlist_rename_group_id(session->userlist, group_id, group_name); |
|
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1060 } |
|
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1061 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1062 static void |
| 10451 | 1063 reg_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) |
| 1064 { | |
| 19800 | 1065 const char * group_id; |
| 10451 | 1066 char **params; |
| 1067 | |
| 1068 params = g_strsplit(trans->params, " ", 0); | |
| 1069 | |
| 19800 | 1070 group_id = params[0]; |
| 10451 | 1071 |
| 1072 group_error_helper(cmdproc->session, _("Unable to rename group"), group_id, error); | |
| 1073 | |
| 1074 g_strfreev(params); | |
| 1075 } | |
| 1076 | |
| 1077 static void | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1078 rem_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
|
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1079 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1080 MsnSession *session; |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1081 MsnUser *user; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1082 const char *list; |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1083 const char *passport; |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1084 MsnListId list_id; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1085 int group_id; |
|
6772
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1086 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1087 session = cmdproc->session; |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1088 list = cmd->params[1]; |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1089 passport = cmd->params[3]; |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1090 user = msn_userlist_find_user(session->userlist, passport); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1091 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1092 g_return_if_fail(user != NULL); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1093 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1094 list_id = msn_get_list_id(list); |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1095 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1096 if (cmd->param_count == 5) |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1097 group_id = atoi(cmd->params[4]); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1098 else |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1099 group_id = -1; |
|
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1100 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1101 msn_got_rem_user(session, user, list_id, group_id); |
| 10451 | 1102 msn_user_update(user); |
|
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1103 } |
|
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1104 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1105 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1106 rmg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
|
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1107 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1108 MsnSession *session; |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1109 int group_id; |
|
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1110 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1111 session = cmdproc->session; |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1112 group_id = atoi(cmd->params[2]); |
|
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1113 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1114 msn_userlist_remove_group_id(session->userlist, group_id); |
|
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1115 } |
|
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1116 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1117 static void |
| 10451 | 1118 rmg_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) |
| 1119 { | |
| 1120 int group_id; | |
| 1121 char **params; | |
| 1122 | |
| 1123 params = g_strsplit(trans->params, " ", 0); | |
| 1124 | |
| 1125 group_id = atoi(params[0]); | |
| 1126 | |
| 10452 | 1127 group_error_helper(cmdproc->session, _("Unable to delete group"), group_id, error); |
| 10451 | 1128 |
| 1129 g_strfreev(params); | |
| 1130 } | |
| 1131 | |
| 1132 static void | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1133 syn_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1134 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1135 MsnSession *session; |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1136 int total_users; |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1137 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1138 session = cmdproc->session; |
| 10269 | 1139 |
| 1140 if (cmd->param_count == 2) | |
| 1141 { | |
| 1142 /* | |
| 1143 * This can happen if we sent a SYN with an up-to-date | |
| 1144 * buddy list revision, but we send 0 to get a full list. | |
| 1145 * So, error out. | |
| 1146 */ | |
| 1147 | |
| 10481 | 1148 msn_session_set_error(cmdproc->session, MSN_ERROR_BAD_BLIST, NULL); |
| 10269 | 1149 return; |
| 1150 } | |
| 1151 | |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1152 total_users = atoi(cmd->params[2]); |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1153 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1154 if (total_users == 0) |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1155 { |
|
10044
86a6d78b070b
[gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
10043
diff
changeset
|
1156 msn_session_finish_login(session); |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1157 } |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1158 else |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1159 { |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1160 /* syn_table */ |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1161 MsnSync *sync; |
|
8613
b0ceb2a9e122
[gaim-migrate @ 9364]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
1162 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1163 sync = msn_sync_new(session); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1164 sync->total_users = total_users; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1165 sync->old_cbs_table = cmdproc->cbs_table; |
|
7289
ab2085024a29
[gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
1166 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1167 session->sync = sync; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1168 cmdproc->cbs_table = sync->cbs_table; |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1169 } |
|
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1170 } |
|
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1171 |
| 5309 | 1172 /************************************************************************** |
| 1173 * Misc commands | |
| 1174 **************************************************************************/ | |
| 10481 | 1175 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1176 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1177 url_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 5309 | 1178 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1179 MsnSession *session; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1180 GaimAccount *account; |
| 5309 | 1181 const char *rru; |
| 1182 const char *url; | |
|
10684
72a5babfa8b4
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10647
diff
changeset
|
1183 GaimCipher *cipher; |
|
72a5babfa8b4
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10647
diff
changeset
|
1184 GaimCipherContext *context; |
| 11183 | 1185 guchar digest[16]; |
| 5309 | 1186 FILE *fd; |
| 11164 | 1187 char *buf; |
| 5309 | 1188 char buf2[3]; |
| 1189 char sendbuf[64]; | |
| 1190 int i; | |
| 1191 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1192 session = cmdproc->session; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1193 account = session->account; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1194 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1195 rru = cmd->params[1]; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1196 url = cmd->params[2]; |
| 5309 | 1197 |
| 11164 | 1198 buf = g_strdup_printf("%s%lu%s", |
| 5309 | 1199 session->passport_info.mspauth, |
|
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1200 time(NULL) - session->passport_info.sl, |
| 10740 | 1201 gaim_connection_get_password(account->gc)); |
| 5309 | 1202 |
|
10684
72a5babfa8b4
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10647
diff
changeset
|
1203 cipher = gaim_ciphers_find_cipher("md5"); |
|
72a5babfa8b4
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10647
diff
changeset
|
1204 context = gaim_cipher_context_new(cipher, NULL); |
|
72a5babfa8b4
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10647
diff
changeset
|
1205 |
| 11183 | 1206 gaim_cipher_context_append(context, (const guchar *)buf, strlen(buf)); |
|
10687
b256ce6b85b8
[gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10684
diff
changeset
|
1207 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); |
|
10684
72a5babfa8b4
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10647
diff
changeset
|
1208 gaim_cipher_context_destroy(context); |
| 5309 | 1209 |
| 11164 | 1210 g_free(buf); |
| 1211 | |
| 5309 | 1212 memset(sendbuf, 0, sizeof(sendbuf)); |
| 1213 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1214 for (i = 0; i < 16; i++) |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1215 { |
|
10684
72a5babfa8b4
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10647
diff
changeset
|
1216 g_snprintf(buf2, sizeof(buf2), "%02x", digest[i]); |
| 5309 | 1217 strcat(sendbuf, buf2); |
| 1218 } | |
| 1219 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1220 if (session->passport_info.file != NULL) |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1221 { |
|
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10568
diff
changeset
|
1222 g_unlink(session->passport_info.file); |
| 5309 | 1223 g_free(session->passport_info.file); |
| 1224 } | |
| 1225 | |
|
10203
7ff9b8b22e7d
[gaim-migrate @ 11324]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10057
diff
changeset
|
1226 if ((fd = gaim_mkstemp(&session->passport_info.file, FALSE)) == NULL) |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1227 { |
| 10345 | 1228 gaim_debug_error("msn", |
| 1229 "Error opening temp passport file: %s\n", | |
| 1230 strerror(errno)); | |
| 5309 | 1231 } |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1232 else |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1233 { |
| 5309 | 1234 fputs("<html>\n" |
| 1235 "<head>\n" | |
| 1236 "<noscript>\n" | |
| 1237 "<meta http-equiv=\"Refresh\" content=\"0; " | |
|
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1238 "url=http://www.hotmail.com\">\n" |
| 5309 | 1239 "</noscript>\n" |
| 1240 "</head>\n\n", | |
| 1241 fd); | |
| 1242 | |
| 1243 fprintf(fd, "<body onload=\"document.pform.submit(); \">\n"); | |
| 1244 fprintf(fd, "<form name=\"pform\" action=\"%s\" method=\"POST\">\n\n", | |
| 1245 url); | |
| 1246 fprintf(fd, "<input type=\"hidden\" name=\"mode\" value=\"ttl\">\n"); | |
| 1247 fprintf(fd, "<input type=\"hidden\" name=\"login\" value=\"%s\">\n", | |
|
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1248 gaim_account_get_username(account)); |
| 5309 | 1249 fprintf(fd, "<input type=\"hidden\" name=\"username\" value=\"%s\">\n", |
|
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1250 gaim_account_get_username(account)); |
| 5309 | 1251 fprintf(fd, "<input type=\"hidden\" name=\"sid\" value=\"%s\">\n", |
| 1252 session->passport_info.sid); | |
| 1253 fprintf(fd, "<input type=\"hidden\" name=\"kv\" value=\"%s\">\n", | |
| 1254 session->passport_info.kv); | |
| 1255 fprintf(fd, "<input type=\"hidden\" name=\"id\" value=\"2\">\n"); | |
| 1256 fprintf(fd, "<input type=\"hidden\" name=\"sl\" value=\"%ld\">\n", | |
| 1257 time(NULL) - session->passport_info.sl); | |
| 1258 fprintf(fd, "<input type=\"hidden\" name=\"rru\" value=\"%s\">\n", | |
| 1259 rru); | |
| 1260 fprintf(fd, "<input type=\"hidden\" name=\"auth\" value=\"%s\">\n", | |
| 1261 session->passport_info.mspauth); | |
| 1262 fprintf(fd, "<input type=\"hidden\" name=\"creds\" value=\"%s\">\n", | |
| 1263 sendbuf); /* TODO Digest me (huh? -- ChipX86) */ | |
| 1264 fprintf(fd, "<input type=\"hidden\" name=\"svc\" value=\"mail\">\n"); | |
| 7699 | 1265 fprintf(fd, "<input type=\"hidden\" name=\"js\" value=\"yes\">\n"); |
| 5309 | 1266 fprintf(fd, "</form></body>\n"); |
| 1267 fprintf(fd, "</html>\n"); | |
| 1268 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1269 if (fclose(fd)) |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1270 { |
|
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1271 gaim_debug_error("msn", |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1272 "Error closing temp passport file: %s\n", |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1273 strerror(errno)); |
| 5309 | 1274 |
|
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10568
diff
changeset
|
1275 g_unlink(session->passport_info.file); |
| 5309 | 1276 g_free(session->passport_info.file); |
|
10240
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10225
diff
changeset
|
1277 session->passport_info.file = NULL; |
| 5309 | 1278 } |
|
10647
7d13c04387ad
[gaim-migrate @ 12163]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10629
diff
changeset
|
1279 #ifdef _WIN32 |
|
10629
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1280 else |
|
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1281 { |
|
10647
7d13c04387ad
[gaim-migrate @ 12163]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10629
diff
changeset
|
1282 /* |
|
10629
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1283 * Renaming file with .html extension, so that the |
|
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1284 * win32 open_url will work. |
|
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1285 */ |
|
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1286 char *tmp; |
|
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1287 |
|
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1288 if ((tmp = |
|
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1289 g_strdup_printf("%s.html", |
|
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1290 session->passport_info.file)) != NULL) |
|
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1291 { |
|
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1292 if (g_rename(session->passport_info.file, |
|
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1293 tmp) == 0) |
|
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1294 { |
|
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1295 g_free(session->passport_info.file); |
|
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1296 session->passport_info.file = tmp; |
|
10647
7d13c04387ad
[gaim-migrate @ 12163]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10629
diff
changeset
|
1297 } |
|
10629
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1298 else |
|
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1299 g_free(tmp); |
|
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1300 } |
|
d93621a98f12
[gaim-migrate @ 12106]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
1301 } |
|
10647
7d13c04387ad
[gaim-migrate @ 12163]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10629
diff
changeset
|
1302 #endif |
| 5309 | 1303 } |
| 1304 } | |
| 1305 /************************************************************************** | |
| 1306 * Switchboards | |
| 1307 **************************************************************************/ | |
| 10481 | 1308 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1309 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1310 rng_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 5309 | 1311 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1312 MsnSession *session; |
| 5309 | 1313 MsnSwitchBoard *swboard; |
| 1314 const char *session_id; | |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1315 char *host; |
| 5309 | 1316 int port; |
| 1317 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1318 session = cmdproc->session; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1319 session_id = cmd->params[0]; |
| 5309 | 1320 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1321 msn_parse_socket(cmd->params[1], &host, &port); |
| 5309 | 1322 |
|
7288
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7274
diff
changeset
|
1323 if (session->http_method) |
|
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7274
diff
changeset
|
1324 port = 80; |
|
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7274
diff
changeset
|
1325 |
| 5309 | 1326 swboard = msn_switchboard_new(session); |
| 1327 | |
| 1328 msn_switchboard_set_invited(swboard, TRUE); | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1329 msn_switchboard_set_session_id(swboard, cmd->params[0]); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1330 msn_switchboard_set_auth_key(swboard, cmd->params[3]); |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1331 swboard->im_user = g_strdup(cmd->params[4]); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1332 /* msn_switchboard_add_user(swboard, cmd->params[4]); */ |
| 5309 | 1333 |
| 10568 | 1334 if (!msn_switchboard_connect(swboard, host, port)) |
| 1335 msn_switchboard_destroy(swboard); | |
| 5309 | 1336 |
| 1337 g_free(host); | |
| 1338 } | |
| 1339 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1340 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1341 xfr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 5309 | 1342 { |
| 1343 char *host; | |
| 1344 int port; | |
| 1345 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1346 if (strcmp(cmd->params[1], "SB") && strcmp(cmd->params[1], "NS")) |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1347 { |
| 10481 | 1348 /* Maybe we can have a generic bad command error. */ |
| 1349 gaim_debug_error("msn", "Bad XFR command (%s)\n", cmd->params[1]); | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1350 return; |
| 5309 | 1351 } |
| 1352 | |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1353 msn_parse_socket(cmd->params[2], &host, &port); |
| 5309 | 1354 |
| 19784 | 1355 if (!strcmp(cmd->params[1], "SB")){ |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1356 gaim_debug_error("msn", "This shouldn't be handled here.\n"); |
| 19784 | 1357 }else if (!strcmp(cmd->params[1], "NS")){ |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1358 MsnSession *session; |
|
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
1359 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1360 session = cmdproc->session; |
| 5309 | 1361 |
| 10519 | 1362 msn_session_set_login_step(session, MSN_LOGIN_STEP_TRANSFER); |
| 10481 | 1363 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1364 msn_notification_connect(session->notification, host, port); |
| 5309 | 1365 } |
| 1366 | |
| 1367 g_free(host); | |
| 1368 } | |
| 1369 | |
| 19783 | 1370 static void |
| 19797 | 1371 gcf_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, |
| 1372 size_t len) | |
| 1373 { | |
| 1374 /*get the payload content*/ | |
| 1375 gaim_debug_info("MaYuan","GCF{%s}\n",cmd->payload); | |
| 1376 } | |
| 1377 | |
| 1378 static void | |
| 19783 | 1379 gcf_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 1380 { | |
| 1381 gaim_debug_info("MaYuan","Processing GCF... \n"); | |
| 19797 | 1382 cmdproc->last_cmd->payload_cb = gcf_cmd_post; |
| 1383 return; | |
| 19783 | 1384 } |
| 1385 | |
| 1386 static void | |
| 1387 sbs_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) | |
| 1388 { | |
| 1389 gaim_debug_info("MaYuan","Processing SBS... \n"); | |
| 1390 if(cmd->payload_len == 0){ | |
| 1391 return; | |
| 1392 } | |
| 1393 /*get the payload content*/ | |
| 1394 } | |
| 1395 | |
| 19818 | 1396 /* |
| 1397 * Get the UBX's PSM info | |
| 1398 * Post it to the User status | |
| 1399 * Thanks for Chris <ukdrizzle@yahoo.co.uk>'s code | |
| 1400 */ | |
| 19786 | 1401 static void |
| 19803 | 1402 ubx_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, |
| 1403 size_t len) | |
| 1404 { | |
| 19818 | 1405 MsnSession *session; |
| 1406 GaimAccount *account; | |
| 1407 GaimConnection *gc; | |
| 1408 MsnUser *user; | |
| 1409 const char *passport, *psm_str; | |
| 1410 | |
| 19803 | 1411 /*get the payload content*/ |
| 19818 | 1412 gaim_debug_info("MaYuan","UBX {%s} payload{%s}\n",cmd->params[0], cmd->payload); |
| 1413 | |
| 1414 session = cmdproc->session; | |
| 1415 account = session->account; | |
| 1416 gc = gaim_account_get_connection(account); | |
| 1417 | |
| 1418 passport = cmd->params[0]; | |
| 1419 user = msn_userlist_find_user(session->userlist, passport); | |
| 1420 | |
| 1421 psm_str = msn_get_psm(cmd->payload,len); | |
| 1422 msn_user_set_statusline(user, psm_str); | |
| 1423 msn_user_update(user); | |
| 1424 | |
| 1425 g_free(psm_str); | |
| 19803 | 1426 } |
| 1427 | |
| 1428 static void | |
| 19786 | 1429 ubx_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
| 1430 { | |
| 1431 gaim_debug_info("MaYuan","UBX... \n"); | |
| 19803 | 1432 if(cmd->payload_len == 0){ |
| 1433 return; | |
| 1434 } | |
| 1435 cmdproc->last_cmd->payload_cb = ubx_cmd_post; | |
| 19786 | 1436 } |
| 1437 | |
| 1438 static void | |
| 1439 uux_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) | |
| 1440 { | |
| 1441 gaim_debug_info("MaYuan","UUX... \n"); | |
| 1442 } | |
| 1443 | |
| 5309 | 1444 /************************************************************************** |
| 1445 * Message Types | |
| 1446 **************************************************************************/ | |
| 10481 | 1447 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1448 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1449 profile_msg(MsnCmdProc *cmdproc, MsnMessage *msg) |
| 5309 | 1450 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1451 MsnSession *session; |
| 5309 | 1452 const char *value; |
| 1453 | |
| 19784 | 1454 gaim_debug_info("MaYuan","profile_msg... \n"); |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1455 session = cmdproc->session; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1456 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1457 if (strcmp(msg->remote_user, "Hotmail")) |
|
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1458 /* This isn't an official message. */ |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1459 return; |
|
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1460 |
| 19784 | 1461 if ((value = msn_message_get_attr(msg, "kv")) != NULL){ |
| 10284 | 1462 if (session->passport_info.kv != NULL) |
| 1463 g_free(session->passport_info.kv); | |
| 1464 | |
| 5309 | 1465 session->passport_info.kv = g_strdup(value); |
| 10284 | 1466 } |
| 5309 | 1467 |
| 19784 | 1468 if ((value = msn_message_get_attr(msg, "sid")) != NULL){ |
| 10284 | 1469 if (session->passport_info.sid != NULL) |
| 1470 g_free(session->passport_info.sid); | |
| 1471 | |
| 5309 | 1472 session->passport_info.sid = g_strdup(value); |
| 10284 | 1473 } |
| 5309 | 1474 |
| 19784 | 1475 if ((value = msn_message_get_attr(msg, "MSPAuth")) != NULL){ |
| 10284 | 1476 if (session->passport_info.mspauth != NULL) |
| 1477 g_free(session->passport_info.mspauth); | |
| 1478 | |
| 19784 | 1479 gaim_debug_info("MaYuan","MSPAuth:%s\n",value); |
| 5309 | 1480 session->passport_info.mspauth = g_strdup(value); |
| 10284 | 1481 } |
| 5309 | 1482 |
| 19784 | 1483 if ((value = msn_message_get_attr(msg, "ClientIP")) != NULL){ |
| 10284 | 1484 if (session->passport_info.client_ip != NULL) |
| 1485 g_free(session->passport_info.client_ip); | |
| 1486 | |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1487 session->passport_info.client_ip = g_strdup(value); |
| 10284 | 1488 } |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1489 |
| 19784 | 1490 if ((value = msn_message_get_attr(msg, "ClientPort")) != NULL){ |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1491 session->passport_info.client_port = ntohs(atoi(value)); |
| 19784 | 1492 } |
| 10275 | 1493 |
| 1494 if ((value = msn_message_get_attr(msg, "LoginTime")) != NULL) | |
| 1495 session->passport_info.sl = atol(value); | |
| 19784 | 1496 |
| 1497 /*starting retrieve the contact list*/ | |
| 1498 session->contact = msn_contact_new(session); | |
| 19806 | 1499 msn_get_contact_list(session->contact); |
| 1500 // msn_contact_connect(session->contact); | |
| 5309 | 1501 } |
| 1502 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1503 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1504 initial_email_msg(MsnCmdProc *cmdproc, MsnMessage *msg) |
| 5309 | 1505 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1506 MsnSession *session; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1507 GaimConnection *gc; |
| 5309 | 1508 GHashTable *table; |
| 1509 const char *unread; | |
| 1510 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1511 session = cmdproc->session; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1512 gc = session->account->gc; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1513 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1514 if (strcmp(msg->remote_user, "Hotmail")) |
|
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1515 /* This isn't an official message. */ |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1516 return; |
|
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1517 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1518 if (session->passport_info.file == NULL) |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1519 { |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1520 MsnTransaction *trans; |
| 10225 | 1521 trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX"); |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1522 msn_transaction_queue_cmd(trans, msg->cmd); |
|
5506
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1523 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1524 msn_cmdproc_send_trans(cmdproc, trans); |
|
5506
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1525 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1526 return; |
|
5358
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1527 } |
|
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1528 |
| 11321 | 1529 if (!gaim_account_get_check_mail(session->account)) |
| 1530 return; | |
| 1531 | |
| 5309 | 1532 table = msn_message_get_hashtable_from_body(msg); |
| 1533 | |
| 1534 unread = g_hash_table_lookup(table, "Inbox-Unread"); | |
| 1535 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1536 if (unread != NULL) |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1537 { |
|
7190
13c725566078
[gaim-migrate @ 7759]
Christian Hammond <chipx86@chipx86.com>
parents:
7188
diff
changeset
|
1538 int count = atoi(unread); |
|
13c725566078
[gaim-migrate @ 7759]
Christian Hammond <chipx86@chipx86.com>
parents:
7188
diff
changeset
|
1539 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1540 if (count > 0) |
|
7190
13c725566078
[gaim-migrate @ 7759]
Christian Hammond <chipx86@chipx86.com>
parents:
7188
diff
changeset
|
1541 { |
|
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1542 const char *passport; |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1543 const char *url; |
|
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1544 |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1545 passport = msn_user_get_passport(session->user); |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1546 url = session->passport_info.file; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1547 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1548 gaim_notify_emails(gc, atoi(unread), FALSE, NULL, NULL, |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1549 &passport, &url, NULL, NULL); |
|
7190
13c725566078
[gaim-migrate @ 7759]
Christian Hammond <chipx86@chipx86.com>
parents:
7188
diff
changeset
|
1550 } |
|
5520
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1551 } |
| 5309 | 1552 |
| 1553 g_hash_table_destroy(table); | |
| 1554 } | |
| 1555 | |
| 19791 | 1556 /*offline Message notification process*/ |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1557 static void |
| 19785 | 1558 initial_mdata_msg(MsnCmdProc *cmdproc, MsnMessage *msg) |
| 1559 { | |
| 19788 | 1560 MsnSession *session; |
| 1561 char **elems, **cur, **tokens; | |
| 1562 | |
| 1563 // gaim_debug_info("MaYuan","mdata...{%s} \n",msg->body); | |
| 1564 | |
| 19794 | 1565 // /*time debug*/ |
| 1566 { | |
| 1567 const char *timestr; | |
| 1568 time_t t; | |
| 1569 struct tm *tm; | |
| 1570 char datestr[]="2006-07-15T07:21:26+0700"; | |
| 1571 GDate *date; | |
| 1572 time(&t); | |
| 1573 tm = gmtime(&t); | |
| 1574 timestr = gaim_utf8_strftime("%a, %d %b %Y %T %Z", tm); | |
| 1575 // strftime(datestr,strlen(datestr),"%a",tm); | |
| 1576 date = g_date_new(); | |
| 1577 g_date_set_parse(date,datestr); | |
| 1578 gaim_debug_info("MaYuan","date is NULL?date valid%d\n",g_date_valid(date)); | |
| 1579 g_date_free(date); | |
| 1580 gaim_debug_info("MaYuan","utf8 time:{%s}\n",timestr); | |
| 1581 } | |
| 1582 | |
| 19788 | 1583 /*new a oim session*/ |
| 1584 session = cmdproc->session; | |
| 1585 session->oim = msn_oim_new(session); | |
| 19789 | 1586 // msn_oim_connect(session->oim); |
| 19788 | 1587 |
| 1588 /*parse offline message data*/ | |
| 1589 elems = g_strsplit(msg->body, "\r\n", 0); | |
| 1590 for (cur = elems; *cur != NULL; cur++){ | |
| 1591 const char *key, *value; | |
| 1592 | |
| 1593 // gaim_debug_info("MaYuan","cur:{%s}\n",*cur); | |
| 1594 tokens = g_strsplit(*cur, ": ", 2); | |
| 1595 | |
| 1596 key = tokens[0]; | |
| 1597 value = tokens[1]; | |
| 1598 | |
| 1599 /*if not MIME content ,then return*/ | |
| 1600 if ((key != NULL) && (!strcmp(key, "Mail-Data")) ){ | |
| 1601 // gaim_debug_info("MaYuan","data:{%s}\n",value); | |
| 1602 msn_parse_oim_msg(session->oim,value); | |
| 1603 g_strfreev(tokens); | |
| 1604 break; | |
| 1605 } | |
| 1606 | |
| 1607 g_strfreev(tokens); | |
| 1608 } | |
| 1609 | |
| 1610 g_strfreev(elems); | |
| 19795 | 1611 /* test code for add group*/ |
| 1612 // msn_add_group(session,"hello"); | |
| 19785 | 1613 } |
| 1614 | |
| 19822 | 1615 /*offline Message Notification*/ |
| 1616 static void | |
| 1617 delete_oim_msg(MsnCmdProc *cmdproc, MsnMessage *msg) | |
| 1618 { | |
| 1619 } | |
| 1620 | |
| 19785 | 1621 static void |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1622 email_msg(MsnCmdProc *cmdproc, MsnMessage *msg) |
| 5309 | 1623 { |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1624 MsnSession *session; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1625 GaimConnection *gc; |
| 5309 | 1626 GHashTable *table; |
|
8657
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1627 char *from, *subject, *tmp; |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1628 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1629 session = cmdproc->session; |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1630 gc = session->account->gc; |
|
8657
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1631 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1632 if (strcmp(msg->remote_user, "Hotmail")) |
|
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1633 /* This isn't an official message. */ |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1634 return; |
|
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1635 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1636 if (session->passport_info.file == NULL) |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1637 { |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1638 MsnTransaction *trans; |
| 10225 | 1639 trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX"); |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1640 msn_transaction_queue_cmd(trans, msg->cmd); |
|
5506
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1641 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1642 msn_cmdproc_send_trans(cmdproc, trans); |
|
5506
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1643 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1644 return; |
|
5358
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1645 } |
|
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1646 |
| 11321 | 1647 if (!gaim_account_get_check_mail(session->account)) |
| 1648 return; | |
| 1649 | |
| 5309 | 1650 table = msn_message_get_hashtable_from_body(msg); |
| 1651 | |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1652 from = subject = NULL; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1653 |
|
8657
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1654 tmp = g_hash_table_lookup(table, "From"); |
|
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1655 if (tmp != NULL) |
|
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1656 from = gaim_mime_decode_field(tmp); |
|
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1657 |
|
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1658 tmp = g_hash_table_lookup(table, "Subject"); |
|
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1659 if (tmp != NULL) |
|
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1660 subject = gaim_mime_decode_field(tmp); |
| 5309 | 1661 |
|
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1662 gaim_notify_email(gc, |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1663 (subject != NULL ? subject : ""), |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1664 (from != NULL ? from : ""), |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1665 msn_user_get_passport(session->user), |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1666 session->passport_info.file, NULL, NULL); |
| 5309 | 1667 |
|
8657
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1668 if (from != NULL) |
|
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1669 g_free(from); |
|
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1670 |
|
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1671 if (subject != NULL) |
|
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1672 g_free(subject); |
| 7817 | 1673 |
| 5309 | 1674 g_hash_table_destroy(table); |
| 1675 } | |
| 1676 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1677 static void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1678 system_msg(MsnCmdProc *cmdproc, MsnMessage *msg) |
|
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1679 { |
|
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1680 GHashTable *table; |
|
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1681 const char *type_s; |
|
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1682 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1683 if (strcmp(msg->remote_user, "Hotmail")) |
|
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1684 /* This isn't an official message. */ |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1685 return; |
|
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1686 |
|
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1687 table = msn_message_get_hashtable_from_body(msg); |
|
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1688 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1689 if ((type_s = g_hash_table_lookup(table, "Type")) != NULL) |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1690 { |
|
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1691 int type = atoi(type_s); |
|
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1692 char buf[MSN_BUF_LEN]; |
| 6308 | 1693 int minutes; |
|
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1694 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1695 switch (type) |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1696 { |
|
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1697 case 1: |
| 6308 | 1698 minutes = atoi(g_hash_table_lookup(table, "Arg1")); |
| 1699 g_snprintf(buf, sizeof(buf), ngettext( | |
|
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1700 "The MSN server will shut down for maintenance " |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1701 "in %d minute. You will automatically be " |
|
10816
c94f40ffcafb
[gaim-migrate @ 12471]
Luke Schierer <lschiere@pidgin.im>
parents:
10812
diff
changeset
|
1702 "signed out at that time. Please finish any " |
|
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1703 "conversations in progress.\n\nAfter the " |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1704 "maintenance has been completed, you will be " |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1705 "able to successfully sign in.", |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1706 "The MSN server will shut down for maintenance " |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1707 "in %d minutes. You will automatically be " |
|
10816
c94f40ffcafb
[gaim-migrate @ 12471]
Luke Schierer <lschiere@pidgin.im>
parents:
10812
diff
changeset
|
1708 "signed out at that time. Please finish any " |
|
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1709 "conversations in progress.\n\nAfter the " |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1710 "maintenance has been completed, you will be " |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1711 "able to successfully sign in.", minutes), |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1712 minutes); |
|
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1713 default: |
|
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1714 break; |
|
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1715 } |
|
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1716 |
|
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5406
diff
changeset
|
1717 if (*buf != '\0') |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1718 gaim_notify_info(cmdproc->session->account->gc, NULL, buf, NULL); |
|
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1719 } |
|
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1720 |
|
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1721 g_hash_table_destroy(table); |
|
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1722 } |
|
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1723 |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1724 void |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1725 msn_notification_add_buddy(MsnNotification *notification, const char *list, |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1726 const char *who, const char *store_name, |
| 19786 | 1727 const char *group_id) |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1728 { |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1729 MsnCmdProc *cmdproc; |
| 19796 | 1730 MsnTransaction *trans; |
| 1731 xmlnode *adl_node; | |
| 1732 char *payload; | |
| 1733 int payload_len; | |
| 1734 | |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1735 cmdproc = notification->servconn->cmdproc; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1736 |
| 19796 | 1737 if (strcmp(list, "FL") != 0){ |
| 1738 } | |
| 1739 | |
| 1740 adl_node = xmlnode_new("ml"); | |
| 1741 adl_node->child = NULL; | |
|
9194
364aa73323b5
[gaim-migrate @ 9989]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
1742 |
| 19831 | 1743 msn_add_contact_xml(adl_node,who,1,1); |
| 19796 | 1744 |
| 1745 payload = xmlnode_to_str(adl_node,&payload_len); | |
| 1746 xmlnode_free(adl_node); | |
| 19831 | 1747 if(msn_user_is_yahoo(notification->session->account,who)){ |
| 1748 msn_notification_fqy_yahoo(notification->session, who); | |
| 1749 }else{ | |
| 1750 msn_notification_post_adl(notification->servconn->cmdproc, | |
| 19803 | 1751 payload,payload_len); |
| 19831 | 1752 } |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1753 } |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1754 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1755 void |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1756 msn_notification_rem_buddy(MsnNotification *notification, const char *list, |
| 19786 | 1757 const char *who, const char *group_id) |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1758 { |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1759 MsnCmdProc *cmdproc; |
| 19796 | 1760 MsnTransaction *trans; |
| 1761 xmlnode *rml_node; | |
| 1762 char *payload; | |
| 1763 int payload_len; | |
| 1764 | |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1765 cmdproc = notification->servconn->cmdproc; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1766 |
| 19796 | 1767 rml_node = xmlnode_new("ml"); |
| 1768 rml_node->child = NULL; | |
| 1769 | |
| 19831 | 1770 msn_add_contact_xml(rml_node,who,1,1); |
| 19796 | 1771 |
| 1772 payload = xmlnode_to_str(rml_node,&payload_len); | |
| 1773 xmlnode_free(rml_node); | |
| 1774 | |
| 1775 gaim_debug_info("MaYuan","RML{%s}\n",payload); | |
| 1776 trans = msn_transaction_new(cmdproc, "RML","%d",strlen(payload)); | |
| 1777 msn_transaction_set_payload(trans, payload, strlen(payload)); | |
| 1778 msn_cmdproc_send_trans(cmdproc, trans); | |
| 5309 | 1779 } |
| 1780 | |
| 10463 | 1781 /************************************************************************** |
| 1782 * Init | |
| 1783 **************************************************************************/ | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1784 void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1785 msn_notification_init(void) |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1786 { |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1787 /* TODO: check prp, blp */ |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1788 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1789 cbs_table = msn_table_new(); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1790 |
| 10310 | 1791 /* Synchronous */ |
| 11992 | 1792 msn_table_add_cmd(cbs_table, "CHG", "CHG", NULL); |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1793 msn_table_add_cmd(cbs_table, "CHG", "ILN", iln_cmd); |
| 19786 | 1794 msn_table_add_cmd(cbs_table, "ADL", "ILN", iln_cmd); |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1795 msn_table_add_cmd(cbs_table, "REM", "REM", rem_cmd); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1796 msn_table_add_cmd(cbs_table, "USR", "USR", usr_cmd); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1797 msn_table_add_cmd(cbs_table, "USR", "XFR", xfr_cmd); |
| 19783 | 1798 msn_table_add_cmd(cbs_table, "USR", "GCF", gcf_cmd); |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1799 msn_table_add_cmd(cbs_table, "SYN", "SYN", syn_cmd); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1800 msn_table_add_cmd(cbs_table, "CVR", "CVR", cvr_cmd); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1801 msn_table_add_cmd(cbs_table, "VER", "VER", ver_cmd); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1802 msn_table_add_cmd(cbs_table, "REA", "REA", rea_cmd); |
| 10833 | 1803 msn_table_add_cmd(cbs_table, "PRP", "PRP", prp_cmd); |
| 19786 | 1804 msn_table_add_cmd(cbs_table, "BLP", "BLP", blp_cmd); |
| 1805 // msn_table_add_cmd(cbs_table, "BLP", "BLP", NULL); | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1806 msn_table_add_cmd(cbs_table, "REG", "REG", reg_cmd); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1807 msn_table_add_cmd(cbs_table, "ADG", "ADG", adg_cmd); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1808 msn_table_add_cmd(cbs_table, "RMG", "RMG", rmg_cmd); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1809 msn_table_add_cmd(cbs_table, "XFR", "XFR", xfr_cmd); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1810 |
| 10310 | 1811 /* Asynchronous */ |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1812 msn_table_add_cmd(cbs_table, NULL, "IPG", ipg_cmd); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1813 msn_table_add_cmd(cbs_table, NULL, "MSG", msg_cmd); |
| 19800 | 1814 msn_table_add_cmd(cbs_table, NULL, "UBM", ubm_cmd); |
| 19783 | 1815 msn_table_add_cmd(cbs_table, NULL, "GCF", gcf_cmd); |
| 1816 msn_table_add_cmd(cbs_table, NULL, "SBS", sbs_cmd); | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1817 msn_table_add_cmd(cbs_table, NULL, "NOT", not_cmd); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1818 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1819 msn_table_add_cmd(cbs_table, NULL, "CHL", chl_cmd); |
| 19795 | 1820 msn_table_add_cmd(cbs_table, NULL, "RML", rml_cmd); |
| 19786 | 1821 msn_table_add_cmd(cbs_table, NULL, "ADL", adl_cmd); |
| 19803 | 1822 msn_table_add_cmd(cbs_table, NULL, "FQY", fqy_cmd); |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1823 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1824 msn_table_add_cmd(cbs_table, NULL, "QRY", NULL); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1825 msn_table_add_cmd(cbs_table, NULL, "QNG", NULL); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1826 msn_table_add_cmd(cbs_table, NULL, "FLN", fln_cmd); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1827 msn_table_add_cmd(cbs_table, NULL, "NLN", nln_cmd); |
|
8832
c313e3b1f2c0
[gaim-migrate @ 9596]
Christian Hammond <chipx86@chipx86.com>
parents:
8808
diff
changeset
|
1828 msn_table_add_cmd(cbs_table, NULL, "ILN", iln_cmd); |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1829 msn_table_add_cmd(cbs_table, NULL, "OUT", out_cmd); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1830 msn_table_add_cmd(cbs_table, NULL, "RNG", rng_cmd); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1831 |
| 19786 | 1832 msn_table_add_cmd(cbs_table, NULL, "UBX", ubx_cmd); |
| 1833 msn_table_add_cmd(cbs_table, NULL, "UUX", uux_cmd); | |
| 1834 | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1835 msn_table_add_cmd(cbs_table, NULL, "URL", url_cmd); |
|
9194
364aa73323b5
[gaim-migrate @ 9989]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
1836 |
|
10043
700f8fb9e581
[gaim-migrate @ 11002]
Luke Schierer <lschiere@pidgin.im>
parents:
10010
diff
changeset
|
1837 msn_table_add_cmd(cbs_table, "fallback", "XFR", xfr_cmd); |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1838 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1839 msn_table_add_error(cbs_table, "ADD", add_error); |
| 10451 | 1840 msn_table_add_error(cbs_table, "REG", reg_error); |
| 1841 msn_table_add_error(cbs_table, "RMG", rmg_error); | |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1842 /* msn_table_add_error(cbs_table, "REA", rea_error); */ |
| 10568 | 1843 msn_table_add_error(cbs_table, "USR", usr_error); |
| 10403 | 1844 |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1845 msn_table_add_msg_type(cbs_table, |
|
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1846 "text/x-msmsgsprofile", |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1847 profile_msg); |
| 19791 | 1848 /*initial OIM notification*/ |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1849 msn_table_add_msg_type(cbs_table, |
| 19785 | 1850 "text/x-msmsgsinitialmdatanotification", |
| 1851 initial_mdata_msg); | |
| 19791 | 1852 /*OIM notification when user online*/ |
| 1853 msn_table_add_msg_type(cbs_table, | |
| 1854 "text/x-msmsgsoimnotification", | |
| 1855 initial_mdata_msg); | |
| 19785 | 1856 msn_table_add_msg_type(cbs_table, |
|
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1857 "text/x-msmsgsinitialemailnotification", |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1858 initial_email_msg); |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1859 msn_table_add_msg_type(cbs_table, |
|
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1860 "text/x-msmsgsemailnotification", |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1861 email_msg); |
| 19822 | 1862 /*delete an offline Message notification*/ |
| 1863 msn_table_add_msg_type(cbs_table, | |
| 1864 "text/x-msmsgsactivemailnotification", | |
| 1865 delete_oim_msg); | |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1866 msn_table_add_msg_type(cbs_table, |
|
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1867 "application/x-msmsgssystemmessage", |
|
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8926
diff
changeset
|
1868 system_msg); |
|
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1869 } |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1870 |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1871 void |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1872 msn_notification_end(void) |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1873 { |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1874 msn_table_destroy(cbs_table); |
|
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1875 } |
| 19791 | 1876 |
