diff -r d22aea27e7e6 -r 6a1cf9b5c913 src/protocols/oscar/oscar.c
--- a/src/protocols/oscar/oscar.c Sun Apr 09 21:37:12 2006 +0000
+++ b/src/protocols/oscar/oscar.c Sun Apr 09 22:35:50 2006 +0000
@@ -3946,12 +3946,17 @@
static void
gaim_odc_send_im(PeerConnection *conn, const char *message, GaimMessageFlags imflags)
{
- GString *msg = g_string_new("
");
- GString *data = g_string_new("");
+ GString *msg;
+ GString *data;
+ gchar *tmp;
+ int tmplen;
+ guint16 charset, charsubset;
GData *attribs;
const char *start, *end, *last;
int oscar_id = 0;
+ msg = g_string_new("");
+ data = g_string_new("");
last = message;
/* for each valid IMG tag... */
@@ -3988,8 +3993,8 @@
/* ... and append the data to the binary section ... */
g_string_append_printf(data, "",
oscar_id, size);
- data = g_string_append_len(data, imgdata, size);
- data = g_string_append(data, "");
+ g_string_append_len(data, imgdata, size);
+ g_string_append(data, "");
}
/* If the tag is invalid, skip it, thus no else here */
@@ -3999,20 +4004,27 @@
last = end + 1;
}
- /* append any remaining message data (without the > :-) ) */
+ /* append any remaining message data */
if (last && *last)
- msg = g_string_append(msg, last);
-
- /* if we inserted any images in the binary section, append it */
+ g_string_append(msg, last);
+
+ g_string_append(msg, "");
+
+ /* Convert the message to a good encoding */
+ gaim_plugin_oscar_convert_to_best_encoding(conn->od->gc,
+ conn->sn, msg->str, &tmp, &tmplen, &charset, &charsubset);
+ g_string_free(msg, TRUE);
+ msg = g_string_new_len(tmp, tmplen);
+
+ /* Append any binary data that we may have */
if (oscar_id) {
msg = g_string_append_len(msg, data->str, data->len);
msg = g_string_append(msg, "");
}
-
g_string_free(data, TRUE);
- /* TODO: Deal with the encoding. */
- peer_odc_send_im(conn, msg->str, msg->len, 0, imflags & GAIM_MESSAGE_AUTO_RESP);
+ peer_odc_send_im(conn, msg->str, msg->len, charset,
+ imflags & GAIM_MESSAGE_AUTO_RESP);
g_string_free(msg, TRUE);
}