~ubuntu-branches/ubuntu/karmic/pidgin/karmic

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2009-02-23 18:30:20 UTC
  • mfrom: (1.1.16 upstream)
  • Revision ID: james.westby@ubuntu.com-20090223183020-jmne1l61866atkd8
Tags: 1:2.5.4-2ubuntu1
* Merge from debian, remaining changes: (LP: #316636)
  - debian/control:
    + Add Build-Deps on liblaunchpad-integration-dev, intltool,
    network-manager-dev
    + Add epoch in dependencies
    + Drop the libpurple0 dependency on libpurple-bin
  - debian/libpurple0.symbols: add epoch to symbol
  - debian/pidgin-dbg.preinst, debian/pidgin-dev.preinst,
    debian/pidgin.preinst: add epoch
  - Update debian/prefs.xml to set the notify plugin prefs
    /plugins/gtk/X11/notify/*, set /pidgin/plugins/loaded to load
    the notify plugin and enable the standard logging options by default
  - debian/rules:
    + remove --disable-nm as nm has been fixed in Ubuntu
    + Add X-Ubuntu-Gettext-Domain to the desktop file and update the
      translation templates in common-install-impl::
  - debian/patches:
    + 02_lpi.patch for LP integration
    + 04_let_crasher_for_apport.patch to stop catching the SIGSEGV signal
      and let apport handle it
    + 05_default_to_irc_ubuntu_com.patch to set the default IRC
      server to irc.ubuntu.com
    + 70_autoconf.patch
    + fix-icons-backport-from-2.5.5mtn.diff:
      Fix to see buddy icons for new Windows Live users.
      The patch will be included in pidgin-2.5.5 

Show diffs side-by-side

added added

removed removed

Lines of Context:
596
596
        MsnMessage *message;
597
597
        const char *date;
598
598
        const char *from;
 
599
        const char *boundary;
599
600
        char *decode_msg = NULL;
600
601
        gsize body_len;
601
602
        char **tokens;
608
609
                                  MSG_OIM_LINE_DEM, MSG_OIM_BODY_DEM);
609
610
        purple_debug_info("msn", "oim body:{%s}\n", message->body);
610
611
 
611
 
        if (!strcmp(msn_message_get_attr(message, "X-OIMProxy"), "MOSMS")) {
612
 
                char *boundary;
 
612
        boundary = msn_message_get_attr(message, "boundary");
 
613
 
 
614
        if (boundary != NULL) {
 
615
                char *bounds;
613
616
                char **part;
614
617
 
615
 
                from = msn_message_get_attr(message, "X-OIM-originatingSource");
616
 
 
617
 
                /* Match number to user's mobile number, FROM is a phone number
618
 
                   if the other side pages you using your phone number */
619
 
                if (!strncmp(from, "tel:+", 5)) {
620
 
                        MsnUser *user = msn_userlist_find_user_with_mobile_phone(
621
 
                                        rdata->oim->session->userlist, from + 4);
622
 
 
623
 
                        if (user && user->passport)
624
 
                                passport = g_strdup(user->passport);
625
 
                }
626
 
                if (passport == NULL)
627
 
                        passport = g_strdup(from);
628
 
 
629
 
                boundary = g_strdup_printf("--%s" MSG_OIM_LINE_DEM,
630
 
                                           msn_message_get_attr(message, "boundary"));
631
 
                tokens = g_strsplit(message->body, boundary, 0);
 
618
                bounds = g_strdup_printf("--%s" MSG_OIM_LINE_DEM, boundary);
 
619
                tokens = g_strsplit(message->body, bounds, 0);
632
620
 
633
621
                /* tokens+1 to skip the "This is a multipart message..." text */
634
622
                for (part = tokens+1; *part != NULL; part++) {
648
636
                }
649
637
 
650
638
                g_strfreev(tokens);
651
 
                g_free(boundary);
 
639
                g_free(bounds);
652
640
 
653
641
                if (decode_msg == NULL) {
654
642
                        purple_debug_error("msn", "Couldn't find text/plain OIM message.\n");
655
 
                        g_free(passport);
 
643
                        msn_message_destroy(message);
656
644
                        return;
657
645
                }
658
646
        } else {
 
647
                decode_msg = (char *)purple_base64_decode(message->body, &body_len);
 
648
        }
 
649
 
 
650
        from = msn_message_get_attr(message, "X-OIM-originatingSource");
 
651
 
 
652
        /* Match number to user's mobile number, FROM is a phone number
 
653
           if the other side pages you using your phone number */
 
654
        if (from && !strncmp(from, "tel:+", 5)) {
 
655
                MsnUser *user = msn_userlist_find_user_with_mobile_phone(
 
656
                                rdata->oim->session->userlist, from + 4);
 
657
 
 
658
                if (user && user->passport)
 
659
                        passport = g_strdup(user->passport);
 
660
        }
 
661
 
 
662
        if (passport == NULL) {
659
663
                char *start, *end;
660
664
 
661
665
                from = msn_message_get_attr(message, "From");
662
 
                decode_msg = (char *)purple_base64_decode(message->body, &body_len);
663
666
 
664
667
                tokens = g_strsplit(from, " ", 2);
665
668
                if (tokens[1] != NULL)
687
690
 
688
691
        g_free(passport);
689
692
        g_free(decode_msg);
 
693
        msn_message_destroy(message);
690
694
}
691
695
 
692
696
/* Parse the XML data,