Changeset 767b2d1 for protocols/msn/ns.c
- Timestamp:
- 2015-05-31T02:40:04Z (9 years ago)
- Children:
- 074c9b6
- Parents:
- 2ca933c
- git-author:
- dequis <dx@…> (07-04-15 12:59:51)
- git-committer:
- dequis <dx@…> (31-05-15 02:40:04)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/ns.c
r2ca933c r767b2d1 32 32 #include "soap.h" 33 33 #include "xmltree.h" 34 35 static gboolean msn_ns_connected(gpointer data, gint source, b_input_condition cond); 34 #include "ssl_client.h" 35 36 static gboolean msn_ns_connected(gpointer data, int source, void *scd, b_input_condition cond); 36 37 static gboolean msn_ns_callback(gpointer data, gint source, b_input_condition cond); 37 38 … … 68 69 msn_gw_write(md->gw, out, len); 69 70 } else { 70 st = write(fd, out, len);71 st = ssl_write(md->ssl, out, len); 71 72 } 72 73 … … 92 93 md->gw = msn_gw_new(ic); 93 94 md->gw->callback = msn_ns_callback; 94 msn_ns_connected(md, -1, B_EV_IO_READ);95 msn_ns_connected(md, 0, NULL, B_EV_IO_READ); 95 96 } else { 96 md->fd = proxy_connect(host, port, msn_ns_connected, md); 97 md->ssl = ssl_connect((char *) host, port, TRUE, msn_ns_connected, md); 98 md->fd = md->ssl ? ssl_getfd(md->ssl) : -1; 97 99 if (md->fd < 0) { 98 100 imcb_error(ic, "Could not connect to server"); … … 105 107 } 106 108 107 static gboolean msn_ns_connected(gpointer data, gint source, b_input_condition cond)109 static gboolean msn_ns_connected(gpointer data, int source, void *scd, b_input_condition cond) 108 110 { 109 111 struct msn_data *md = data; 110 112 struct im_connection *ic = md->ic; 111 113 112 if (source == -1 && !md->is_http) { 114 if (!scd && !md->is_http) { 115 md->ssl = NULL; 113 116 imcb_error(ic, "Could not connect to server"); 114 117 imc_logout(ic, TRUE); … … 135 138 } 136 139 137 if (msn_ns_write(ic, source, "VER %d %s CVR0\r\n", ++md->trId, MSNP_VER)) {140 if (msn_ns_write(ic, -1, "VER %d %s CVR0\r\n", ++md->trId, MSNP_VER)) { 138 141 if (!md->is_http) { 139 142 md->inpa = b_input_add(md->fd, B_EV_IO_READ, msn_ns_callback, md); … … 150 153 msn_gw_free(md->gw); 151 154 } 152 if (md->fd >= 0) { 153 closesocket(md->fd); 155 156 if (md->ssl) { 157 ssl_disconnect(md->ssl); 154 158 b_event_remove(md->inpa); 155 159 } 156 160 161 md->ssl = NULL; 157 162 md->fd = md->inpa = -1; 163 158 164 g_free(md->rxq); 159 165 g_free(md->cmd_text); … … 175 181 } else { 176 182 bytes = g_malloc(1024); 177 st = read(md->fd, bytes, 1024);178 } 179 180 if (st <= 0) {183 st = ssl_read(md->ssl, bytes, 1024); 184 } 185 186 if (st == 0 || (st < 0 && (md->is_http || !ssl_sockerr_again(md->ssl)))) { 181 187 imcb_error(ic, "Error while reading from server"); 182 188 imc_logout(ic, TRUE); … … 188 194 189 195 g_free(bytes); 196 197 if (!md->is_http && ssl_pending(md->ssl)) { 198 return msn_ns_callback(data, source, cond); 199 } 190 200 191 201 return msn_handler(md);
Note: See TracChangeset
for help on using the changeset viewer.