comparison libpurple/protocols/bonjour/jabber.c @ 24170:bb8aa63494e7

Looks like we need to convert the message into XHTML first. Fixes #7160.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 22 Sep 2008 05:30:16 +0000
parents 48da97d84886
children fe7504f465a2 16734635febf
comparison
equal deleted inserted replaced
24169:7e85c6cbf7b0 24170:bb8aa63494e7
944 944
945 int 945 int
946 bonjour_jabber_send_message(BonjourJabber *jdata, const gchar *to, const gchar *body) 946 bonjour_jabber_send_message(BonjourJabber *jdata, const gchar *to, const gchar *body)
947 { 947 {
948 xmlnode *message_node, *node, *node2; 948 xmlnode *message_node, *node, *node2;
949 gchar *message; 949 gchar *message, *xhtml;
950 PurpleBuddy *pb; 950 PurpleBuddy *pb;
951 BonjourBuddy *bb; 951 BonjourBuddy *bb;
952 int ret; 952 int ret;
953 953
954 pb = _find_or_start_conversation(jdata, to); 954 pb = _find_or_start_conversation(jdata, to);
956 purple_debug_info("bonjour", "Can't send a message to an offline buddy (%s).\n", to); 956 purple_debug_info("bonjour", "Can't send a message to an offline buddy (%s).\n", to);
957 /* You can not send a message to an offline buddy */ 957 /* You can not send a message to an offline buddy */
958 return -10000; 958 return -10000;
959 } 959 }
960 960
961 purple_markup_html_to_xhtml(body, &xhtml, &message);
962
961 bb = pb->proto_data; 963 bb = pb->proto_data;
962 964
963 message_node = xmlnode_new("message"); 965 message_node = xmlnode_new("message");
964 xmlnode_set_attrib(message_node, "to", bb->name); 966 xmlnode_set_attrib(message_node, "to", bb->name);
965 xmlnode_set_attrib(message_node, "from", purple_account_get_username(jdata->account)); 967 xmlnode_set_attrib(message_node, "from", purple_account_get_username(jdata->account));
966 xmlnode_set_attrib(message_node, "type", "chat"); 968 xmlnode_set_attrib(message_node, "type", "chat");
967 969
968 /* Enclose the message from the UI within a "font" node */ 970 /* Enclose the message from the UI within a "font" node */
969 node = xmlnode_new_child(message_node, "body"); 971 node = xmlnode_new_child(message_node, "body");
970 message = purple_markup_strip_html(body);
971 xmlnode_insert_data(node, message, strlen(message)); 972 xmlnode_insert_data(node, message, strlen(message));
972 g_free(message); 973 g_free(message);
973 974
974 node = xmlnode_new_child(message_node, "html"); 975 node = xmlnode_new_child(message_node, "html");
975 xmlnode_set_namespace(node, "http://www.w3.org/1999/xhtml"); 976 xmlnode_set_namespace(node, "http://www.w3.org/1999/xhtml");
976 977
977 node = xmlnode_new_child(node, "body"); 978 node = xmlnode_new_child(node, "body");
978 message = g_strdup_printf("<font>%s</font>", body); 979 message = g_strdup_printf("<font>%s</font>", xhtml);
979 node2 = xmlnode_from_str(message, strlen(message)); 980 node2 = xmlnode_from_str(message, strlen(message));
981 g_free(xhtml);
980 g_free(message); 982 g_free(message);
981 xmlnode_insert_child(node, node2); 983 xmlnode_insert_child(node, node2);
982 984
983 node = xmlnode_new_child(message_node, "x"); 985 node = xmlnode_new_child(message_node, "x");
984 xmlnode_set_namespace(node, "jabber:x:event"); 986 xmlnode_set_namespace(node, "jabber:x:event");