| 706 { |
708 { |
| 707 gaim_debug_info("oscar", |
709 gaim_debug_info("oscar", |
| 708 "destroying Direct IM for %s.\n", dim->name); |
710 "destroying Direct IM for %s.\n", dim->name); |
| 709 |
711 |
| 710 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
712 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
| |
713 if (dim->gpc_pend) { |
| |
714 dim->killme = TRUE; |
| |
715 return; |
| |
716 } |
| 711 if (dim->watcher) |
717 if (dim->watcher) |
| 712 gaim_input_remove(dim->watcher); |
718 gaim_input_remove(dim->watcher); |
| 713 if (dim->conn) { |
719 if (dim->conn) { |
| 714 aim_conn_close(dim->conn); |
720 aim_conn_close(dim->conn); |
| 715 aim_conn_kill(od->sess, &dim->conn); |
721 aim_conn_kill(od->sess, &dim->conn); |
| 726 gaim_debug_info("oscar", |
732 gaim_debug_info("oscar", |
| 727 "%s disconnected Direct IM.\n", dim->name); |
733 "%s disconnected Direct IM.\n", dim->name); |
| 728 |
734 |
| 729 if (dim->connected) |
735 if (dim->connected) |
| 730 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), dim->name); |
736 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), dim->name); |
| 731 else |
737 else |
| 732 g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), dim->name); |
738 g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), dim->name); |
| 733 |
739 |
| 734 conv = gaim_find_conversation_with_account(dim->name, gaim_connection_get_account(dim->gc)); |
740 conv = gaim_find_conversation_with_account(dim->name, gaim_connection_get_account(dim->gc)); |
| 735 if (conv) { |
741 if (conv) { |
| 736 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
742 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
| 775 struct sockaddr name; |
781 struct sockaddr name; |
| 776 socklen_t name_len = 1; |
782 socklen_t name_len = 1; |
| 777 |
783 |
| 778 g_return_if_fail(gc != NULL); |
784 g_return_if_fail(gc != NULL); |
| 779 |
785 |
| |
786 dim->gpc_pend = FALSE; |
| |
787 if (dim->killme) { |
| |
788 oscar_direct_im_destroy(od, dim); |
| |
789 return; |
| |
790 } |
| |
791 |
| 780 if (!g_list_find(gaim_connections_get_all(), gc)) { |
792 if (!g_list_find(gaim_connections_get_all(), gc)) { |
| 781 oscar_direct_im_destroy(od, dim); |
793 oscar_direct_im_destroy(od, dim); |
| 782 return; |
794 return; |
| 783 } |
795 } |
| 784 |
796 |
| 848 break; |
860 break; |
| 849 } |
861 } |
| 850 } |
862 } |
| 851 host = g_strndup(d->ip, i); |
863 host = g_strndup(d->ip, i); |
| 852 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
864 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
| |
865 dim->gpc_pend = TRUE; |
| 853 rc = gaim_proxy_connect(gc->account, host, port, oscar_odc_callback, dim); |
866 rc = gaim_proxy_connect(gc->account, host, port, oscar_odc_callback, dim); |
| 854 g_free(host); |
867 g_free(host); |
| 855 if (rc < 0) { |
868 if (rc < 0) { |
| |
869 dim->gpc_pend = FALSE; |
| 856 oscar_direct_im_disconnect(od, dim); |
870 oscar_direct_im_disconnect(od, dim); |
| 857 destroy_direct_im_request(d); |
871 destroy_direct_im_request(d); |
| 858 return; |
872 return; |
| 859 } |
873 } |
| 860 |
874 |