pidgin: ad2c746d: Apparently X-OIM-Proxy was not a good wa...
qulogic at pidgin.im
qulogic at pidgin.im
Sat Dec 27 05:01:19 EST 2008
-----------------------------------------------------------------
Revision: ad2c746d767233c843f194ae7d0063503ec50231
Ancestor: ab58dc1061a05f13669dbd995e1b34de8ad67d5a
Author: qulogic at pidgin.im
Date: 2008-12-27T09:32:38
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/ad2c746d767233c843f194ae7d0063503ec50231
Modified files:
libpurple/protocols/msn/oim.c
ChangeLog:
Apparently X-OIM-Proxy was not a good way to decide that we received a
multi-part message. Now always just split if a boundary is available from
the content-type. Try and match the telephone number before the using the
address from the From line.
Fixes #7901.
-------------- next part --------------
============================================================
--- libpurple/protocols/msn/oim.c c7e072037e4188f57307c0b6e58a453845ba8592
+++ libpurple/protocols/msn/oim.c 697f272ea83326405b8292f32c65df5b65dcb801
@@ -596,6 +596,7 @@ msn_oim_report_to_user(MsnOimRecvData *r
MsnMessage *message;
const char *date;
const char *from;
+ const char *boundary;
char *decode_msg = NULL;
gsize body_len;
char **tokens;
@@ -608,28 +609,15 @@ msn_oim_report_to_user(MsnOimRecvData *r
MSG_OIM_LINE_DEM, MSG_OIM_BODY_DEM);
purple_debug_info("msn", "oim body:{%s}\n", message->body);
- if (!strcmp(msn_message_get_attr(message, "X-OIMProxy"), "MOSMS")) {
- char *boundary;
- char **part;
+ boundary = msn_message_get_attr(message, "boundary");
- from = msn_message_get_attr(message, "X-OIM-originatingSource");
+ if (boundary != NULL) {
+ char *bounds;
+ char **part;
- /* Match number to user's mobile number, FROM is a phone number
- if the other side pages you using your phone number */
- if (!strncmp(from, "tel:+", 5)) {
- MsnUser *user = msn_userlist_find_user_with_mobile_phone(
- rdata->oim->session->userlist, from + 4);
+ bounds = g_strdup_printf("--%s" MSG_OIM_LINE_DEM, boundary);
+ tokens = g_strsplit(message->body, bounds, 0);
- if (user && user->passport)
- passport = g_strdup(user->passport);
- }
- if (passport == NULL)
- passport = g_strdup(from);
-
- boundary = g_strdup_printf("--%s" MSG_OIM_LINE_DEM,
- msn_message_get_attr(message, "boundary"));
- tokens = g_strsplit(message->body, boundary, 0);
-
/* tokens+1 to skip the "This is a multipart message..." text */
for (part = tokens+1; *part != NULL; part++) {
MsnMessage *multipart;
@@ -648,18 +636,33 @@ msn_oim_report_to_user(MsnOimRecvData *r
}
g_strfreev(tokens);
- g_free(boundary);
+ g_free(bounds);
if (decode_msg == NULL) {
purple_debug_error("msn", "Couldn't find text/plain OIM message.\n");
- g_free(passport);
+ msn_message_destroy(message);
return;
}
} else {
+ decode_msg = (char *)purple_base64_decode(message->body, &body_len);
+ }
+
+ from = msn_message_get_attr(message, "X-OIM-originatingSource");
+
+ /* Match number to user's mobile number, FROM is a phone number
+ if the other side pages you using your phone number */
+ if (!strncmp(from, "tel:+", 5)) {
+ MsnUser *user = msn_userlist_find_user_with_mobile_phone(
+ rdata->oim->session->userlist, from + 4);
+
+ if (user && user->passport)
+ passport = g_strdup(user->passport);
+ }
+
+ if (passport == NULL) {
char *start, *end;
from = msn_message_get_attr(message, "From");
- decode_msg = (char *)purple_base64_decode(message->body, &body_len);
tokens = g_strsplit(from, " ", 2);
if (tokens[1] != NULL)
@@ -687,6 +690,7 @@ msn_oim_report_to_user(MsnOimRecvData *r
g_free(passport);
g_free(decode_msg);
+ msn_message_destroy(message);
}
/* Parse the XML data,
More information about the Commits
mailing list