comparison libpurple/protocols/myspace/myspace.c @ 17371:948373cbba1c

Add TODO in order to fix msim_tooltip_text. Add TODO to fix bug #193. Call purple_input_remove() in msim_close(), in an attempt to fix bug #193 (does not help).
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Mon, 11 Jun 2007 06:17:16 +0000
parents 7a0061f4845d
children d9aaccef8721
comparison
equal deleted inserted replaced
17370:7a0061f4845d 17371:948373cbba1c
755 /* TODO: Free copy cloned from msim_preprocess_incoming(). */ 755 /* TODO: Free copy cloned from msim_preprocess_incoming(). */
756 //XXX msim_msg_free(msg); 756 //XXX msim_msg_free(msg);
757 g_hash_table_destroy(body); 757 g_hash_table_destroy(body);
758 } 758 }
759 759
760 #ifdef _MSIM_UID2USERNAME_WORKS
760 /* Lookup a username by userid, from buddy list. 761 /* Lookup a username by userid, from buddy list.
761 * 762 *
762 * @param wanted_uid 763 * @param wanted_uid
763 * 764 *
764 * @return Username of wanted_uid, if on blist, or NULL. Static string. 765 * @return Username of wanted_uid, if on blist, or NULL. Static string.
842 } 843 }
843 844
844 g_slist_free(buddies_head); 845 g_slist_free(buddies_head);
845 return NULL; 846 return NULL;
846 } 847 }
848
849 #endif
847 850
848 /** Preprocess incoming messages, resolving as needed, calling msim_process() when ready to process. 851 /** Preprocess incoming messages, resolving as needed, calling msim_process() when ready to process.
849 * 852 *
850 * TODO: if no uid to resolve, process immediately. if uid, check if know username, 853 * TODO: if no uid to resolve, process immediately. if uid, check if know username,
851 * if so, tag and process immediately, if not, queue, send resolve msg, and process 854 * if so, tag and process immediately, if not, queue, send resolve msg, and process
998 */ 1001 */
999 body_str = msim_msg_get_string(msg, "body"); 1002 body_str = msim_msg_get_string(msg, "body");
1000 body = msim_parse_body(body_str); 1003 body = msim_parse_body(body_str);
1001 g_free(body_str); 1004 g_free(body_str);
1002 1005
1006
1003 /* TODO: implement a better hash-like interface, and use it. */ 1007 /* TODO: implement a better hash-like interface, and use it. */
1004 username = g_hash_table_lookup(body, "UserName"); 1008 username = g_hash_table_lookup(body, "UserName");
1009
1010 /* TODO: Save user info reply for msim_tooltip_text. */
1011 /* TODO: get rid of user_lookup_cache, and find another way to
1012 * pass the relevant information to msim_tooltip_text. */
1013 /* g_hash_table_insert(session->user_lookup_cache, username, body); */
1014
1005 if (username) 1015 if (username)
1006 { 1016 {
1007 PurpleBuddy *buddy; 1017 PurpleBuddy *buddy;
1008 gchar *uid; 1018 gchar *uid;
1009 1019
1419 gc = (PurpleConnection *)(gc_uncasted); 1429 gc = (PurpleConnection *)(gc_uncasted);
1420 account = purple_connection_get_account(gc); 1430 account = purple_connection_get_account(gc);
1421 session = gc->proto_data; 1431 session = gc->proto_data;
1422 1432
1423 g_return_if_fail(cond == PURPLE_INPUT_READ); 1433 g_return_if_fail(cond == PURPLE_INPUT_READ);
1424 g_return_if_fail(MSIM_SESSION_VALID(session)); 1434 /* TODO: fix bug #193, crash when re-login */
1435 g_return_if_fail(MSIM_SESSION_VALID(session));
1425 1436
1426 /* Only can handle so much data at once... 1437 /* Only can handle so much data at once...
1427 * If this happens, try recompiling with a higher MSIM_READ_BUF_SIZE. 1438 * If this happens, try recompiling with a higher MSIM_READ_BUF_SIZE.
1428 * Should be large enough to hold the largest protocol message. 1439 * Should be large enough to hold the largest protocol message.
1429 */ 1440 */
1623 * 1634 *
1624 * @param gc The connection. 1635 * @param gc The connection.
1625 */ 1636 */
1626 void msim_close(PurpleConnection *gc) 1637 void msim_close(PurpleConnection *gc)
1627 { 1638 {
1639 MsimSession *session;
1640
1641 purple_debug_info("msim", "msim_close: destroying session\n");
1642
1643 session = (MsimSession *)gc->proto_data;
1644
1628 g_return_if_fail(gc != NULL); 1645 g_return_if_fail(gc != NULL);
1629 1646 g_return_if_fail(session != NULL);
1630 purple_debug_info("msim", "msim_close: destroying session\n"); 1647 g_return_if_fail(MSIM_SESSION_VALID(session));
1631 1648
1632 msim_session_destroy(gc->proto_data); 1649
1650 purple_input_remove(session->fd);
1651 msim_session_destroy(session);
1633 } 1652 }
1634 1653
1635 1654
1636 /** 1655 /**
1637 * Check if a string is a userid (all numeric). 1656 * Check if a string is a userid (all numeric).