| 1764 sip = purple_connection_get_protocol_data(gc); |
1764 sip = purple_connection_get_protocol_data(gc); |
| 1765 sip->fd = source; |
1765 sip->fd = source; |
| 1766 |
1766 |
| 1767 conn = connection_create(sip, source); |
1767 conn = connection_create(sip, source); |
| 1768 |
1768 |
| 1769 sip->registertimeout = purple_timeout_add(g_random_int_range(10000, 100000), (GSourceFunc)subscribe_timeout, sip); |
1769 sip->registertimeout = g_timeout_add(g_random_int_range(10000, 100000), (GSourceFunc)subscribe_timeout, sip); |
| 1770 |
1770 |
| 1771 do_register(sip); |
1771 do_register(sip); |
| 1772 |
1772 |
| 1773 conn->inputhandler = purple_input_add(sip->fd, PURPLE_INPUT_READ, simple_input_cb, gc); |
1773 conn->inputhandler = purple_input_add(sip->fd, PURPLE_INPUT_READ, simple_input_cb, gc); |
| 1774 } |
1774 } |
| 1806 |
1806 |
| 1807 sip->listenport = purple_network_get_port_from_fd(sip->fd); |
1807 sip->listenport = purple_network_get_port_from_fd(sip->fd); |
| 1808 |
1808 |
| 1809 sip->listenpa = purple_input_add(sip->fd, PURPLE_INPUT_READ, simple_udp_process, sip->gc); |
1809 sip->listenpa = purple_input_add(sip->fd, PURPLE_INPUT_READ, simple_udp_process, sip->gc); |
| 1810 |
1810 |
| 1811 sip->resendtimeout = purple_timeout_add(2500, (GSourceFunc) resend_timeout, sip); |
1811 sip->resendtimeout = g_timeout_add(2500, (GSourceFunc) resend_timeout, sip); |
| 1812 sip->registertimeout = purple_timeout_add(g_random_int_range(10000, 100000), (GSourceFunc)subscribe_timeout, sip); |
1812 sip->registertimeout = g_timeout_add(g_random_int_range(10000, 100000), (GSourceFunc)subscribe_timeout, sip); |
| 1813 do_register(sip); |
1813 do_register(sip); |
| 1814 } |
1814 } |
| 1815 |
1815 |
| 1816 static void |
1816 static void |
| 1817 simple_udp_host_resolved(GObject *sender, GAsyncResult *result, gpointer data) { |
1817 simple_udp_host_resolved(GObject *sender, GAsyncResult *result, gpointer data) { |
| 2049 if (sip->listenpa) |
2049 if (sip->listenpa) |
| 2050 purple_input_remove(sip->listenpa); |
2050 purple_input_remove(sip->listenpa); |
| 2051 if (sip->tx_handler) |
2051 if (sip->tx_handler) |
| 2052 purple_input_remove(sip->tx_handler); |
2052 purple_input_remove(sip->tx_handler); |
| 2053 if (sip->resendtimeout) |
2053 if (sip->resendtimeout) |
| 2054 purple_timeout_remove(sip->resendtimeout); |
2054 g_source_remove(sip->resendtimeout); |
| 2055 if (sip->registertimeout) |
2055 if (sip->registertimeout) |
| 2056 purple_timeout_remove(sip->registertimeout); |
2056 g_source_remove(sip->registertimeout); |
| 2057 |
2057 |
| 2058 g_cancellable_cancel(sip->cancellable); |
2058 g_cancellable_cancel(sip->cancellable); |
| 2059 g_object_unref(G_OBJECT(sip->cancellable)); |
2059 g_object_unref(G_OBJECT(sip->cancellable)); |
| 2060 |
2060 |
| 2061 if (sip->listen_data != NULL) |
2061 if (sip->listen_data != NULL) |