| 1570 #ifdef MSIM_FAKE_SELF_ONLINE |
1570 #ifdef MSIM_FAKE_SELF_ONLINE |
| 1571 /* Fake our self coming online. */ |
1571 /* Fake our self coming online. */ |
| 1572 purple_prpl_got_user_status(session->account, session->username, purple_primitive_get_id_from_type(PURPLE_STATUS_AVAILABLE), NULL); |
1572 purple_prpl_got_user_status(session->account, session->username, purple_primitive_get_id_from_type(PURPLE_STATUS_AVAILABLE), NULL); |
| 1573 #endif |
1573 #endif |
| 1574 |
1574 |
| 1575 /* Set status depending on preference. */ |
1575 |
| 1576 /* TODO: set status to current status, change status to hidden if sign on as hidden. |
1576 /* Set status to current status. */ |
| 1577 * Or remove this preference alltogether, and set status to current status? */ |
1577 msim_set_status(session->account, |
| 1578 msim_set_status_code(session, |
1578 purple_account_get_active_status(session->account)); |
| 1579 purple_account_get_bool(session->account, "hidden", FALSE) |
|
| 1580 ? PURPLE_STATUS_INVISIBLE |
|
| 1581 : PURPLE_STATUS_AVAILABLE); |
|
| 1582 |
1579 |
| 1583 purple_timeout_add(MSIM_KEEPALIVE_INTERVAL_CHECK, msim_check_alive, session); |
1580 purple_timeout_add(MSIM_KEEPALIVE_INTERVAL_CHECK, msim_check_alive, session); |
| 1584 |
1581 |
| 1585 return TRUE; |
1582 return TRUE; |
| 1586 } |
1583 } |
| 1843 g_free(status_str); |
1840 g_free(status_str); |
| 1844 g_return_val_if_fail(NULL, FALSE); |
1841 g_return_val_if_fail(NULL, FALSE); |
| 1845 } |
1842 } |
| 1846 |
1843 |
| 1847 purple_debug_info("msim", |
1844 purple_debug_info("msim", |
| 1848 "msim_status_cb: updating status for <%s> to <%s>\n", |
1845 "msim_status: updating status for <%s> to <%s>\n", |
| 1849 username, status_str); |
1846 username, status_str); |
| 1850 |
1847 |
| 1851 /* TODO: generic functions to split into a GList, part of MsimMessage */ |
1848 /* TODO: generic functions to split into a GList, part of MsimMessage */ |
| 1852 status_array = g_strsplit(status_str, "|", 0); |
1849 status_array = g_strsplit(status_str, "|", 0); |
| 1853 for (list = NULL, i = 0; |
1850 for (list = NULL, i = 0; |
| 1866 * |
1863 * |
| 1867 * TODO: write list support in MsimMessage, and use it here. |
1864 * TODO: write list support in MsimMessage, and use it here. |
| 1868 */ |
1865 */ |
| 1869 |
1866 |
| 1870 status_code = atoi(g_list_nth_data(list, MSIM_STATUS_ORDINAL_ONLINE)); |
1867 status_code = atoi(g_list_nth_data(list, MSIM_STATUS_ORDINAL_ONLINE)); |
| 1871 purple_debug_info("msim", "msim_status_cb: %s's status code = %d\n", username, status_code); |
1868 purple_debug_info("msim", "msim_status: %s's status code = %d\n", username, status_code); |
| 1872 status_headline = g_list_nth_data(list, MSIM_STATUS_ORDINAL_HEADLINE); |
1869 status_headline = g_list_nth_data(list, MSIM_STATUS_ORDINAL_HEADLINE); |
| 1873 |
1870 |
| 1874 blist = purple_get_blist(); |
1871 blist = purple_get_blist(); |
| 1875 |
1872 |
| 1876 /* Add buddy if not found */ |
1873 /* Add buddy if not found */ |
| 1912 /* will be handled below */ |
1909 /* will be handled below */ |
| 1913 purple_status_code = -1; |
1910 purple_status_code = -1; |
| 1914 break; |
1911 break; |
| 1915 |
1912 |
| 1916 default: |
1913 default: |
| 1917 purple_debug_info("msim", "msim_status_cb for %s, unknown status code %d, treating as available\n", |
1914 purple_debug_info("msim", "msim_status for %s, unknown status code %d, treating as available\n", |
| 1918 username, status_code); |
1915 username, status_code); |
| 1919 purple_status_code = PURPLE_STATUS_AVAILABLE; |
1916 purple_status_code = PURPLE_STATUS_AVAILABLE; |
| 1920 } |
1917 } |
| 1921 |
1918 |
| 1922 #ifdef MSIM_FAKE_SELF_ONLINE |
1919 #ifdef MSIM_FAKE_SELF_ONLINE |
| 3072 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
3069 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 3073 |
3070 |
| 3074 option = purple_account_option_int_new(_("Connect port"), "port", MSIM_PORT); |
3071 option = purple_account_option_int_new(_("Connect port"), "port", MSIM_PORT); |
| 3075 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
3072 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 3076 |
3073 |
| 3077 option = purple_account_option_bool_new(_("Sign on as hidden"), "hidden", FALSE); |
|
| 3078 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
|
| 3079 |
|
| 3080 option = purple_account_option_bool_new(_("Show display name in status text"), "show_display_name", TRUE); |
3074 option = purple_account_option_bool_new(_("Show display name in status text"), "show_display_name", TRUE); |
| 3081 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
3075 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 3082 |
3076 |
| 3083 option = purple_account_option_bool_new(_("Show headline in status text"), "show_headline", TRUE); |
3077 option = purple_account_option_bool_new(_("Show headline in status text"), "show_headline", TRUE); |
| 3084 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
3078 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |