i += aimutil_put16(newpacket2->hdr.oft.hdr2+i, 0x0000);
i += aimutil_put16(newpacket2->hdr.oft.hdr2+i, 0x0000);
- i += aimutil_putstr(newpacket2->hdr.oft.hdr2+i, sess->logininfo.screen_name, strlen(sess->logininfo.screen_name));
+ i += aimutil_putstr(newpacket2->hdr.oft.hdr2+i, sess->sn, strlen(sess->sn));
i = 52; /* 0x34 */
i += aimutil_put8(newpacket2->hdr.oft.hdr2+i, 0x00); /* 53 */
i += aimutil_put16(newpacket->hdr.oft.hdr2+i, 0x0000);
i += aimutil_put16(newpacket->hdr.oft.hdr2+i, 0x0000);
- i += aimutil_putstr(newpacket->hdr.oft.hdr2+i, sess->logininfo.screen_name, strlen(sess->logininfo.screen_name));
+ i += aimutil_putstr(newpacket->hdr.oft.hdr2+i, sess->sn, strlen(sess->sn));
i = 52; /* 0x34 */
i += aimutil_put8(newpacket->hdr.oft.hdr2+i, 0x00); /* 53 */
* n seconds of no connection. -- mid
*/
-#ifdef USE_SNAC_FOR_IMS
- {
- struct aim_snac_t snac;
-
- snac.id = sess->snac_nextid;
- snac.family = 0x0004;
- snac.type = 0x0006;
- snac.flags = 0x0000;
-
- snac.data = malloc(strlen(destsn)+1);
- memcpy(snac.data, destsn, strlen(destsn)+1);
-
- aim_newsnac(sess, &snac);
-
- aim_cleansnacs(sess, 60); /* clean out all SNACs over 60sec old */
- }
-#endif
-
return (newconn);
}
faimdprintf(2, "faim: rend: read error (fd: %i) %02x%02x%02x%02x%02x%02x (%i)\n", conn->fd, hdrbuf1[0],hdrbuf1[1],hdrbuf1[0],hdrbuf1[0],hdrbuf1[0],hdrbuf1[0],hdrlen);
faim_mutex_unlock(&conn->active);
- aim_conn_close(conn);
if(hdrlen < 0)
perror("read");
else { /* disconnected */
- int i = -1;
switch(conn->subtype) {
case AIM_CONN_SUBTYPE_OFT_DIRECTIM: { /* XXX: clean up cookies here ? */
- struct aim_directim_priv *priv;
- if(!(priv = (struct aim_directim_priv *)conn->priv) )
+ struct aim_directim_priv *priv = NULL;
+ if(!(priv = (struct aim_directim_priv *)conn->priv) )
return -1; /* not much we can do */
+ aim_uncachecookie(sess, priv->cookie, AIM_COOKIETYPE_OFTIM);
- if ( (userfunc = aim_callhandler(conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMDISCONNECT)) )
- i = userfunc(sess, NULL, conn, priv->sn);
- else
- aim_conn_kill(sess, &conn);
+
+ if ( (userfunc = aim_callhandler(conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMDISCONNECT)) ) {
+ aim_conn_close(conn);
+ return userfunc(sess, NULL, conn, priv->sn);
+ }
- aim_uncachecookie(sess, priv->cookie, AIM_COOKIETYPE_OFTIM);
+ break;
}
+
case AIM_CONN_SUBTYPE_OFT_GETFILE: {
struct aim_filetransfer_priv *priv;
if(!(priv = (struct aim_filetransfer_priv *)conn->priv))
return -1;
- if ( (userfunc = aim_callhandler(conn, AIM_CB_FAM_OFT, AIM_CB_OFT_GETFILEDISCONNECT)) )
- i = userfunc(sess, NULL, conn, priv->sn);
- else
- aim_conn_kill(sess, &conn);
-
aim_uncachecookie(sess, priv->cookie, AIM_COOKIETYPE_OFTGET);
+
+ if ( (userfunc = aim_callhandler(conn, AIM_CB_FAM_OFT, AIM_CB_OFT_GETFILEDISCONNECT)) ) {
+ aim_conn_close(conn);
+ return userfunc(sess, NULL, conn, priv->sn);
+ }
+
+ break;
}
+
case AIM_CONN_SUBTYPE_OFT_SENDFILE: {
struct aim_filetransfer_priv *priv;
if(!(priv = (struct aim_filetransfer_priv *)conn->priv))
return -1;
- if ( (userfunc = aim_callhandler(conn, AIM_CB_FAM_OFT, AIM_CB_OFT_SENDFILEDISCONNECT)) )
- i = userfunc(sess, NULL, conn, priv->sn);
- else
- aim_conn_kill(sess, &conn);
+ aim_uncachecookie(sess, priv->cookie, AIM_COOKIETYPE_OFTSEND);
+ if ( (userfunc = aim_callhandler(conn, AIM_CB_FAM_OFT, AIM_CB_OFT_SENDFILEDISCONNECT)) ) {
+ aim_conn_close(conn);
+ return userfunc(sess, NULL, conn, priv->sn);
+ }
- aim_uncachecookie(sess, priv->cookie, AIM_COOKIETYPE_OFTSEND);
+ break;
}
}
- return i;
+ aim_conn_close(conn);
+ aim_conn_kill(sess, &conn);
+
+ return -1;
}
}
* if (pos + chunksize > fh->size), we only send as much data as we
* can get (ie: up to fh->size.
*/
-
faim_export int aim_getfile_send_chunk(struct aim_conn_t *conn, FILE *tosend, struct aim_fileheader_t *fh, int pos, int bufsize)
{
int bufpos;
* n seconds of no connection. -- mid
*/
-#ifdef USE_SNAC_FOR_IMS
- {
- struct aim_snac_t snac;
-
- snac.id = sess->snac_nextid;
- snac.family = 0x0004;
- snac.type = 0x0006;
- snac.flags = 0x0000;
-
- snac.data = malloc(strlen(destsn)+1);
- memcpy(snac.data, destsn, strlen(destsn)+1);
-
- aim_newsnac(sess, &snac);
-
- aim_cleansnacs(sess, 60); /* clean out all SNACs over 60sec old */
- }
-#endif
-
return newconn;
}