]> andersk Git - libfaim.git/blobdiff - src/im.c
- Wed Aug 29 16:59:24 PDT 2001
[libfaim.git] / src / im.c
index e48fef2294deacab2d3546b63ab28014cefc628f..143f4d765a04ab32317ec2c11cfcbc24e105bb0e 100644 (file)
--- a/src/im.c
+++ b/src/im.c
@@ -578,6 +578,8 @@ static int incomingim_ch1(struct aim_session_t *sess, aim_module_t *mod,  struct
 
                } else if ((type == 0x0008) && (length == 0x000c)) { /* I-HAVE-A-REALLY-PURTY-ICON Flag */
 
+                       args.iconchecksum = aimutil_get32(data+i);
+                       args.iconlength = aimutil_get32(data+i+4);
                        args.iconstamp = aimutil_get32(data+i+8);
                        args.icbmflags |= AIM_IMFLAGS_HASICON;
 
@@ -619,7 +621,7 @@ static int incomingim_ch2(struct aim_session_t *sess, aim_module_t *mod,  struct
        /*
         * There's another block of TLVs embedded in the type 5 here. 
         */
-       if ((block1 = aim_gettlv(tlvlist, 0x0005, 1)) && block1->value) {
+       if (!(block1 = aim_gettlv(tlvlist, 0x0005, 1)) || !block1->value) {
                faimdprintf(sess, 0, "no tlv 0x0005 in rendezvous transaction!\n");
                return 0;
        }
@@ -655,11 +657,11 @@ static int incomingim_ch2(struct aim_session_t *sess, aim_module_t *mod,  struct
        }
 
        /* 
-       * What follows may be TLVs or nothing, depending on the
-       * purpose of the message.
-       *
-       * Ack packets for instance have nothing more to them.
-       */
+        * What follows may be TLVs or nothing, depending on the
+        * purpose of the message.
+        *
+        * Ack packets for instance have nothing more to them.
+        */
        list2 = aim_readtlvchain(block1->value+2+8+16, block1->length-2-8-16);
 
        if (!list2 || ((args.reqclass != AIM_CAPS_IMIMAGE) && !(aim_gettlv(list2, 0x2711, 1)))) {
@@ -719,7 +721,7 @@ static int incomingim_ch2(struct aim_session_t *sess, aim_module_t *mod,  struct
 
                miscinfo = aim_gettlv(list2, 0x2711, 1);
 
-               /* aimutil_get32(miscinfo->value+curpos); i don't know what this is */
+               args.info.icon.checksum = aimutil_get32(miscinfo->value+curpos);
                curpos += 4;
                args.info.icon.length = aimutil_get32(miscinfo->value+curpos);
                curpos += 4;
@@ -1055,30 +1057,43 @@ faim_export int aim_denytransfer(struct aim_session_t *sess,
 }
 
 /*
- * Not real sure what this does, nor does anyone I've talk to.
+ * aim_reqicbmparaminfo()
+ *
+ * Request ICBM parameter information.
  *
- * Didn't use to send it.  But now I think it might be a good
- * idea. 
+ */
+faim_export unsigned long aim_reqicbmparams(struct aim_session_t *sess, struct aim_conn_t *conn)
+{
+       return aim_genericreq_n(sess, conn, 0x0004, 0x0004);
+}
+
+/*
  *
  */
-faim_export unsigned long aim_seticbmparam(struct aim_session_t *sess,
-                                               struct aim_conn_t *conn)
+faim_export unsigned long aim_seticbmparam(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_icbmparameters *params)
 {
        struct command_tx_struct *newpacket;
        int curbyte;
 
+       if (!sess || !conn || !params)
+               return -EINVAL;
+
        if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 10+16)))
                return -ENOMEM;
 
        newpacket->lock = 1;
 
        curbyte = aim_putsnac(newpacket->data, 0x0004, 0x0002, 0x0000, sess->snac_nextid++);
-       curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000); /* max channel?? */
-       curbyte += aimutil_put32(newpacket->data+curbyte, 0x00000003); /* default flags?? */
-       curbyte += aimutil_put16(newpacket->data+curbyte,  0x1f40); /* max msg size */
-       curbyte += aimutil_put16(newpacket->data+curbyte,  0x03e7); /* maxsenderwarn */
-       curbyte += aimutil_put16(newpacket->data+curbyte,  0x03e7); /* max recver warn */
-       curbyte += aimutil_put32(newpacket->data+curbyte, 0x00000000); /* min msg interval */
+
+       /* This is read-only (in Parameter Reply). Must be set to zero here. */
+       curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000);
+
+       /* These are all read-write */
+       curbyte += aimutil_put32(newpacket->data+curbyte, params->flags); 
+       curbyte += aimutil_put16(newpacket->data+curbyte, params->maxmsglen);
+       curbyte += aimutil_put16(newpacket->data+curbyte, params->maxsenderwarn); 
+       curbyte += aimutil_put16(newpacket->data+curbyte, params->maxrecverwarn); 
+       curbyte += aimutil_put32(newpacket->data+curbyte, params->minmsginterval);
 
        newpacket->lock = 0;
        aim_tx_enqueue(sess, newpacket);
@@ -1088,68 +1103,61 @@ faim_export unsigned long aim_seticbmparam(struct aim_session_t *sess,
 
 static int paraminfo(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
-       unsigned long defflags, minmsginterval;
-       unsigned short maxicbmlen, maxsenderwarn, maxrecverwarn, maxchannel;
+       struct aim_icbmparameters params;
        aim_rxcallback_t userfunc;
        int i = 0;
 
-       maxchannel = aimutil_get16(data+i);
+       params.maxchan = aimutil_get16(data+i);
        i += 2;
 
-       defflags = aimutil_get32(data+i);
+       params.flags = aimutil_get32(data+i);
        i += 4;
 
-       maxicbmlen = aimutil_get16(data+i);
+       params.maxmsglen = aimutil_get16(data+i);
        i += 2;
 
-       maxsenderwarn = aimutil_get16(data+i);
+       params.maxsenderwarn = aimutil_get16(data+i);
        i += 2;
 
-       maxrecverwarn = aimutil_get16(data+i);
+       params.maxrecverwarn = aimutil_get16(data+i);
        i += 2;
 
-       minmsginterval = aimutil_get32(data+i);
+       params.minmsginterval = aimutil_get32(data+i);
        i += 4;
 
        if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
-               return userfunc(sess, rx, maxchannel, defflags, maxicbmlen, maxsenderwarn, maxrecverwarn, minmsginterval);
+               return userfunc(sess, rx, &params);
 
        return 0;
 }
 
 static int missedcall(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
-       int i = 0;
+       int i, ret = 0;
        aim_rxcallback_t userfunc;
        unsigned short channel, nummissed, reason;
        struct aim_userinfo_s userinfo;
+       
+       for (i = 0; i < datalen; ) {
 
-       /*
-        * XXX: supposedly, this entire packet can repeat as many times
-        * as necessary. Should implement that.
-        */
-
-       /*
-        * Channel ID.
-        */
-       channel = aimutil_get16(data+i);
-       i += 2;
+               /* Channel ID. */
+               channel = aimutil_get16(data+i);
+               i += 2;
 
-       /*
-        * Extract the standard user info block.
-        */
-       i += aim_extractuserinfo(sess, data+i, &userinfo);
+               /* Extract the standard user info block. */
+               i += aim_extractuserinfo(sess, data+i, &userinfo);
 
-       nummissed = aimutil_get16(data+i);
-       i += 2;
+               nummissed = aimutil_get16(data+i);
+               i += 2;
 
-       reason = aimutil_get16(data+i);
-       i += 2;
+               reason = aimutil_get16(data+i);
+               i += 2;
 
-       if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
-               return userfunc(sess, rx, channel, &userinfo, nummissed, reason);
+               if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+                        ret = userfunc(sess, rx, channel, &userinfo, nummissed, reason);
+       }
 
-       return 0;
+       return ret;
 }
 
 static int msgack(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
This page took 0.075241 seconds and 4 git commands to generate.