Index: libfaim/service.c
===================================================================
--- libfaim/service.c	(revision e374dee70435f8c596358571092675644a9ba731)
+++ libfaim/service.c	(revision cf02dd64c267036375fdf872c3528766fe980d54)
@@ -109,17 +109,17 @@
 	memset(&redir, 0, sizeof(redir));
 
-	tlvlist = aim_readtlvchain(bs);
-
-	if (!aim_gettlv(tlvlist, 0x000d, 1) ||
-			!aim_gettlv(tlvlist, 0x0005, 1) ||
-			!aim_gettlv(tlvlist, 0x0006, 1)) {
-		aim_freetlvchain(&tlvlist);
+	tlvlist = aim_tlvlist_read(bs);
+
+	if (!aim_tlv_gettlv(tlvlist, 0x000d, 1) ||
+			!aim_tlv_gettlv(tlvlist, 0x0005, 1) ||
+			!aim_tlv_gettlv(tlvlist, 0x0006, 1)) {
+		aim_tlvlist_free(&tlvlist);
 		return 0;
 	}
 
-	redir.group = aim_gettlv16(tlvlist, 0x000d, 1);
-	redir.ip = aim_gettlv_str(tlvlist, 0x0005, 1);
-	redir.cookielen = aim_gettlv(tlvlist, 0x0006, 1)->length;
-	redir.cookie = aim_gettlv_str(tlvlist, 0x0006, 1);
+	redir.group = aim_tlv_get16(tlvlist, 0x000d, 1);
+	redir.ip = aim_tlv_getstr(tlvlist, 0x0005, 1);
+	redir.cookielen = aim_tlv_gettlv(tlvlist, 0x0006, 1)->length;
+	redir.cookie = aim_tlv_getstr(tlvlist, 0x0006, 1);
 
 	/* Fetch original SNAC so we can get csi if needed */
@@ -144,5 +144,5 @@
 	free(origsnac);
 
-	aim_freetlvchain(&tlvlist);
+	aim_tlvlist_free(&tlvlist);
 
 	return ret;
@@ -152,5 +152,5 @@
 faim_internal int aim_reqrates(aim_session_t *sess, aim_conn_t *conn)
 {
-	return aim_genericreq_n(sess, conn, 0x0001, 0x0006);
+	return aim_genericreq_n_snacid(sess, conn, 0x0001, 0x0006);
 }
 
@@ -492,5 +492,5 @@
 faim_export int aim_reqpersonalinfo(aim_session_t *sess, aim_conn_t *conn)
 {
-	return aim_genericreq_n(sess, conn, 0x0001, 0x000e);
+	return aim_genericreq_n_snacid(sess, conn, 0x0001, 0x000e);
 }
 
@@ -544,6 +544,11 @@
  *
  */
-faim_export int aim_bos_setidle(aim_session_t *sess, aim_conn_t *conn, fu32_t idletime)
-{
+faim_export int aim_srv_setidle(aim_session_t *sess, fu32_t idletime)
+{
+	aim_conn_t *conn;
+
+	if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_BOS)))
+		return -EINVAL;
+
 	return aim_genericreq_l(sess, conn, 0x0001, 0x0011, &idletime);
 }
@@ -586,15 +591,15 @@
 	}
 
-	tl = aim_readtlvchain(bs);
-
-	if (aim_gettlv(tl, 0x0005, 1))
-		ip = aim_gettlv_str(tl, 0x0005, 1);
-
-	cktlv = aim_gettlv(tl, 0x0006, 1);
+	tl = aim_tlvlist_read(bs);
+
+	if (aim_tlv_gettlv(tl, 0x0005, 1))
+		ip = aim_tlv_getstr(tl, 0x0005, 1);
+
+	cktlv = aim_tlv_gettlv(tl, 0x0006, 1);
 
 	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
 		ret = userfunc(sess, rx, ip, cktlv ? cktlv->value : NULL);
 
-	aim_freetlvchain(&tl);
+	aim_tlvlist_free(&tl);
 	free(ip);
 
@@ -627,7 +632,7 @@
 	 * TLVs follow 
 	 */
-	tlvlist = aim_readtlvchain(bs);
-
-	msg = aim_gettlv_str(tlvlist, 0x000b, 1);
+	tlvlist = aim_tlvlist_read(bs);
+
+	msg = aim_tlv_getstr(tlvlist, 0x000b, 1);
 
 	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
@@ -636,5 +641,5 @@
 	free(msg);
 
-	aim_freetlvchain(&tlvlist);
+	aim_tlvlist_free(&tlvlist);
 
 	return ret;
@@ -661,4 +666,6 @@
  * really necessary.
  *
+ * Wha?  No?  Since when?  I think WinAIM sends an empty channel 3 
+ * SNAC as a no-op...
  */
 faim_export int aim_nop(aim_session_t *sess, aim_conn_t *conn)
@@ -761,7 +768,7 @@
 	aim_putsnac(&fr->data, 0x0001, 0x001e, 0x0000, snacid);
 	
-	aim_addtlvtochain32(&tl, 0x0006, data);
-	aim_writetlvchain(&fr->data, &tl);
-	aim_freetlvchain(&tl);
+	aim_tlvlist_add_32(&tl, 0x0006, data);
+	aim_tlvlist_write(&fr->data, &tl);
+	aim_tlvlist_free(&tl);
 	
 	aim_tx_enqueue(sess, fr);
@@ -788,5 +795,5 @@
 		return -EINVAL;
 
-	if (msg) {
+	if (msg != NULL) {
 		if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + strlen(msg) + 8)))
 			return -ENOMEM;
@@ -795,6 +802,6 @@
 		aim_putsnac(&fr->data, 0x0001, 0x001e, 0x0000, snacid);
 
-		aimbs_put16(&fr->data, 0x001d);
-		aimbs_put16(&fr->data, strlen(msg)+8);
+		aimbs_put16(&fr->data, 0x001d); /* userinfo TLV type */
+		aimbs_put16(&fr->data, strlen(msg)+8); /* total length of userinfo TLV data */
 		aimbs_put16(&fr->data, 0x0002);
 		aimbs_put8(&fr->data, 0x04);
@@ -871,7 +878,7 @@
 	offset = aimbs_get32(bs);
 	len = aimbs_get32(bs);
-	list = aim_readtlvchain(bs);
-
-	modname = aim_gettlv_str(list, 0x0001, 1);
+	list = aim_tlvlist_read(bs);
+
+	modname = aim_tlv_getstr(list, 0x0001, 1);
 
 	faimdprintf(sess, 1, "data at 0x%08lx (%d bytes) of requested\n", offset, len, modname ? modname : "aim.exe");
@@ -881,5 +888,5 @@
 
 	free(modname);
-	aim_freetlvchain(&list);
+	aim_tlvlist_free(&list);
 
 	return ret;
@@ -1068,5 +1075,5 @@
 }
 
-faim_internal int general_modfirst(aim_session_t *sess, aim_module_t *mod)
+faim_internal int service_modfirst(aim_session_t *sess, aim_module_t *mod)
 {
 
@@ -1076,5 +1083,5 @@
 	mod->toolversion = 0x0629;
 	mod->flags = 0;
-	strncpy(mod->name, "general", sizeof(mod->name));
+	strncpy(mod->name, "service", sizeof(mod->name));
 	mod->snachandler = snachandler;
 
