Mercurial > pidgin
comparison libpurple/protocols/msn/msn.c @ 27063:4c651771840d
Add a data parameter for FQY callbacks and remove the pending users list
that was previously used instead.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 07 Jun 2009 06:12:18 +0000 |
parents | e2b6b376125c |
children | 01f1929d0936 42c64c41cf87 |
comparison
equal
deleted
inserted
replaced
27062:e2b6b376125c | 27063:4c651771840d |
---|---|
1378 session = gc->proto_data; | 1378 session = gc->proto_data; |
1379 | 1379 |
1380 msn_change_status(session); | 1380 msn_change_status(session); |
1381 } | 1381 } |
1382 | 1382 |
1383 /* | |
1384 * Actually adds a buddy once we have the response from FQY | |
1385 */ | |
1386 static void | |
1387 add_pending_buddy(MsnSession *session, | |
1388 const char *who, | |
1389 MsnNetwork network, | |
1390 MsnUser *user) | |
1391 { | |
1392 MsnUserList *userlist = session->userlist; | |
1393 MsnUser *user2; | |
1394 char *group; | |
1395 | |
1396 g_return_if_fail(user != NULL); | |
1397 | |
1398 group = msn_user_remove_pending_group(user); | |
1399 | |
1400 user2 = msn_userlist_find_user(userlist, who); | |
1401 if (user2 != NULL) { | |
1402 /* User already in userlist, so just update it. */ | |
1403 msn_user_destroy(user); | |
1404 user = user2; | |
1405 } else { | |
1406 msn_userlist_add_user(userlist, user); | |
1407 } | |
1408 | |
1409 msn_user_set_network(user, network); | |
1410 msn_userlist_add_buddy(userlist, who, group); | |
1411 g_free(group); | |
1412 } | |
1413 | |
1383 static void | 1414 static void |
1384 msn_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) | 1415 msn_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
1385 { | 1416 { |
1386 MsnSession *session; | 1417 MsnSession *session; |
1387 MsnUserList *userlist; | 1418 MsnUserList *userlist; |
1411 msn_userlist_add_buddy(userlist, who, gname); | 1442 msn_userlist_add_buddy(userlist, who, gname); |
1412 } else { | 1443 } else { |
1413 char **tokens; | 1444 char **tokens; |
1414 char *fqy; | 1445 char *fqy; |
1415 /* We need to check the network for this buddy first */ | 1446 /* We need to check the network for this buddy first */ |
1416 msn_userlist_save_pending_buddy(userlist, who, gname); | 1447 user = msn_user_new(userlist, who, NULL); |
1448 msn_user_set_pending_group(user, gname); | |
1449 msn_user_set_network(user, MSN_NETWORK_UNKNOWN); | |
1417 tokens = g_strsplit(who, "@", 2); | 1450 tokens = g_strsplit(who, "@", 2); |
1418 fqy = g_strdup_printf("<ml><d n=\"%s\"><c n=\"%s\"/></d></ml>", | 1451 fqy = g_strdup_printf("<ml><d n=\"%s\"><c n=\"%s\"/></d></ml>", |
1419 tokens[1], | 1452 tokens[1], |
1420 tokens[0]); | 1453 tokens[0]); |
1421 msn_notification_send_fqy(session, fqy, strlen(fqy), | 1454 msn_notification_send_fqy(session, fqy, strlen(fqy), |
1422 (MsnFqyCb)msn_userlist_add_pending_buddy); | 1455 (MsnFqyCb)add_pending_buddy, user); |
1423 g_free(fqy); | 1456 g_free(fqy); |
1424 g_strfreev(tokens); | 1457 g_strfreev(tokens); |
1425 } | 1458 } |
1426 } | 1459 } |
1427 | 1460 |