changeset 2673:81d658e6ac1e

[gaim-migrate @ 2686] my back hurts. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 05 Nov 2001 08:25:10 +0000
parents c41030cfed76
children de99ce38ad1f
files src/protocols/oscar/aim.h src/protocols/oscar/ft.c src/protocols/oscar/im.c src/protocols/oscar/oscar.c src/protocols/oscar/popups.c
diffstat 5 files changed, 87 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/aim.h	Mon Nov 05 02:05:06 2001 +0000
+++ b/src/protocols/oscar/aim.h	Mon Nov 05 08:25:10 2001 +0000
@@ -783,9 +783,9 @@
 	} info;
 };
 
-faim_export int aim_send_im_ext(aim_session_t *sess, aim_conn_t *conn, struct aim_sendimext_args *args);
-faim_export int aim_send_im(aim_session_t *, aim_conn_t *, const char *destsn, unsigned short flags, const char *msg);
-faim_export int aim_send_icon(aim_session_t *sess, aim_conn_t *conn, const char *sn, const fu8_t *icon, int iconlen, time_t stamp, fu16_t iconsum);
+faim_export int aim_send_im_ext(aim_session_t *sess, struct aim_sendimext_args *args);
+faim_export int aim_send_im(aim_session_t *, const char *destsn, unsigned short flags, const char *msg);
+faim_export int aim_send_icon(aim_session_t *sess, const char *sn, const fu8_t *icon, int iconlen, time_t stamp, fu16_t iconsum);
 faim_export fu16_t aim_iconsum(const fu8_t *buf, int buflen);
 faim_export int aim_send_im_direct(aim_session_t *, aim_conn_t *, const char *msg);
 faim_export const char *aim_directim_getsn(aim_conn_t *conn);
@@ -850,7 +850,7 @@
 #define AIM_TRANSFER_DENY_NOTSUPPORTED 0x0000
 #define AIM_TRANSFER_DENY_DECLINE 0x0001
 #define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002
-faim_export int aim_denytransfer(aim_session_t *sess, aim_conn_t *conn, const char *sender, const char *cookie, unsigned short code);
+faim_export int aim_denytransfer(aim_session_t *sess, const char *sender, const char *cookie, unsigned short code);
 faim_export aim_conn_t *aim_accepttransfer(aim_session_t *sess, aim_conn_t *conn, const char *sn, const fu8_t *cookie, const fu8_t *ip, fu16_t listingfiles, fu16_t listingtotsize, fu16_t listingsize, fu32_t listingchecksum, fu16_t rendid);
 
 faim_export int aim_getinfo(aim_session_t *, aim_conn_t *, const char *, unsigned short);
@@ -888,8 +888,8 @@
 	unsigned long minmsginterval; /* in milliseconds? */
 };
 
-faim_export int aim_reqicbmparams(aim_session_t *sess, aim_conn_t *conn);
-faim_export int aim_seticbmparam(aim_session_t *sess, aim_conn_t *conn, struct aim_icbmparameters *params);
+faim_export int aim_reqicbmparams(aim_session_t *sess);
+faim_export int aim_seticbmparam(aim_session_t *sess, struct aim_icbmparameters *params);
 
 
 /* auth.c */
--- a/src/protocols/oscar/ft.c	Mon Nov 05 02:05:06 2001 +0000
+++ b/src/protocols/oscar/ft.c	Mon Nov 05 08:25:10 2001 +0000
@@ -28,7 +28,9 @@
 };
 
 static int listenestablish(fu16_t portnum);
+#if 0
 static struct aim_fileheader_t *aim_oft_getfh(unsigned char *hdr);
+#endif
  
 /**
  * aim_handlerendconnect - call this to accept OFT connections and set up the required structures
--- a/src/protocols/oscar/im.c	Mon Nov 05 02:05:06 2001 +0000
+++ b/src/protocols/oscar/im.c	Mon Nov 05 08:25:10 2001 +0000
@@ -144,16 +144,20 @@
  * XXX check SNAC size for multipart
  *
  */
-faim_export int aim_send_im_ext(aim_session_t *sess, aim_conn_t *conn, struct aim_sendimext_args *args)
+faim_export int aim_send_im_ext(aim_session_t *sess, struct aim_sendimext_args *args)
 {
 	static const fu8_t deffeatures[] = {
 		0x01, 0x01, 0x01, 0x02
 	};
+	aim_conn_t *conn;
 	int i, msgtlvlen;
 	aim_frame_t *fr;
 	aim_snacid_t snacid;
 
-	if (!sess || !conn || !args)
+	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)))
+		return -EINVAL;
+
+	if (!args)
 		return -EINVAL;
 
 	if (args->flags & AIM_IMFLAGS_MULTIPART) {
@@ -340,7 +344,7 @@
  * that requires an explicit message length.  Use aim_send_im_ext().
  *
  */
-faim_export int aim_send_im(aim_session_t *sess, aim_conn_t *conn, const char *destsn, fu16_t flags, const char *msg)
+faim_export int aim_send_im(aim_session_t *sess, const char *destsn, fu16_t flags, const char *msg)
 {
 	struct aim_sendimext_args args;
 
@@ -352,24 +356,25 @@
 	/* Make these don't get set by accident -- they need aim_send_im_ext */
 	args.flags &= ~(AIM_IMFLAGS_CUSTOMFEATURES | AIM_IMFLAGS_HASICON | AIM_IMFLAGS_MULTIPART);
 
-	return aim_send_im_ext(sess, conn, &args);
+	return aim_send_im_ext(sess, &args);
 }
 
 /*
  * This is also performance sensitive. (If you can believe it...)
  *
  */
-faim_export int aim_send_icon(aim_session_t *sess, aim_conn_t *conn, const char *sn, const fu8_t *icon, int iconlen, time_t stamp, fu16_t iconsum)
+faim_export int aim_send_icon(aim_session_t *sess, const char *sn, const fu8_t *icon, int iconlen, time_t stamp, fu16_t iconsum)
 {
+	aim_conn_t *conn;
 	int i;
 	fu8_t ck[8];
 	aim_frame_t *fr;
 	aim_snacid_t snacid;
 
-	if (!sess || !conn || !sn || !icon || (iconlen <= 0) || (iconlen >= MAXICONLEN))
+	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)))
 		return -EINVAL;
 
-	if (conn->type != AIM_CONN_TYPE_BOS)
+	if (!sn || !icon || (iconlen <= 0) || (iconlen >= MAXICONLEN))
 		return -EINVAL;
 
 	for (i = 0; i < 8; i++)
@@ -1446,12 +1451,16 @@
  *    AIM_TRANSFER_DENY_NOTACCEPTING -- "client is not accepting transfers"
  * 
  */
-faim_export int aim_denytransfer(aim_session_t *sess, aim_conn_t *conn, const char *sender, const char *cookie, fu16_t code)
+faim_export int aim_denytransfer(aim_session_t *sess, const char *sender, const char *cookie, fu16_t code)
 {
+	aim_conn_t *conn;
 	aim_frame_t *fr;
 	aim_snacid_t snacid;
 	aim_tlvlist_t *tl = NULL;
 	
+	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)))
+		return -EINVAL;
+
 	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+8+2+1+strlen(sender)+6)))
 		return -ENOMEM;
 
@@ -1479,8 +1488,13 @@
  * Request ICBM parameter information.
  *
  */
-faim_export int aim_reqicbmparams(aim_session_t *sess, aim_conn_t *conn)
+faim_export int aim_reqicbmparams(aim_session_t *sess)
 {
+	aim_conn_t *conn;
+
+	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)))
+		return -EINVAL;
+
 	return aim_genericreq_n(sess, conn, 0x0004, 0x0004);
 }
 
@@ -1490,12 +1504,16 @@
  * with the rather unreasonable defaults.  You don't want those.  Send this.
  * 
  */
-faim_export int aim_seticbmparam(aim_session_t *sess, aim_conn_t *conn, struct aim_icbmparameters *params)
+faim_export int aim_seticbmparam(aim_session_t *sess, struct aim_icbmparameters *params)
 {
+	aim_conn_t *conn;
 	aim_frame_t *fr;
 	aim_snacid_t snacid;
 
-	if (!sess || !conn || !params)
+	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)))
+		return -EINVAL;
+
+	if (!params)
 		return -EINVAL;
 
 	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+16)))
--- a/src/protocols/oscar/oscar.c	Mon Nov 05 02:05:06 2001 +0000
+++ b/src/protocols/oscar/oscar.c	Mon Nov 05 08:25:10 2001 +0000
@@ -1336,7 +1336,7 @@
 				int len = fread(buf, 1, st.st_size, file);
 				debug_printf("Sending buddy icon to %s (%d bytes, %d reported)\n",
 						userinfo->sn, len, st.st_size);
-				aim_send_icon(sess, conn, userinfo->sn, buf, st.st_size,
+				aim_send_icon(sess, userinfo->sn, buf, st.st_size,
 					      st.st_mtime, aim_iconsum(buf, st.st_size));
 				fclose(file);
 			} else
@@ -1949,7 +1949,7 @@
 
 	debug_printf("buddy list loaded\n");
 
-	aim_reqicbmparams(sess, fr->conn);
+	aim_reqicbmparams(sess);
 
 	aim_bos_reqrights(sess, fr->conn);
 	aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS);
@@ -2008,7 +2008,7 @@
 	params->maxmsglen = 8000;
 	params->minmsginterval = 0;
 
-	aim_seticbmparam(sess, fr->conn, params);
+	aim_seticbmparam(sess, params);
 
 	return 1;
 }
@@ -2151,7 +2151,7 @@
 		ret = aim_send_im_direct(odata->sess, dim->conn, message);
 	} else {
 		if (imflags & IM_FLAG_AWAY)
-			ret = aim_send_im(odata->sess, odata->conn, name, AIM_IMFLAGS_AWAY, message);
+			ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message);
 		else {
 			struct aim_sendimext_args args;
 			GSList *h = odata->hasicons;
@@ -2198,7 +2198,7 @@
 			args.msg    = message;
 			args.msglen = strlen(message);
 
-			ret = aim_send_im_ext(odata->sess, odata->conn, &args);
+			ret = aim_send_im_ext(odata->sess, &args);
 		}
 	}
 	if (ret >= 0)
--- a/src/protocols/oscar/popups.c	Mon Nov 05 02:05:06 2001 +0000
+++ b/src/protocols/oscar/popups.c	Mon Nov 05 08:25:10 2001 +0000
@@ -1,10 +1,53 @@
+
 /*
- * This might be fun to implement. Right? Maybe not. 
+ * Popups are just what it sounds like.  They're a way for the server to
+ * open up an informative box on the client's screen.
  */
 
 #define FAIM_INTERNAL
 #include <aim.h>
 
+/*
+ * This is all there is to it.
+ *
+ * The message is probably HTML.
+ * 
+ */
+static int parsepopup(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
+{
+	aim_rxcallback_t userfunc;
+	aim_tlvlist_t *tl;
+	int ret = 0;
+	char *msg, *url;
+	fu16_t width, height, delay;
+
+	tl = aim_readtlvchain(bs);
+
+	msg = aim_gettlv_str(tl, 0x0001, 1);
+	url = aim_gettlv_str(tl, 0x0002, 1);
+	width = aim_gettlv16(tl, 0x0003, 1);
+	height = aim_gettlv16(tl, 0x0004, 1);
+	delay = aim_gettlv16(tl, 0x0005, 1);
+
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+		ret = userfunc(sess, rx, msg, url, width, height, delay);
+
+	aim_freetlvchain(&tl);
+	free(msg);
+	free(url);
+
+	return ret;
+}
+
+static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
+{
+
+	if (snac->subtype == 0x0002)
+		return parsepopup(sess, mod, rx, snac, bs);
+
+	return 0;
+}
+
 faim_internal int popups_modfirst(aim_session_t *sess, aim_module_t *mod)
 {
 
@@ -14,7 +57,7 @@
 	mod->toolversion = 0x0001;
 	mod->flags = 0;
 	strncpy(mod->name, "popups", sizeof(mod->name));
-	mod->snachandler = NULL;
+	mod->snachandler = snachandler;
 
 	return 0;
 }