Changeset 66c57924 for protocols/oscar/txqueue.c
- Timestamp:
- 2005-11-20T16:09:23Z (19 years ago)
- Branches:
- master
- Children:
- 831c955
- Parents:
- 94281ef
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/oscar/txqueue.c
r94281ef r66c57924 34 34 } 35 35 36 /* For sanity... */37 if ((conn->type == AIM_CONN_TYPE_RENDEZVOUS) ||38 (conn->type == AIM_CONN_TYPE_RENDEZVOUS_OUT)) {39 if (framing != AIM_FRAMETYPE_OFT) {40 do_error_dialog(sess->aux_data, "attempted to allocate inappropriate frame type for rendezvous connection", "Gaim");41 return NULL;42 }43 } else {44 if (framing != AIM_FRAMETYPE_FLAP) {45 do_error_dialog(sess->aux_data, "attempted to allocate inappropriate frame type for FLAP connection", "Gaim");46 return NULL;47 }48 }49 50 36 if (!(fr = (aim_frame_t *)g_new0(aim_frame_t,1))) 51 37 return NULL; … … 58 44 59 45 fr->hdr.flap.type = chan; 60 61 } else if (fr->hdrtype == AIM_FRAMETYPE_OFT) {62 63 fr->hdr.oft.type = chan;64 fr->hdr.oft.hdr2len = 0; /* this will get setup by caller */65 46 66 47 } else … … 237 218 238 219 if (count) { 239 if ((conn->type == AIM_CONN_TYPE_RENDEZVOUS) &&240 (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM)) {241 /* I strongly suspect that this is a horrible thing to do242 * and I feel really guilty doing it. */243 const char *sn = aim_directim_getsn(conn);244 aim_rxcallback_t userfunc;245 while (count - wrote > 1024) {246 wrote = wrote + aim_send(conn->fd, bs->data + bs->offset + wrote, 1024);247 if ((userfunc=aim_callhandler(conn->sessv, conn,248 AIM_CB_FAM_SPECIAL,249 AIM_CB_SPECIAL_IMAGETRANSFER)))250 userfunc(conn->sessv, NULL, sn,251 count-wrote>1024 ? ((double)wrote / count) : 1);252 }253 }254 220 if (count - wrote) { 255 221 wrote = wrote + aim_send(conn->fd, bs->data + bs->offset + wrote, count - wrote); … … 299 265 } 300 266 301 static int sendframe_oft(aim_session_t *sess, aim_frame_t *fr)302 {303 aim_bstream_t hbs;304 guint8 *hbs_raw;305 int hbslen;306 int err = 0;307 308 hbslen = 8 + fr->hdr.oft.hdr2len;309 if (!(hbs_raw = g_malloc(hbslen)))310 return -1;311 312 aim_bstream_init(&hbs, hbs_raw, hbslen);313 314 aimbs_putraw(&hbs, fr->hdr.oft.magic, 4);315 aimbs_put16(&hbs, fr->hdr.oft.hdr2len + 8);316 aimbs_put16(&hbs, fr->hdr.oft.type);317 aimbs_putraw(&hbs, fr->hdr.oft.hdr2, fr->hdr.oft.hdr2len);318 319 aim_bstream_rewind(&hbs);320 321 322 if (aim_bstream_send(&hbs, fr->conn, hbslen) != hbslen) {323 324 err = -errno;325 326 } else if (aim_bstream_curpos(&fr->data)) {327 int len;328 329 len = aim_bstream_curpos(&fr->data);330 aim_bstream_rewind(&fr->data);331 332 if (aim_bstream_send(&fr->data, fr->conn, len) != len)333 err = -errno;334 }335 336 g_free(hbs_raw); /* XXX aim_bstream_free */337 338 fr->handled = 1;339 fr->conn->lastactivity = time(NULL);340 341 342 return err;343 344 345 }346 347 267 int aim_tx_sendframe(aim_session_t *sess, aim_frame_t *fr) 348 268 { 349 269 if (fr->hdrtype == AIM_FRAMETYPE_FLAP) 350 270 return sendframe_flap(sess, fr); 351 else if (fr->hdrtype == AIM_FRAMETYPE_OFT)352 return sendframe_oft(sess, fr);353 271 return -1; 354 272 }
Note: See TracChangeset
for help on using the changeset viewer.