~ubuntu-branches/ubuntu/quantal/pidgin/quantal

« back to all changes in this revision

Viewing changes to libpurple/protocols/msn/msg.c

  • Committer: Bazaar Package Importer
  • Author(s): Ari Pollak
  • Date: 2011-06-13 21:17:20 UTC
  • mfrom: (1.3.19 upstream)
  • mto: This revision was merged to the branch mainline in revision 73.
  • Revision ID: james.westby@ubuntu.com-20110613211720-ke87vzmdcuaxams7
Tags: 2.8.0-1
* Imported Upstream version 2.8.0 (Closes: #630124)
* Remove SILC support since the library will be orphaned (Closes: #629222)
* Fix typo in libpurple-bin description (Closes: #625462)

Show diffs side-by-side

added added

removed removed

Lines of Context:
135
135
 
136
136
        msn_message_set_header(msg, "User-Agent", NULL);
137
137
 
138
 
        msg->msnslp_message = TRUE;
139
 
 
140
138
        msn_message_set_flag(msg, 'D');
141
139
        msn_message_set_content_type(msg, "application/x-msnmsgrp2p");
142
140
 
251
249
        /* Now we *should* be at the body. */
252
250
        content_type = msn_message_get_content_type(msg);
253
251
 
254
 
        if (content_type != NULL &&
255
 
                !strcmp(content_type, "application/x-msnmsgrp2p")) {
256
 
                msg->msnslp_message = TRUE;
257
 
                msg->part = msn_slpmsgpart_new_from_data(tmp, payload_len - (tmp - tmp_base));
258
 
        }
259
 
 
260
252
        if (payload_len - (tmp - tmp_base) > 0) {
261
253
                msg->body_len = payload_len - (tmp - tmp_base);
262
254
                g_free(msg->body);
343
335
 
344
336
        body = msn_message_get_bin_data(msg, &body_len);
345
337
 
346
 
        if (msg->msnslp_message)
347
 
        {
348
 
                size_t siz;
349
 
                char *body;
350
 
 
351
 
                body = msn_slpmsgpart_serialize(msg->part, &siz);
352
 
 
353
 
                memcpy(n, body, siz);
354
 
                n += siz;
355
 
 
356
 
                g_free(body);
357
 
        }
358
 
        else
359
 
        {
360
 
                if (body != NULL)
361
 
                {
362
 
                        memcpy(n, body, body_len);
363
 
                        n += body_len;
364
 
                        *n = '\0';
365
 
                }
 
338
        if (body != NULL)
 
339
        {
 
340
                memcpy(n, body, body_len);
 
341
                n += body_len;
 
342
                *n = '\0';
366
343
        }
367
344
 
368
345
        if (ret_size != NULL)
611
588
 
612
589
        body = msn_message_get_bin_data(msg, &body_len);
613
590
 
614
 
        if (msg->msnslp_message)
615
 
        {
616
 
                msn_slpmsgpart_to_string(msg->part, str);
617
 
 
618
 
                if (purple_debug_is_verbose() && body != NULL)
619
 
                {
620
 
                        if (text_body)
621
 
                        {
622
 
                                g_string_append_len(str, body, body_len);
623
 
                                if (body[body_len - 1] == '\0')
624
 
                                {
625
 
                                        str->len--;
626
 
                                        g_string_append(str, " 0x00");
627
 
                                }
628
 
                                g_string_append(str, "\r\n");
629
 
                        }
630
 
                        else
631
 
                        {
632
 
                                int i;
633
 
 
634
 
                                for (i = 0; i < body_len; i++)
635
 
                                {
636
 
                                        g_string_append_printf(str, "%.2hhX ", body[i]);
637
 
                                        if ((i % 16) == 15)
638
 
                                                g_string_append(str, "\r\n");
639
 
                                }
640
 
 
641
 
                                g_string_append(str, "\r\n");
642
 
                        }
643
 
                }
644
 
        }
645
 
        else
646
 
        {
647
 
                if (body != NULL)
 
591
        if (body != NULL)
 
592
        {
 
593
                if (msg->type == MSN_MSG_TEXT)
648
594
                {
649
595
                        g_string_append_len(str, body, body_len);
650
596
                        g_string_append(str, "\r\n");
651
597
                }
 
598
                else
 
599
                {
 
600
                        size_t i;
 
601
                        for (i = 0; i < body_len; i++, body++)
 
602
                        {
 
603
                                g_string_append_printf(str, "%02x ", (unsigned char)*body);
 
604
                                if (i % 16 == 0 && i != 0)
 
605
                                        g_string_append_c(str, '\n');
 
606
                        }
 
607
                        g_string_append_c(str, '\n');
 
608
                }
652
609
        }
653
610
 
654
611
        purple_debug_info("msn", "Message %s:\n{%s}\n", info, str->str);
884
841
{
885
842
        MsnSession *session;
886
843
        MsnSlpLink *slplink;
 
844
        MsnP2PVersion p2p;
887
845
 
888
846
        session = cmdproc->servconn->session;
889
847
        slplink = msn_session_get_slplink(session, msg->remote_user);
906
864
                }
907
865
        }
908
866
 
909
 
        if (msg->part) {
 
867
        p2p = msn_slplink_get_p2p_version(slplink);
 
868
        msg->part = msn_slpmsgpart_new_from_data(p2p, msg->body, msg->body_len);
 
869
 
 
870
        if (msg->part)
910
871
                msn_slplink_process_msg(slplink, msg->part);
911
 
        }
912
 
        else /* This should never happen. */
913
 
                purple_debug_fatal("msn", "P2P message without a Part.\n");
 
872
        else
 
873
                purple_debug_warning("msn", "P2P message failed to parse.\n");
914
874
}
915
875
 
916
876
static void