comparison libpurple/protocols/msn/contact.c @ 27488:3698c7f4d803

On MSN, pop up an "invite message" request similar to oscar, and send that in the add request. We really should try and move this into the add buddy dialog instead of an extra prompt. Fixes #8503.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 13 Jul 2009 05:01:42 +0000
parents 01f1929d0936
children 975fc5f64438
comparison
equal deleted inserted replaced
27487:7a2891487a00 27488:3698c7f4d803
1157 msn_add_contact_to_group(MsnSession *session, MsnCallbackState *state, 1157 msn_add_contact_to_group(MsnSession *session, MsnCallbackState *state,
1158 const char *passport, const char *groupId) 1158 const char *passport, const char *groupId)
1159 { 1159 {
1160 MsnUserList *userlist; 1160 MsnUserList *userlist;
1161 MsnUser *user; 1161 MsnUser *user;
1162 gchar *body = NULL, *contact_xml; 1162 gchar *body = NULL, *contact_xml, *invite;
1163 1163
1164 g_return_if_fail(passport != NULL); 1164 g_return_if_fail(passport != NULL);
1165 g_return_if_fail(groupId != NULL); 1165 g_return_if_fail(groupId != NULL);
1166 1166
1167 g_return_if_fail(session != NULL); 1167 g_return_if_fail(session != NULL);
1205 passport, 0); 1205 passport, 0);
1206 } else { 1206 } else {
1207 contact_xml = g_strdup_printf(MSN_CONTACT_XML, passport); 1207 contact_xml = g_strdup_printf(MSN_CONTACT_XML, passport);
1208 } 1208 }
1209 1209
1210 body = g_strdup_printf(MSN_ADD_CONTACT_GROUP_TEMPLATE, groupId, contact_xml); 1210 if (user->invite_message) {
1211 char *tmp;
1212 body = g_markup_escape_text(user->invite_message, -1);
1213 tmp = g_markup_escape_text(purple_connection_get_display_name(session->account->gc), -1);
1214 invite = g_strdup_printf(MSN_CONTACT_INVITE_MESSAGE_XML, body, tmp);
1215 g_free(body);
1216 g_free(tmp);
1217
1218 /* We can free this now */
1219 g_free(user->invite_message);
1220 user->invite_message = NULL;
1221
1222 } else {
1223 invite = g_strdup("");
1224 }
1225
1226 body = g_strdup_printf(MSN_ADD_CONTACT_GROUP_TEMPLATE, groupId, contact_xml, invite);
1211 1227
1212 state->body = xmlnode_from_str(body, -1); 1228 state->body = xmlnode_from_str(body, -1);
1213 state->post_action = MSN_ADD_CONTACT_GROUP_SOAP_ACTION; 1229 state->post_action = MSN_ADD_CONTACT_GROUP_SOAP_ACTION;
1214 state->post_url = MSN_ADDRESS_BOOK_POST_URL; 1230 state->post_url = MSN_ADDRESS_BOOK_POST_URL;
1215 state->cb = msn_add_contact_to_group_read_cb; 1231 state->cb = msn_add_contact_to_group_read_cb;
1216 msn_contact_request(state); 1232 msn_contact_request(state);
1217 1233
1234 g_free(invite);
1218 g_free(contact_xml); 1235 g_free(contact_xml);
1219 g_free(body); 1236 g_free(body);
1220 } 1237 }
1221 1238
1222 static void 1239 static void