libpurple/protocols/myspace/myspace.c

branch
soc.2007.msimprpl
changeset 17987
a0baf4e80ee9
parent 17986
c3c06c30789c
child 17988
54b762751673
equal deleted inserted replaced
17986:c3c06c30789c 17987:a0baf4e80ee9
1349 /** Add a buddy to user's buddy list. */ 1349 /** Add a buddy to user's buddy list. */
1350 void msim_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) 1350 void msim_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
1351 { 1351 {
1352 MsimSession *session; 1352 MsimSession *session;
1353 MsimMessage *msg; 1353 MsimMessage *msg;
1354 /* MsimMessage *msg_blocklist; */
1354 1355
1355 session = (MsimSession *)gc->proto_data; 1356 session = (MsimSession *)gc->proto_data;
1356 purple_debug_info("msim", "msim_add_buddy: want to add %s to %s\n", buddy->name, 1357 purple_debug_info("msim", "msim_add_buddy: want to add %s to %s\n", buddy->name,
1357 group ? group->name : "(no group)"); 1358 group ? group->name : "(no group)");
1358 1359
1368 purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("'addbuddy' command failed.")); 1369 purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("'addbuddy' command failed."));
1369 msim_msg_free(msg); 1370 msim_msg_free(msg);
1370 return; 1371 return;
1371 } 1372 }
1372 msim_msg_free(msg); 1373 msim_msg_free(msg);
1373 1374
1374 /* TODO: update blocklist. Compare to delbuddy for how to do. */ 1375 /* TODO: if addbuddy fails ('error' message is returned), delete added buddy from
1376 * buddy list since Purple adds it locally. */
1377
1378 /* TODO: Update blocklist. */
1375 #if 0 1379 #if 0
1376 /* TODO */ 1380 msg_blocklist = msim_msg_new(TRUE,
1377 if (!msim_postprocess_outgoing(session, 1381 "persist", MSIM_TYPE_INTEGER, 1,
1378 "persist", MSIM_TYPE_INTEGER, 1, 1382 "sesskey", MSIM_TYPE_INTEGER, session->sesskey,
1379 "sesskey", MSIM_TYPE_INTEGER, session->sesskey, 1383 "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_BIT_ACTION | MSIM_CMD_PUT,
1380 "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_BIT_ACTION | MSIM_CMD_PUT, 1384 "dsn", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_DSN,
1381 "dsn", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_DSN, 1385 "lid", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_LID,
1382 "lid", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_LID, 1386 /* TODO: Use msim_new_reply_callback to get rid. */
1383 /* TODO: Use msim_new_reply_callback to get rid. */ 1387 "rid", MSIM_TYPE_INTEGER, session->next_rid++,
1384 "rid", MSIM_TYPE_INTEGER, session->next_rid++, 1388 "body", MSIM_TYPE_STRING,
1385 "body", MSIM_TYPE_STRING, 1389 g_strdup_printf("ContactID=<uid>\034"
1386 g_strdup_printf("ContactID=%s\034" 1390 "GroupName=%s\034"
1387 "GroupName=%s\034" 1391 "Position=1000\034"
1388 "Position=1000\034" 1392 "Visibility=1\034"
1389 "Visibility=1\034" 1393 "NickName=\034"
1390 "NickName=\034" 1394 "NameSelect=0",
1391 "NameSelect=0", 1395 "Friends" /*group->name*/ ));
1392 buddy->name, group->name), 1396
1393 NULL)) 1397 if (!msim_postprocess_outgoing(session, msg, buddy->name, "body", NULL))
1394 { 1398 {
1395 purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("persist command failed")); 1399 purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("persist command failed"));
1400 msim_msg_free(msg_blocklist);
1396 return; 1401 return;
1397 } 1402 }
1403 msim_msg_free(msg_blocklist);
1398 #endif 1404 #endif
1399 } 1405 }
1400 1406
1401 /** Perform actual postprocessing on a message, adding userid as specified. 1407 /** Perform actual postprocessing on a message, adding userid as specified.
1402 * 1408 *

mercurial