Update of /cvsroot/gaim/gaim/src/protocols/oscar
In directory usw-pr-cvs1:/tmp/cvs-serv16772/src/protocols/oscar
Modified Files:
oscar.c txqueue.c
Log Message:
DirectIM Image sending. Not all the kinks are worked out, and it's really hackish at parts, but it works and I think it's stable.
It's late and I have to be up early tommorow, and I want this to be somewhat tested before 0.54 is released so we don't have a repeat of 0.53 ;)
Also, Luke Schierer wins the #gaim MVP award with an inclusion in CREDITS :) Thanks, Luke.
Index: oscar.c
===================================================================
RCS file: /cvsroot/gaim/gaim/src/protocols/oscar/oscar.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- oscar.c 13 Mar 2002 04:06:23 -0000 1.115
+++ oscar.c 14 Mar 2002 07:44:43 -0000 1.116
@@ -2436,7 +2436,11 @@
else return ret;
}
debug_printf("Direct IM pending, but not connected; sending through server\n");
- }
+ } else if (len != -1) {
+ /* Trying to send an IM image outside of a direct connection. */
+ oscar_ask_direct_im(gc, name);
+ return -ENOTCONN;
+ }
if (imflags & IM_FLAG_AWAY) {
ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message);
} else {
@@ -3168,6 +3172,9 @@
if (!(dim = find_direct_im(od, sn)))
return 1;
gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */
+ while (gtk_events_pending())
+ gtk_main_iteration();
+
if ((c = find_conversation(sn)))
update_progress(c, percent);
dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
@@ -3554,7 +3561,7 @@
void oscar_init(struct prpl *ret) {
ret->protocol = PROTO_OSCAR;
- ret->options = OPT_PROTO_BUDDY_ICON;
+ ret->options = OPT_PROTO_BUDDY_ICON | OPT_PROTO_IM_IMAGE;
ret->name = oscar_name;
ret->list_icon = oscar_list_icon;
ret->away_states = oscar_away_states;
Index: txqueue.c
===================================================================
RCS file: /cvsroot/gaim/gaim/src/protocols/oscar/txqueue.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- txqueue.c 12 Sep 2001 00:39:51 -0000 1.3
+++ txqueue.c 14 Mar 2002 07:44:43 -0000 1.4
@@ -230,15 +230,34 @@
static int aim_bstream_send(aim_bstream_t *bs, aim_conn_t *conn, size_t count)
{
int wrote = 0;
-
if (!bs || !conn || (count < 0))
return -EINVAL;
if (count > aim_bstream_empty(bs))
count = aim_bstream_empty(bs); /* truncate to remaining space */
- if (count)
- wrote = aim_send(conn->fd, bs->data + bs->offset, count);
+ if (count) {
+ if ((conn->type == AIM_CONN_TYPE_RENDEZVOUS) &&
+ (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM)) {
+ /* I strongly suspect that this is a horrible thing to do
+ * and I feel really guilty doing it. */
+ char *sn = aim_directim_getsn(conn);
+ aim_rxcallback_t userfunc;
+ while (count - wrote > 1024) {
+ wrote = wrote + aim_send(conn->fd, bs->data + bs->offset + wrote, 1024);
+ if ((userfunc=aim_callhandler(conn->sessv, conn,
+ AIM_CB_FAM_SPECIAL,
+ AIM_CB_SPECIAL_IMAGETRANSFER)))
+ userfunc(conn->sessv, NULL, sn,
+ count-wrote>1024 ? ((double)wrote / count) : 1);
+ }
+ }
+ if (count - wrote) {
+ wrote = wrote + aim_send(conn->fd, bs->data + bs->offset + wrote, count - wrote);
+ }
+
+ }
+
if (((aim_session_t *)conn->sessv)->debug >= 2) {
int i;
@@ -284,7 +303,6 @@
obslen = aim_bstream_curpos(&obs);
aim_bstream_rewind(&obs);
-
if (aim_bstream_send(&obs, fr->conn, obslen) != obslen)
err = -errno;
@@ -302,9 +320,8 @@
fu8_t *hbs_raw;
int hbslen;
int err = 0;
-
+
hbslen = 8 + fr->hdr.oft.hdr2len;
-
if (!(hbs_raw = malloc(hbslen)))
return -1;
@@ -317,6 +334,7 @@
aim_bstream_rewind(&hbs);
+
if (aim_bstream_send(&hbs, fr->conn, hbslen) != hbslen) {
err = -errno;
@@ -338,6 +356,8 @@
return err;
+
+
}
faim_internal int aim_tx_sendframe(aim_session_t *sess, aim_frame_t *fr)
|