Mercurial > pidgin.yaz
comparison src/protocols/msn/servconn.c @ 10296:a7b2fd5efcf2
[gaim-migrate @ 11476]
Some "random updates" updates from patch 1077274 by Felipe Contreras:
"Some changes in the behaviour of slpcalls (for FT),
free some unused structures and properly close
switchboard connections."
Looks good to me, and seems to have fixed a mysterious FT problem that I had
been pretending didn't exist.
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Thu, 02 Dec 2004 16:07:26 +0000 |
parents | ecf3ce2e2ab1 |
children | e5455f1dc9b6 |
comparison
equal
deleted
inserted
replaced
10295:0cf2a686266e | 10296:a7b2fd5efcf2 |
---|---|
25 #include "servconn.h" | 25 #include "servconn.h" |
26 #include "error.h" | 26 #include "error.h" |
27 | 27 |
28 static void read_cb(gpointer data, gint source, GaimInputCondition cond); | 28 static void read_cb(gpointer data, gint source, GaimInputCondition cond); |
29 | 29 |
30 MsnServConn * | |
31 msn_servconn_new(MsnSession *session, MsnServConnType type) | |
32 { | |
33 MsnServConn *servconn; | |
34 | |
35 g_return_val_if_fail(session != NULL, NULL); | |
36 | |
37 servconn = g_new0(MsnServConn, 1); | |
38 | |
39 servconn->type = type; | |
40 | |
41 servconn->session = session; | |
42 servconn->cmdproc = msn_cmdproc_new(session); | |
43 servconn->cmdproc->servconn = servconn; | |
44 | |
45 if (session->http_method) | |
46 { | |
47 servconn->http_data = g_new0(MsnHttpMethodData, 1); | |
48 servconn->http_data->virgin = TRUE; | |
49 } | |
50 | |
51 servconn->num = session->servconns_count++; | |
52 | |
53 return servconn; | |
54 } | |
55 | |
56 void | |
57 msn_servconn_destroy(MsnServConn *servconn) | |
58 { | |
59 g_return_if_fail(servconn != NULL); | |
60 | |
61 if (servconn->processing) | |
62 { | |
63 servconn->wasted = TRUE; | |
64 return; | |
65 } | |
66 | |
67 if (servconn->connected) | |
68 msn_servconn_disconnect(servconn); | |
69 | |
70 if (servconn->http_data != NULL) | |
71 g_free(servconn->http_data); | |
72 | |
73 msn_cmdproc_destroy(servconn->cmdproc); | |
74 g_free(servconn); | |
75 } | |
76 | |
30 static void | 77 static void |
31 show_error(MsnServConn *servconn) | 78 show_error(MsnServConn *servconn) |
32 { | 79 { |
33 GaimConnection *gc; | 80 GaimConnection *gc; |
34 char *tmp; | 81 char *tmp; |
66 else | 113 else |
67 { | 114 { |
68 MsnSwitchBoard *swboard; | 115 MsnSwitchBoard *swboard; |
69 swboard = servconn->data; | 116 swboard = servconn->data; |
70 swboard->error = MSN_SB_ERROR_CONNECTION; | 117 swboard->error = MSN_SB_ERROR_CONNECTION; |
71 /* | |
72 GaimAccount *account; | |
73 char *primary; | |
74 | |
75 account = gaim_connection_get_account(gc); | |
76 primary = g_strdup_printf(_("MSN error for account %s"), | |
77 gaim_account_get_username(account)); | |
78 | |
79 gaim_notify_error(gc, NULL, primary, tmp); | |
80 | |
81 g_free(primary); | |
82 */ | |
83 } | 118 } |
84 | 119 |
85 g_free(tmp); | 120 g_free(tmp); |
86 } | 121 } |
87 | 122 |
102 else | 137 else |
103 { | 138 { |
104 servconn->cmdproc->error = MSN_ERROR_CONNECT; | 139 servconn->cmdproc->error = MSN_ERROR_CONNECT; |
105 show_error(servconn); | 140 show_error(servconn); |
106 } | 141 } |
107 } | |
108 | |
109 MsnServConn * | |
110 msn_servconn_new(MsnSession *session, MsnServConnType type) | |
111 { | |
112 MsnServConn *servconn; | |
113 | |
114 g_return_val_if_fail(session != NULL, NULL); | |
115 | |
116 servconn = g_new0(MsnServConn, 1); | |
117 | |
118 servconn->type = type; | |
119 | |
120 servconn->session = session; | |
121 servconn->cmdproc = msn_cmdproc_new(session); | |
122 servconn->cmdproc->servconn = servconn; | |
123 | |
124 if (session->http_method) | |
125 { | |
126 servconn->http_data = g_new0(MsnHttpMethodData, 1); | |
127 servconn->http_data->virgin = TRUE; | |
128 } | |
129 | |
130 servconn->num = session->servconns_count++; | |
131 | |
132 return servconn; | |
133 } | |
134 | |
135 void | |
136 msn_servconn_destroy(MsnServConn *servconn) | |
137 { | |
138 g_return_if_fail(servconn != NULL); | |
139 | |
140 if (servconn->processing) | |
141 { | |
142 servconn->wasted = TRUE; | |
143 return; | |
144 } | |
145 | |
146 if (servconn->connected) | |
147 msn_servconn_disconnect(servconn); | |
148 | |
149 if (servconn->http_data != NULL) | |
150 g_free(servconn->http_data); | |
151 | |
152 #if 0 | |
153 if (servconn->rx_buf != NULL) | |
154 g_free(servconn->rx_buf); | |
155 #endif | |
156 | |
157 msn_cmdproc_destroy(servconn->cmdproc); | |
158 g_free(servconn); | |
159 } | 142 } |
160 | 143 |
161 gboolean | 144 gboolean |
162 msn_servconn_connect(MsnServConn *servconn, const char *host, int port) | 145 msn_servconn_connect(MsnServConn *servconn, const char *host, int port) |
163 { | 146 { |