Mercurial > pidgin
comparison libpurple/protocols/msn/slplink.c @ 30808:07a9356ad2e0
Remove the MsnMessage from SlpMessage.
author | masca@cpw.pidgin.im |
---|---|
date | Sat, 19 Jun 2010 21:48:19 +0000 |
parents | dfada77da5cb |
children | f4c86572e745 |
comparison
equal
deleted
inserted
replaced
30807:b7a814c4c4e9 | 30808:07a9356ad2e0 |
---|---|
32 #include "sbconn.h" | 32 #include "sbconn.h" |
33 #include "switchboard.h" | 33 #include "switchboard.h" |
34 #include "slp.h" | 34 #include "slp.h" |
35 #include "p2p.h" | 35 #include "p2p.h" |
36 | 36 |
37 #if 0 | |
37 #ifdef MSN_DEBUG_SLP_FILES | 38 #ifdef MSN_DEBUG_SLP_FILES |
38 static int m_sc = 0; | 39 static int m_sc = 0; |
39 static int m_rc = 0; | 40 static int m_rc = 0; |
40 | 41 |
41 static void | 42 static void |
56 purple_debug_error("msn", "could not save debug file\n"); | 57 purple_debug_error("msn", "could not save debug file\n"); |
57 } | 58 } |
58 g_free(tmp); | 59 g_free(tmp); |
59 } | 60 } |
60 #endif | 61 #endif |
62 #endif /* 0 */ | |
61 | 63 |
62 /************************************************************************** | 64 /************************************************************************** |
63 * Main | 65 * Main |
64 **************************************************************************/ | 66 **************************************************************************/ |
65 | 67 |
331 | 333 |
332 #if 0 | 334 #if 0 |
333 /* TODO: port this function to SlpMessageParts */ | 335 /* TODO: port this function to SlpMessageParts */ |
334 if (purple_debug_is_verbose()) | 336 if (purple_debug_is_verbose()) |
335 msn_message_show_readable(msg, slpmsg->info, slpmsg->text_body); | 337 msn_message_show_readable(msg, slpmsg->info, slpmsg->text_body); |
336 #endif | |
337 | 338 |
338 #ifdef MSN_DEBUG_SLP_FILES | 339 #ifdef MSN_DEBUG_SLP_FILES |
339 debug_msg_to_file(msg, TRUE); | 340 debug_msg_to_file(msg, TRUE); |
341 #endif | |
340 #endif | 342 #endif |
341 | 343 |
342 slpmsg->parts = g_list_append(slpmsg->parts, part); | 344 slpmsg->parts = g_list_append(slpmsg->parts, part); |
343 msn_slplink_send_part(slplink, part); | 345 msn_slplink_send_part(slplink, part); |
344 | 346 |
360 } | 362 } |
361 | 363 |
362 static void | 364 static void |
363 msn_slplink_release_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) | 365 msn_slplink_release_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) |
364 { | 366 { |
365 MsnMessage *msg; | 367 slpmsg = slpmsg; |
366 const char *passport; | 368 slpmsg->header = g_new0(MsnP2PHeader, 1); |
367 | 369 slpmsg->footer = g_new0(MsnP2PFooter, 1); |
368 slpmsg->msg = msg = msn_message_new_msnslp(); | |
369 | |
370 msg->slpmsg = slpmsg; | |
371 msg->slpmsg->header = g_new0(MsnP2PHeader, 1); | |
372 msg->slpmsg->footer = g_new0(MsnP2PFooter, 1); | |
373 | 370 |
374 if (slpmsg->flags == P2P_NO_FLAG) | 371 if (slpmsg->flags == P2P_NO_FLAG) |
375 { | 372 { |
376 msg->slpmsg->header->session_id = slpmsg->session_id; | 373 slpmsg->header->session_id = slpmsg->session_id; |
377 msg->slpmsg->header->ack_id = rand() % 0xFFFFFF00; | 374 slpmsg->header->ack_id = rand() % 0xFFFFFF00; |
378 } | 375 } |
379 else if (slpmsg->flags == P2P_ACK) | 376 else if (slpmsg->flags == P2P_ACK) |
380 { | 377 { |
381 msg->slpmsg->header->session_id = slpmsg->session_id; | 378 slpmsg->header->session_id = slpmsg->session_id; |
382 msg->slpmsg->header->ack_id = slpmsg->ack_id; | 379 slpmsg->header->ack_id = slpmsg->ack_id; |
383 msg->slpmsg->header->ack_size = slpmsg->ack_size; | 380 slpmsg->header->ack_size = slpmsg->ack_size; |
384 msg->slpmsg->header->ack_sub_id = slpmsg->ack_sub_id; | 381 slpmsg->header->ack_sub_id = slpmsg->ack_sub_id; |
385 } | 382 } |
386 else if (slpmsg->flags == P2P_MSN_OBJ_DATA || | 383 else if (slpmsg->flags == P2P_MSN_OBJ_DATA || |
387 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || | 384 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || |
388 slpmsg->flags == P2P_FILE_DATA) | 385 slpmsg->flags == P2P_FILE_DATA) |
389 { | 386 { |
390 MsnSlpCall *slpcall; | 387 MsnSlpCall *slpcall; |
391 slpcall = slpmsg->slpcall; | 388 slpcall = slpmsg->slpcall; |
392 | 389 |
393 g_return_if_fail(slpcall != NULL); | 390 g_return_if_fail(slpcall != NULL); |
394 msg->slpmsg->header->session_id = slpcall->session_id; | 391 slpmsg->header->session_id = slpcall->session_id; |
395 msg->slpmsg->footer->value = slpcall->app_id; | 392 slpmsg->footer->value = slpcall->app_id; |
396 msg->slpmsg->header->ack_id = rand() % 0xFFFFFF00; | 393 slpmsg->header->ack_id = rand() % 0xFFFFFF00; |
397 } | 394 } |
398 else if (slpmsg->flags == 0x100) | 395 else if (slpmsg->flags == 0x100) |
399 { | 396 { |
400 msg->slpmsg->header->ack_id = slpmsg->ack_id; | 397 slpmsg->header->ack_id = slpmsg->ack_id; |
401 msg->slpmsg->header->ack_sub_id = slpmsg->ack_sub_id; | 398 slpmsg->header->ack_sub_id = slpmsg->ack_sub_id; |
402 msg->slpmsg->header->ack_size = slpmsg->ack_size; | 399 slpmsg->header->ack_size = slpmsg->ack_size; |
403 } | 400 } |
404 | 401 |
405 msg->slpmsg->header->id = slpmsg->id; | 402 slpmsg->header->id = slpmsg->id; |
406 msg->slpmsg->header->flags = (guint32)slpmsg->flags; | 403 slpmsg->header->flags = (guint32)slpmsg->flags; |
407 | 404 |
408 msg->slpmsg->header->total_size = slpmsg->size; | 405 slpmsg->header->total_size = slpmsg->size; |
409 | 406 |
407 msn_slplink_send_msgpart(slplink, slpmsg); | |
408 | |
409 #if 0 | |
410 passport = purple_normalize(slplink->session->account, slplink->remote_user); | 410 passport = purple_normalize(slplink->session->account, slplink->remote_user); |
411 msn_message_set_header(msg, "P2P-Dest", passport); | 411 msn_message_set_header(msg, "P2P-Dest", passport); |
412 | 412 |
413 msg->ack_cb = msn_sbconn_msg_ack; | 413 msg->ack_cb = msn_sbconn_msg_ack; |
414 msg->nak_cb = msn_sbconn_msg_nak; | 414 msg->nak_cb = msn_sbconn_msg_nak; |
415 msg->ack_data = slpmsg; | 415 msg->ack_data = slpmsg; |
416 | 416 |
417 msn_slplink_send_msgpart(slplink, slpmsg); | 417 msn_slplink_send_msgpart(slplink, slpmsg); |
418 | 418 |
419 msn_message_destroy(msg); | 419 msn_message_destroy(msg); |
420 #endif | |
420 } | 421 } |
421 | 422 |
422 void | 423 void |
423 msn_slplink_queue_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) | 424 msn_slplink_queue_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) |
424 { | 425 { |