Index: protocols/yahoo/libyahoo2.c
===================================================================
--- protocols/yahoo/libyahoo2.c	(revision 56699f009a608ecff3a247a08b3d0105a5e17153)
+++ protocols/yahoo/libyahoo2.c	(revision c36f73bd317dd55d7e70275a6425faa4be7bfd8c)
@@ -3,4 +3,6 @@
  *
  * Some code copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
+ * YMSG16 code copyright (C) 2009, 
+ * 		Siddhesh Poyarekar <siddhesh dot poyarekar at gmail dot com>
  *
  * Yahoo Search copyright (C) 2003, Konstantin Klyagin <konst AT konst.org.ua>
@@ -27,4 +29,6 @@
  *     <hiro-y@kcn.ne.jp>
  *
+ * YMSG16 authentication code based mostly on write-up at:
+ * 	http://www.carbonize.co.uk/ymsg16.html
  *
  * This program is free software; you can redistribute it and/or modify
@@ -92,7 +96,7 @@
 
 #ifdef USE_STRUCT_CALLBACKS
-struct yahoo_callbacks *yc=NULL;
-
-void yahoo_register_callbacks(struct yahoo_callbacks * tyc)
+struct yahoo_callbacks *yc = NULL;
+
+void yahoo_register_callbacks(struct yahoo_callbacks *tyc)
 {
 	yc = tyc;
@@ -106,5 +110,5 @@
 static int yahoo_send_data(int fd, void *data, int len);
 
-int yahoo_log_message(char * fmt, ...)
+int yahoo_log_message(char *fmt, ...)
 {
 	char out[1024];
@@ -113,10 +117,10 @@
 	vsnprintf(out, sizeof(out), fmt, ap);
 	va_end(ap);
-	return YAHOO_CALLBACK(ext_yahoo_log)("%s", out);
-}
-
-int yahoo_connect(char * host, int port)
-{
-	return YAHOO_CALLBACK(ext_yahoo_connect)(host, port);
+	return YAHOO_CALLBACK(ext_yahoo_log) ("%s", out);
+}
+
+int yahoo_connect(char *host, int port)
+{
+	return YAHOO_CALLBACK(ext_yahoo_connect) (host, port);
 }
 
@@ -138,12 +142,12 @@
 static char pager_host[] = "scs.msg.yahoo.com"; 
 static int pager_port = 5050;
-static int fallback_ports[]={23, 25, 80, 20, 119, 8001, 8002, 5050, 0};
-static char filetransfer_host[]="filetransfer.msg.yahoo.com";
-static int filetransfer_port=80;
-static char webcam_host[]="webcam.yahoo.com";
-static int webcam_port=5100;
-static char webcam_description[]="";
-static char local_host[]="";
-static int conn_type=Y_WCM_DSL;
+static int fallback_ports[] = { 23, 25, 80, 20, 119, 8001, 8002, 5050, 0 };
+static char filetransfer_host[] = "filetransfer.msg.yahoo.com";
+static int filetransfer_port = 80;
+static char webcam_host[] = "webcam.yahoo.com";
+static int webcam_port = 5100;
+static char webcam_description[] = "";
+static char local_host[] = "";
+static int conn_type = Y_WCM_DSL;
 
 static char profile_url[] = "http://profiles.yahoo.com/";
@@ -215,16 +219,16 @@
 	YAHOO_SERVICE_PICTURE_UPDATE = 0xc1,
 	YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2,
-	YAHOO_SERVICE_Y6_VISIBILITY=0xc5,
-	YAHOO_SERVICE_Y6_STATUS_UPDATE=0xc6,
-	YAHOO_PHOTOSHARE_INIT=0xd2,	
-	YAHOO_SERVICE_CONTACT_YMSG13=0xd6,
-	YAHOO_PHOTOSHARE_PREV=0xd7,
-	YAHOO_PHOTOSHARE_KEY=0xd8,
-	YAHOO_PHOTOSHARE_TRANS=0xda,
-	YAHOO_FILE_TRANSFER_INIT_YMSG13=0xdc,
-	YAHOO_FILE_TRANSFER_GET_YMSG13=0xdd,
-	YAHOO_FILE_TRANSFER_PUT_YMSG13=0xde,
-	YAHOO_SERVICE_YMSG15_STATUS=0xf0,
-	YAHOO_SERVICE_YMSG15_BUDDY_LIST=0xf1,
+	YAHOO_SERVICE_Y6_VISIBILITY = 0xc5,
+	YAHOO_SERVICE_Y6_STATUS_UPDATE = 0xc6,
+	YAHOO_PHOTOSHARE_INIT = 0xd2,	
+	YAHOO_SERVICE_CONTACT_YMSG13 = 0xd6,
+	YAHOO_PHOTOSHARE_PREV = 0xd7,
+	YAHOO_PHOTOSHARE_KEY = 0xd8,
+	YAHOO_PHOTOSHARE_TRANS = 0xda,
+	YAHOO_FILE_TRANSFER_INIT_YMSG13 = 0xdc,
+	YAHOO_FILE_TRANSFER_GET_YMSG13 = 0xdd,
+	YAHOO_FILE_TRANSFER_PUT_YMSG13 = 0xde,
+	YAHOO_SERVICE_YMSG15_STATUS = 0xf0,
+	YAHOO_SERVICE_YMSG15_BUDDY_LIST = 0xf1,
 };
 
@@ -242,13 +246,13 @@
 
 struct yahoo_search_state {
-	int   lsearch_type;
-	char  *lsearch_text;
-	int   lsearch_gender;
-	int   lsearch_agerange;
-	int   lsearch_photo;
-	int   lsearch_yahoo_only;
-	int   lsearch_nstart;
-	int   lsearch_nfound;
-	int   lsearch_ntotal;
+	int lsearch_type;
+	char *lsearch_text;
+	int lsearch_gender;
+	int lsearch_agerange;
+	int lsearch_photo;
+	int lsearch_yahoo_only;
+	int lsearch_nstart;
+	int lsearch_nfound;
+	int lsearch_ntotal;
 };
 
@@ -264,28 +268,28 @@
 	struct yahoo_search_state *ys;
 
-	int   fd;
+	int fd;
 	enum yahoo_connection_type type;
 	
-	unsigned char	*rxqueue;
-	int   rxlen;
-	int   read_tag;
+	unsigned char *rxqueue;
+	int rxlen;
+	int read_tag;
 
 	YList *txqueues;
-	int   write_tag;
+	int write_tag;
 };
 
 struct yahoo_server_settings {
 	char *pager_host;
-	int   pager_port;
+	int pager_port;
 	char *filetransfer_host;
-	int   filetransfer_port;
+	int filetransfer_port;
 	char *webcam_host;
-	int   webcam_port;
+	int webcam_port;
 	char *webcam_description;
 	char *local_host;
-	int   conn_type;
+	int conn_type;
 };
 
-static void * _yahoo_default_server_settings()
+static void *_yahoo_default_server_settings()
 {
 	struct yahoo_server_settings *yss = y_new0(struct yahoo_server_settings, 1);
@@ -304,52 +308,52 @@
 }
 
-static void * _yahoo_assign_server_settings(va_list ap)
+static void *_yahoo_assign_server_settings(va_list ap)
 {
 	struct yahoo_server_settings *yss = _yahoo_default_server_settings();
 	char *key;
 	char *svalue;
-	int   nvalue;
-
-	while(1) {
+	int nvalue;
+
+	while (1) {
 		key = va_arg(ap, char *);
-		if(key == NULL)
-			break;
-
-		if(!strcmp(key, "pager_host")) {
+		if (key == NULL)
+			break;
+
+		if (!strcmp(key, "pager_host")) {
 			svalue = va_arg(ap, char *);
 			free(yss->pager_host);
 			yss->pager_host = strdup(svalue);
-		} else if(!strcmp(key, "pager_port")) {
+		} else if (!strcmp(key, "pager_port")) {
 			nvalue = va_arg(ap, int);
 			yss->pager_port = nvalue;
-		} else if(!strcmp(key, "filetransfer_host")) {
+		} else if (!strcmp(key, "filetransfer_host")) {
 			svalue = va_arg(ap, char *);
 			free(yss->filetransfer_host);
 			yss->filetransfer_host = strdup(svalue);
-		} else if(!strcmp(key, "filetransfer_port")) {
+		} else if (!strcmp(key, "filetransfer_port")) {
 			nvalue = va_arg(ap, int);
 			yss->filetransfer_port = nvalue;
-		} else if(!strcmp(key, "webcam_host")) {
+		} else if (!strcmp(key, "webcam_host")) {
 			svalue = va_arg(ap, char *);
 			free(yss->webcam_host);
 			yss->webcam_host = strdup(svalue);
-		} else if(!strcmp(key, "webcam_port")) {
+		} else if (!strcmp(key, "webcam_port")) {
 			nvalue = va_arg(ap, int);
 			yss->webcam_port = nvalue;
-		} else if(!strcmp(key, "webcam_description")) {
+		} else if (!strcmp(key, "webcam_description")) {
 			svalue = va_arg(ap, char *);
 			free(yss->webcam_description);
 			yss->webcam_description = strdup(svalue);
-		} else if(!strcmp(key, "local_host")) {
+		} else if (!strcmp(key, "local_host")) {
 			svalue = va_arg(ap, char *);
 			free(yss->local_host);
 			yss->local_host = strdup(svalue);
-		} else if(!strcmp(key, "conn_type")) {
+		} else if (!strcmp(key, "conn_type")) {
 			nvalue = va_arg(ap, int);
 			yss->conn_type = nvalue;
 		} else {
 			WARNING(("Unknown key passed to yahoo_init, "
-				"perhaps you didn't terminate the list "
-				"with NULL"));
+					"perhaps you didn't terminate the list "
+					"with NULL"));
 		}
 	}
@@ -360,5 +364,5 @@
 static void yahoo_free_server_settings(struct yahoo_server_settings *yss)
 {
-	if(!yss)
+	if (!yss)
 		return;
 
@@ -372,7 +376,7 @@
 }
 
-static YList *conns=NULL;
-static YList *inputs=NULL;
-static int last_id=0;
+static YList *conns = NULL;
+static YList *inputs = NULL;
+static int last_id = 0;
 
 static void add_to_list(struct yahoo_data *yd)
@@ -380,10 +384,10 @@
 	conns = y_list_prepend(conns, yd);
 }
-static struct yahoo_data * find_conn_by_id(int id)
+static struct yahoo_data *find_conn_by_id(int id)
 {
 	YList *l;
-	for(l = conns; l; l = y_list_next(l)) {
+	for (l = conns; l; l = y_list_next(l)) {
 		struct yahoo_data *yd = l->data;
-		if(yd->client_id == id)
+		if (yd->client_id == id)
 			return yd;
 	}
@@ -396,5 +400,5 @@
 
 /* call repeatedly to get the next one */
-static struct yahoo_input_data * find_input_by_id(int id)
+static struct yahoo_input_data *find_input_by_id(int id)
 {
 	YList *l;
@@ -407,11 +411,11 @@
 }
 
-static struct yahoo_input_data * find_input_by_id_and_webcam_user(int id, const char * who)
+static struct yahoo_input_data *find_input_by_id_and_webcam_user(int id, const char *who)
 {
 	YList *l;
 	LOG(("find_input_by_id_and_webcam_user"));
-	for(l = inputs; l; l = y_list_next(l)) {
+	for (l = inputs; l; l = y_list_next(l)) {
 		struct yahoo_input_data *yid = l->data;
-		if(yid->type == YAHOO_CONNECTION_WEBCAM && yid->yd->client_id == id 
+		if (yid->type == YAHOO_CONNECTION_WEBCAM && yid->yd->client_id == id 
 				&& yid->wcm && 
 				((who && yid->wcm->user && !strcmp(who, yid->wcm->user)) ||
@@ -422,11 +426,11 @@
 }
 
-static struct yahoo_input_data * find_input_by_id_and_type(int id, enum yahoo_connection_type type)
+static struct yahoo_input_data *find_input_by_id_and_type(int id, enum yahoo_connection_type type)
 {
 	YList *l;
 	LOG(("find_input_by_id_and_type"));
-	for(l = inputs; l; l = y_list_next(l)) {
+	for (l = inputs; l; l = y_list_next(l)) {
 		struct yahoo_input_data *yid = l->data;
-		if(yid->type == type && yid->yd->client_id == id)
+		if (yid->type == type && yid->yd->client_id == id)
 			return yid;
 	}
@@ -434,11 +438,11 @@
 }
 
-static struct yahoo_input_data * find_input_by_id_and_fd(int id, int fd)
+static struct yahoo_input_data *find_input_by_id_and_fd(int id, int fd)
 {
 	YList *l;
 	LOG(("find_input_by_id_and_fd"));
-	for(l = inputs; l; l = y_list_next(l)) {
+	for (l = inputs; l; l = y_list_next(l)) {
 		struct yahoo_input_data *yid = l->data;
-		if(yid->fd == fd && yid->yd->client_id == id)
+		if (yid->fd == fd && yid->yd->client_id == id)
 			return yid;
 	}
@@ -448,10 +452,10 @@
 static int count_inputs_with_id(int id)
 {
-	int c=0;
+	int c = 0;
 	YList *l;
 	LOG(("counting %d", id));
-	for(l = inputs; l; l = y_list_next(l)) {
+	for (l = inputs; l; l = y_list_next(l)) {
 		struct yahoo_input_data *yid = l->data;
-		if(yid->yd->client_id == id)
+		if (yid->yd->client_id == id)
 			c++;
 	}
@@ -464,12 +468,11 @@
 
 /* Free a buddy list */
-static void yahoo_free_buddies(YList * list)
+static void yahoo_free_buddies(YList *list)
 {
 	YList *l;
 
-	for(l = list; l; l = l->next)
-	{
+	for (l = list; l; l = l->next) {
 		struct yahoo_buddy *bud = l->data;
-		if(!bud)
+		if (!bud)
 			continue;
 
@@ -477,5 +480,5 @@
 		FREE(bud->id);
 		FREE(bud->real_name);
-		if(bud->yab_entry) {
+		if (bud->yab_entry) {
 			FREE(bud->yab_entry->fname);
 			FREE(bud->yab_entry->lname);
@@ -496,5 +499,5 @@
 
 /* Free an identities list */
-static void yahoo_free_identities(YList * list)
+static void yahoo_free_identities(YList *list)
 {
 	while (list) {
@@ -690,28 +693,27 @@
 }
 
-
 static void yahoo_packet_dump(unsigned char *data, int len)
 {
-	if(yahoo_get_log_level() >= YAHOO_LOG_DEBUG) {
+	if (yahoo_get_log_level() >= YAHOO_LOG_DEBUG) {
 		int i;
 		for (i = 0; i < len; i++) {
 			if ((i % 8 == 0) && i)
-				YAHOO_CALLBACK(ext_yahoo_log)(" ");
+				YAHOO_CALLBACK(ext_yahoo_log) (" ");
 			if ((i % 16 == 0) && i)
-				YAHOO_CALLBACK(ext_yahoo_log)("\n");
-			YAHOO_CALLBACK(ext_yahoo_log)("%02x ", data[i]);
-		}
-		YAHOO_CALLBACK(ext_yahoo_log)("\n");
+				YAHOO_CALLBACK(ext_yahoo_log) ("\n");
+			YAHOO_CALLBACK(ext_yahoo_log) ("%02x ", data[i]);
+		}
+		YAHOO_CALLBACK(ext_yahoo_log) ("\n");
 		for (i = 0; i < len; i++) {
 			if ((i % 8 == 0) && i)
-				YAHOO_CALLBACK(ext_yahoo_log)(" ");
+				YAHOO_CALLBACK(ext_yahoo_log) (" ");
 			if ((i % 16 == 0) && i)
-				YAHOO_CALLBACK(ext_yahoo_log)("\n");
+				YAHOO_CALLBACK(ext_yahoo_log) ("\n");
 			if (isprint(data[i]))
-				YAHOO_CALLBACK(ext_yahoo_log)(" %c ", data[i]);
+				YAHOO_CALLBACK(ext_yahoo_log) (" %c ", data[i]);
 			else
-				YAHOO_CALLBACK(ext_yahoo_log)(" . ");
-		}
-		YAHOO_CALLBACK(ext_yahoo_log)("\n");
+				YAHOO_CALLBACK(ext_yahoo_log) (" . ");
+		}
+		YAHOO_CALLBACK(ext_yahoo_log) ("\n");
 	}
 }
@@ -723,5 +725,6 @@
 }
 
-static void yahoo_add_to_send_queue(struct yahoo_input_data *yid, void *data, int length)
+static void yahoo_add_to_send_queue(struct yahoo_input_data *yid, void *data,
+	int length)
 {
 	struct data_queue *tx = y_new0(struct data_queue, 1);
@@ -732,13 +735,15 @@
 	yid->txqueues = y_list_append(yid->txqueues, tx);
 
-	if(!yid->write_tag)
-		yid->write_tag=YAHOO_CALLBACK(ext_yahoo_add_handler)(yid->yd->client_id, yid->fd, YAHOO_INPUT_WRITE, yid);
-}
-
-static void yahoo_send_packet(struct yahoo_input_data *yid, struct yahoo_packet *pkt, int extra_pad)
+	if (!yid->write_tag)
+		yid->write_tag =
+			YAHOO_CALLBACK(ext_yahoo_add_handler) (yid->yd->
+			client_id, yid->fd, YAHOO_INPUT_WRITE, yid);
+}
+
+static void yahoo_send_packet(struct yahoo_input_data *yid,
+	struct yahoo_packet *pkt, int extra_pad)
 {
 	int pktlen = yahoo_packet_length(pkt);
 	int len = YAHOO_PACKET_HDRLEN + pktlen;
-
 	unsigned char *data;
 	int pos = 0;
@@ -749,17 +754,18 @@
 	data = y_new0(unsigned char, len + 1);
 
-	memcpy(data + pos, "YMSG", 4); pos += 4;
-	pos += yahoo_put16(data + pos, YAHOO_PROTO_VER);
-	pos += yahoo_put16(data + pos, 0x0000);
-	pos += yahoo_put16(data + pos, pktlen + extra_pad);
-	pos += yahoo_put16(data + pos, pkt->service);
-	pos += yahoo_put32(data + pos, pkt->status);
-	pos += yahoo_put32(data + pos, pkt->id);
+	memcpy(data + pos, "YMSG", 4);
+	pos += 4;
+	pos += yahoo_put16(data + pos, YAHOO_PROTO_VER);	/* version [latest 12 0x000c] */
+	pos += yahoo_put16(data + pos, 0x0000);	/* HIWORD pkt length??? */
+	pos += yahoo_put16(data + pos, pktlen + extra_pad);	/* LOWORD pkt length? */
+	pos += yahoo_put16(data + pos, pkt->service);	/* service */
+	pos += yahoo_put32(data + pos, pkt->status);	/* status [4bytes] */
+	pos += yahoo_put32(data + pos, pkt->id);	/* session [4bytes] */
 
 	yahoo_packet_write(pkt, data + pos);
 
 	yahoo_packet_dump(data, len);
-	
-	if( yid->type == YAHOO_CONNECTION_FT )
+
+	if (yid->type == YAHOO_CONNECTION_FT)
 		yahoo_send_data(yid->fd, data, len);
 	else
@@ -794,8 +800,8 @@
 	do {
 		ret = write(fd, data, len);
-	} while(ret == -1 && errno==EINTR);
-	e=errno;
-
-	if (ret == -1)  {
+	} while (ret == -1 && errno == EINTR);
+	e = errno;
+
+	if (ret == -1) {
 		LOG(("wrote data: ERR %s", strerror(errno)));
 	} else {
@@ -803,13 +809,12 @@
 	}
 
-	errno=e;
+	errno = e;
 	return ret;
 }
 
-void yahoo_close(int id) 
+void yahoo_close(int id)
 {
 	struct yahoo_data *yd = find_conn_by_id(id);
-	
-	if(!yd)
+	if (!yd)
 		return;
 
@@ -817,29 +822,31 @@
 
 	yahoo_free_data(yd);
-	if(id == last_id)
+	if (id == last_id)
 		last_id--;
 }
 
-static void yahoo_input_close(struct yahoo_input_data *yid) 
+static void yahoo_input_close(struct yahoo_input_data *yid)
 {
 	inputs = y_list_remove(inputs, yid);
 
-	LOG(("yahoo_input_close(read)")); 
-	YAHOO_CALLBACK(ext_yahoo_remove_handler)(yid->yd->client_id, yid->read_tag);
-	LOG(("yahoo_input_close(write)")); 
-	YAHOO_CALLBACK(ext_yahoo_remove_handler)(yid->yd->client_id, yid->write_tag);
+	LOG(("yahoo_input_close(read)"));
+	YAHOO_CALLBACK(ext_yahoo_remove_handler) (yid->yd->client_id,
+		yid->read_tag);
+	LOG(("yahoo_input_close(write)"));
+	YAHOO_CALLBACK(ext_yahoo_remove_handler) (yid->yd->client_id,
+		yid->write_tag);
 	yid->read_tag = yid->write_tag = 0;
-	if(yid->fd)
+	if (yid->fd)
 		close(yid->fd);
 	yid->fd = 0;
 	FREE(yid->rxqueue);
-	if(count_inputs_with_id(yid->yd->client_id) == 0) {
+	if (count_inputs_with_id(yid->yd->client_id) == 0) {
 		LOG(("closing %d", yid->yd->client_id));
 		yahoo_close(yid->yd->client_id);
 	}
 	yahoo_free_webcam(yid->wcm);
-	if(yid->wcd)
+	if (yid->wcd)
 		FREE(yid->wcd);
-	if(yid->ys) {
+	if (yid->ys) {
 		FREE(yid->ys->lsearch_text);
 		FREE(yid->ys);
@@ -848,5 +855,6 @@
 }
 
-static int is_same_bud(const void * a, const void * b) {
+static int is_same_bud(const void *a, const void *b)
+{
 	const struct yahoo_buddy *subject = a;
 	const struct yahoo_buddy *object = b;
@@ -855,17 +863,17 @@
 }
 
-static char * getcookie(char *rawcookie)
-{
-	char * cookie=NULL;
-	char * tmpcookie; 
-	char * cookieend;
-
-	if (strlen(rawcookie) < 2) 
+static char *getcookie(char *rawcookie)
+{
+	char *cookie = NULL;
+	char *tmpcookie;
+	char *cookieend;
+
+	if (strlen(rawcookie) < 2)
 		return NULL;
 
-	tmpcookie = strdup(rawcookie+2);
+	tmpcookie = strdup(rawcookie + 2);
 	cookieend = strchr(tmpcookie, ';');
 
-	if(cookieend)
+	if (cookieend)
 		*cookieend = '\0';
 
@@ -877,5 +885,5 @@
 }
 
-static char * getlcookie(char *cookie)
+static char *getlcookie(char *cookie)
 {
 	char *tmp;
@@ -884,9 +892,9 @@
 
 	tmpend = strstr(cookie, "n=");
-	if(tmpend) {
-		tmp = strdup(tmpend+2);
+	if (tmpend) {
+		tmp = strdup(tmpend + 2);
 		tmpend = strchr(tmp, '&');
-		if(tmpend)
-			*tmpend='\0';
+		if (tmpend)
+			*tmpend = '\0';
 		login_cookie = strdup(tmp);
 		FREE(tmp);
@@ -896,5 +904,6 @@
 }
 
-static void yahoo_process_notify(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+static void yahoo_process_notify(struct yahoo_input_data *yid,
+	struct yahoo_packet *pkt)
 {
 	struct yahoo_data *yd = yid->yd;
@@ -927,13 +936,15 @@
 	if (!msg)
 		return;
-	
-	if (!strncasecmp(msg, "TYPING", strlen("TYPING"))) 
-		YAHOO_CALLBACK(ext_yahoo_typing_notify)(yd->client_id, to, from, stat);
-	else if (!strncasecmp(msg, "GAME", strlen("GAME"))) 
-		YAHOO_CALLBACK(ext_yahoo_game_notify)(yd->client_id, to, from, stat);
-	else if (!strncasecmp(msg, "WEBCAMINVITE", strlen("WEBCAMINVITE"))) 
-	{
+
+	if (!strncasecmp(msg, "TYPING", strlen("TYPING")))
+		YAHOO_CALLBACK(ext_yahoo_typing_notify) (yd->client_id, to,
+			from, stat);
+	else if (!strncasecmp(msg, "GAME", strlen("GAME")))
+		YAHOO_CALLBACK(ext_yahoo_game_notify) (yd->client_id, to, from,
+			stat);
+	else if (!strncasecmp(msg, "WEBCAMINVITE", strlen("WEBCAMINVITE"))) {
 		if (!strcmp(ind, " ")) {
-			YAHOO_CALLBACK(ext_yahoo_webcam_invite)(yd->client_id, to, from);
+			YAHOO_CALLBACK(ext_yahoo_webcam_invite) (yd->client_id,
+				to, from);
 		} else {
 			accept = atoi(ind);
@@ -941,8 +952,8 @@
 			if (accept < 0)
 				accept = 0;
-			YAHOO_CALLBACK(ext_yahoo_webcam_invite_reply)(yd->client_id, to, from, accept);
-		}
-	}
-	else
+			YAHOO_CALLBACK(ext_yahoo_webcam_invite_reply) (yd->
+				client_id, to, from, accept);
+		}
+	} else
 		LOG(("Got unknown notification: %s", msg));
 }
@@ -951,14 +962,14 @@
 {
 	struct yahoo_data *yd = yid->yd;
-	char *from=NULL;
-	char *to=NULL;
-	char *msg=NULL;
-	char *url=NULL;
-	long expires=0;
-
-	char *service=NULL;
-
-	char *filename=NULL;
-	unsigned long filesize=0L;
+	char *from = NULL;
+	char *to = NULL;
+	char *msg = NULL;
+	char *url = NULL;
+	long expires = 0;
+
+	char *service = NULL;
+
+	char *filename = NULL;
+	unsigned long filesize = 0L;
 
 	YList *l;
@@ -985,6 +996,6 @@
 	}
 
-	if(pkt->service == YAHOO_SERVICE_P2PFILEXFER) {
-		if(strcmp("FILEXFER", service) != 0) {
+	if (pkt->service == YAHOO_SERVICE_P2PFILEXFER) {
+		if (strcmp("FILEXFER", service) != 0) {
 			WARNING(("unhandled service 0x%02x", pkt->service));
 			yahoo_dump_unhandled(pkt);
@@ -993,12 +1004,12 @@
 	}
 
-	if(msg) {
+	if (msg) {
 		char *tmp;
 		tmp = strchr(msg, '\006');
-		if(tmp)
+		if (tmp)
 			*tmp = '\0';
 	}
-	if(url && from)
-		YAHOO_CALLBACK(ext_yahoo_got_file)(yd->client_id, to, from, url, expires, msg, filename, filesize);
+	if (url && from)
+		YAHOO_CALLBACK(ext_yahoo_got_file) (yd->client_id, to, from, url, expires, msg, filename, filesize);
 
 }
@@ -1012,23 +1023,23 @@
 	char *room = NULL;
 	char *id = NULL;
-	int  utf8 = 0;
+	int utf8 = 0;
 	YList *members = NULL;
 	YList *l;
-	
+
 	for (l = pkt->hash; l; l = l->next) {
 		struct yahoo_pair *pair = l->data;
 		if (pair->key == 50)
 			host = pair->value;
-		
-		if (pair->key == 52) {		/* invite */
+
+		if (pair->key == 52) {	/* invite */
 			members = y_list_append(members, strdup(pair->value));
 		}
-		if (pair->key == 53)		/* logon */
+		if (pair->key == 53)	/* logon */
 			who = pair->value;
-		if (pair->key == 54)		/* decline */
+		if (pair->key == 54)	/* decline */
 			who = pair->value;
-		if (pair->key == 55)		/* unavailable (status == 2) */
+		if (pair->key == 55)	/* unavailable (status == 2) */
 			who = pair->value;
-		if (pair->key == 56)		/* logoff */
+		if (pair->key == 56)	/* logoff */
 			who = pair->value;
 
@@ -1036,17 +1047,16 @@
 			room = pair->value;
 
-		if (pair->key == 58)		/* join message */
+		if (pair->key == 58)	/* join message */
 			msg = pair->value;
-		if (pair->key == 14)		/* decline/conf message */
+		if (pair->key == 14)	/* decline/conf message */
 			msg = pair->value;
 
-		if (pair->key == 13)
-			;
-		if (pair->key == 16)		/* error */
+		if (pair->key == 13) ;
+		if (pair->key == 16)	/* error */
 			msg = pair->value;
 
-		if (pair->key == 1)		/* my id */
+		if (pair->key == 1)	/* my id */
 			id = pair->value;
-		if (pair->key == 3)		/* message sender */
+		if (pair->key == 3)	/* message sender */
 			who = pair->value;
 
@@ -1055,53 +1065,59 @@
 	}
 
-	if(!room)
-		return;
-
-	if(host) {
-		for(l = members; l; l = l->next) {
-			char * w = l->data;
-			if(!strcmp(w, host))
+	if (!room)
+		return;
+
+	if (host) {
+		for (l = members; l; l = l->next) {
+			char *w = l->data;
+			if (!strcmp(w, host))
 				break;
 		}
-		if(!l)
+		if (!l)
 			members = y_list_append(members, strdup(host));
 	}
 	/* invite, decline, join, left, message -> status == 1 */
 
-	switch(pkt->service) {
+	switch (pkt->service) {
 	case YAHOO_SERVICE_CONFINVITE:
-		if(pkt->status == 2)
-			;
-		else if(members)
-			YAHOO_CALLBACK(ext_yahoo_got_conf_invite)(yd->client_id, id, host, room, msg, members);
-		else if(msg)
-			YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, msg, 0, E_CONFNOTAVAIL);
+		if (pkt->status == 2) ;
+		else if (members)
+			YAHOO_CALLBACK(ext_yahoo_got_conf_invite) (yd->
+				client_id, id, host, room, msg, members);
+		else if (msg)
+			YAHOO_CALLBACK(ext_yahoo_error) (yd->client_id, msg, 0,
+				E_CONFNOTAVAIL);
 		break;
 	case YAHOO_SERVICE_CONFADDINVITE:
-		if(pkt->status == 2)
+		if (pkt->status == 2)
 			;
 		else
-			YAHOO_CALLBACK(ext_yahoo_got_conf_invite)(yd->client_id, id, host, room, msg, members);
+			YAHOO_CALLBACK(ext_yahoo_got_conf_invite) (yd->client_id, id, host, room, msg, members);
 		break;
 	case YAHOO_SERVICE_CONFDECLINE:
-		if(who)
-			YAHOO_CALLBACK(ext_yahoo_conf_userdecline)(yd->client_id, id, who, room, msg);
+		if (who)
+			YAHOO_CALLBACK(ext_yahoo_conf_userdecline) (yd->
+				client_id, id, who, room, msg);
 		break;
 	case YAHOO_SERVICE_CONFLOGON:
-		if(who)
-			YAHOO_CALLBACK(ext_yahoo_conf_userjoin)(yd->client_id, id, who, room);
+		if (who)
+			YAHOO_CALLBACK(ext_yahoo_conf_userjoin) (yd->client_id,
+				id, who, room);
 		break;
 	case YAHOO_SERVICE_CONFLOGOFF:
-		if(who)
-			YAHOO_CALLBACK(ext_yahoo_conf_userleave)(yd->client_id, id, who, room);
+		if (who)
+			YAHOO_CALLBACK(ext_yahoo_conf_userleave) (yd->client_id,
+				id, who, room);
 		break;
 	case YAHOO_SERVICE_CONFMSG:
-		if(who)
-			YAHOO_CALLBACK(ext_yahoo_conf_message)(yd->client_id, id, who, room, msg, utf8);
+		if (who)
+			YAHOO_CALLBACK(ext_yahoo_conf_message) (yd->client_id,
+				id, who, room, msg, utf8);
 		break;
 	}
 }
 
-static void yahoo_process_chat(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+static void yahoo_process_chat(struct yahoo_input_data *yid,
+	struct yahoo_packet *pkt)
 {
 	char *msg = NULL;
@@ -1112,9 +1128,9 @@
 	YList *members = NULL;
 	struct yahoo_chat_member *currentmember = NULL;
-	int  msgtype = 1;
-	int  utf8 = 0;
-	int  firstjoin = 0;
-	int  membercount = 0;
-	int  chaterr=0;
+	int msgtype = 1;
+	int utf8 = 0;
+	int firstjoin = 0;
+	int membercount = 0;
+	int chaterr = 0;
 	YList *l;
 	
@@ -1148,5 +1164,6 @@
 
 			if (pkt->service == YAHOO_SERVICE_CHATJOIN) {
-				currentmember = y_new0(struct yahoo_chat_member, 1);
+				currentmember =
+					y_new0(struct yahoo_chat_member, 1);
 				currentmember->id = strdup(pair->value);
 				members = y_list_append(members, currentmember);
@@ -1178,5 +1195,4 @@
 		}
 
-
 		if (pair->key == 130) {
 			/* first join */
@@ -1196,17 +1212,19 @@
 			/* message error not sure what all the pair values mean */
 			/* but -1 means no session in room */
-			chaterr= atoi(pair->value);
-		}
-	}
-
-	if(!room) {
-		if (pkt->service == YAHOO_SERVICE_CHATLOGOUT) { /* yahoo originated chat logout */
-			YAHOO_CALLBACK(ext_yahoo_chat_yahoologout)(yid->yd->client_id, id);
-			return ;
-		}
-		if (pkt->service == YAHOO_SERVICE_COMMENT && chaterr)  {
-			YAHOO_CALLBACK(ext_yahoo_chat_yahooerror)(yid->yd->client_id, id);
+			chaterr = atoi(pair->value);
+		}
+	}
+
+	if (!room) {
+		if (pkt->service == YAHOO_SERVICE_CHATLOGOUT) {	/* yahoo originated chat logout */
+			YAHOO_CALLBACK(ext_yahoo_chat_yahoologout) (yid->yd->
+				client_id, id);
 			return;
 		}
+		if (pkt->service == YAHOO_SERVICE_COMMENT && chaterr) {
+			YAHOO_CALLBACK(ext_yahoo_chat_yahooerror) (yid->yd->
+				client_id, id);
+			return;
+		}
 
 		WARNING(("We didn't get a room name, ignoring packet"));
@@ -1214,33 +1232,37 @@
 	}
 
-	switch(pkt->service) {
+	switch (pkt->service) {
 	case YAHOO_SERVICE_CHATJOIN:
-		if(y_list_length(members) != membercount) {
+		if (y_list_length(members) != membercount) {
 			WARNING(("Count of members doesn't match No. of members we got"));
 		}
-		if(firstjoin && members) {
-			YAHOO_CALLBACK(ext_yahoo_chat_join)(yid->yd->client_id, id, room, topic, members, yid->fd);
-		} else if(who) {
-			if(y_list_length(members) != 1) {
+		if (firstjoin && members) {
+			YAHOO_CALLBACK(ext_yahoo_chat_join) (yid->yd->client_id,
+				id, room, topic, members, yid->fd);
+		} else if (who) {
+			if (y_list_length(members) != 1) {
 				WARNING(("Got more than 1 member on a normal join"));
 			}
 			/* this should only ever have one, but just in case */
-			while(members) {
+			while (members) {
 				YList *n = members->next;
 				currentmember = members->data;
-				YAHOO_CALLBACK(ext_yahoo_chat_userjoin)(yid->yd->client_id, id, room, currentmember);
+				YAHOO_CALLBACK(ext_yahoo_chat_userjoin) (yid->
+					yd->client_id, id, room, currentmember);
 				y_list_free_1(members);
-				members=n;
+				members = n;
 			}
 		}
 		break;
 	case YAHOO_SERVICE_CHATEXIT:
-		if(who) {
-			YAHOO_CALLBACK(ext_yahoo_chat_userleave)(yid->yd->client_id, id, room, who);
+		if (who) {
+			YAHOO_CALLBACK(ext_yahoo_chat_userleave) (yid->yd->
+				client_id, id, room, who);
 		}
 		break;
 	case YAHOO_SERVICE_COMMENT:
-		if(who) {
-			YAHOO_CALLBACK(ext_yahoo_chat_message)(yid->yd->client_id, id, who, room, msg, msgtype, utf8);
+		if (who) {
+			YAHOO_CALLBACK(ext_yahoo_chat_message) (yid->yd->
+				client_id, id, who, room, msg, msgtype, utf8);
 		}
 		break;
@@ -1248,28 +1270,27 @@
 }
 
-static void yahoo_process_message(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+static void yahoo_process_message(struct yahoo_input_data *yid,
+	struct yahoo_packet *pkt)
 {
 	struct yahoo_data *yd = yid->yd;
 	YList *l;
-	YList * messages = NULL;
+	YList *messages = NULL;
 
 	struct m {
-		int  i_31;
-		int  i_32;
+		int i_31;
+		int i_32;
 		char *to;
 		char *from;
 		long tm;
 		char *msg;
-		int  utf8;
+		int utf8;
 	} *message = y_new0(struct m, 1);
 
 	for (l = pkt->hash; l; l = l->next) {
 		struct yahoo_pair *pair = l->data;
-		if (pair->key == 1 || pair->key == 4)
-		{
-			if(!message->from)
+		if (pair->key == 1 || pair->key == 4) {
+			if (!message->from)
 				message->from = pair->value;
-		}
-		else if (pair->key == 5)
+		} else if (pair->key == 5)
 			message->to = pair->value;
 		else if (pair->key == 15)
@@ -1281,27 +1302,25 @@
 			message->msg = pair->value;
 		else if (pair->key == 31) {
-			if(message->i_31) {
+			if (message->i_31) {
 				messages = y_list_append(messages, message);
 				message = y_new0(struct m, 1);
 			}
 			message->i_31 = atoi(pair->value);
-		}
-		else if (pair->key == 32)
+		} else if (pair->key == 32)
 			message->i_32 = atoi(pair->value);
 		else
-			LOG(("yahoo_process_message: status: %d, key: %d, value: %s",
-					pkt->status, pair->key, pair->value));
+			LOG(("yahoo_process_message: status: %d, key: %d, value: %s", pkt->status, pair->key, pair->value));
 	}
 
 	messages = y_list_append(messages, message);
 
-	for (l = messages; l; l=l->next) {
+	for (l = messages; l; l = l->next) {
 		message = l->data;
 		if (pkt->service == YAHOO_SERVICE_SYSMESSAGE) {
-			YAHOO_CALLBACK(ext_yahoo_system_message)(yd->client_id, message->msg);
+			YAHOO_CALLBACK(ext_yahoo_system_message) (yd->client_id, message->msg);
 		} else if (pkt->status <= 2 || pkt->status == 5) {
-			YAHOO_CALLBACK(ext_yahoo_got_im)(yd->client_id, message->to, message->from, message->msg, message->tm, pkt->status, message->utf8);
+			YAHOO_CALLBACK(ext_yahoo_got_im) (yd->client_id, message->to, message->from, message->msg, message->tm, pkt->status, message->utf8);
 		} else if (pkt->status == 0xffffffff) {
-			YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, message->msg, 0, E_SYSTEM);
+			YAHOO_CALLBACK(ext_yahoo_error) (yd->client_id, message->msg, 0, E_SYSTEM);
 		}
 		free(message);
@@ -1327,8 +1346,10 @@
 	}
 
-	/* Status updates may be spread accross multiple packets and not
-	   even on buddy boundaries, so keeping some state is important.
-	   So, continue where we left off, and only add a user entry to
-	   the list once it's complete (301-315 End buddy). */
+	/* 
+	 * Status updates may be spread accross multiple packets and not 
+	 * even on buddy boundaries, so keeping some state is important. 
+	 * So, continue where we left off, and only add a user entry to 
+	 * the list once it's complete (301-315 End buddy).
+	 */
 	u = yd->half_user;
 
@@ -1594,15 +1615,18 @@
 }
 
-static void yahoo_process_verify(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+static void yahoo_process_verify(struct yahoo_input_data *yid,
+	struct yahoo_packet *pkt)
 {
 	struct yahoo_data *yd = yid->yd;
 
-	if(pkt->status != 0x01) {
+	if (pkt->status != 0x01) {
 		DEBUG_MSG(("expected status: 0x01, got: %d", pkt->status));
-		YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_LOCK, "");
-		return;
-	}
-
-	pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, YAHOO_STATUS_AVAILABLE, yd->session_id);
+		YAHOO_CALLBACK(ext_yahoo_login_response) (yd->client_id,
+			YAHOO_LOGIN_LOCK, "");
+		return;
+	}
+
+	pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, YPACKET_STATUS_DEFAULT,
+		yd->session_id);
 
 	yahoo_packet_hash(pkt, 1, yd->user);
@@ -1613,5 +1637,6 @@
 }
 
-static void yahoo_process_picture_checksum( struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+static void yahoo_process_picture_checksum(struct yahoo_input_data *yid,
+	struct yahoo_packet *pkt)
 {
 	struct yahoo_data *yd = yid->yd;
@@ -1621,28 +1646,28 @@
 	YList *l;
 
-	for(l = pkt->hash; l; l = l->next)
-	{
+	for (l = pkt->hash; l; l = l->next) {
 		struct yahoo_pair *pair = l->data;
 
-		switch(pair->key)
-		{
-			case 1:
-			case 4:
-				from = pair->value;
-			case 5:
-				to = pair->value;
-				break;
-			case 212:
-				break;
-			case 192:
-				checksum = atoi( pair->value );
-				break;
-		}
-	}
-
-	YAHOO_CALLBACK(ext_yahoo_got_buddyicon_checksum)(yd->client_id,to,from,checksum);
-}
-
-static void yahoo_process_picture(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+		switch (pair->key) {
+		case 1:
+		case 4:
+			from = pair->value;
+		case 5:
+			to = pair->value;
+			break;
+		case 212:
+			break;
+		case 192:
+			checksum = atoi(pair->value);
+			break;
+		}
+	}
+
+	YAHOO_CALLBACK(ext_yahoo_got_buddyicon_checksum) (yd->client_id, to,
+		from, checksum);
+}
+
+static void yahoo_process_picture(struct yahoo_input_data *yid,
+	struct yahoo_packet *pkt)
 {
 	struct yahoo_data *yd = yid->yd;
@@ -1653,42 +1678,42 @@
 	int checksum = 0;
 	YList *l;
-	
-	for(l = pkt->hash; l; l = l->next)
-	{
+
+	for (l = pkt->hash; l; l = l->next) {
 		struct yahoo_pair *pair = l->data;
 
-		switch(pair->key)
-		{
+		switch (pair->key) {
 		case 1:
-		case 4:		/* sender */
+		case 4:	/* sender */
 			from = pair->value;
 			break;
-		case 5:		/* we */
+		case 5:	/* we */
 			to = pair->value;
 			break;
-		case 13:		/* request / sending */
-			status = atoi( pair->value );
-			break;
-		case 20:		/* url */
+		case 13:	/* request / sending */
+			status = atoi(pair->value);
+			break;
+		case 20:	/* url */
 			url = pair->value;
 			break;
 		case 192:	/*checksum */
-			checksum = atoi( pair->value );
-			break;
-		}
-	}
-
-	switch( status )
-	{
-		case 1:	/* this is a request, ignore for now */
-			YAHOO_CALLBACK(ext_yahoo_got_buddyicon_request)(yd->client_id, to, from);
-			break;
-		case 2:	/* this is cool - we get a picture :) */
-			YAHOO_CALLBACK(ext_yahoo_got_buddyicon)(yd->client_id,to, from, url, checksum);
-			break;
-	}
-}
-
-static void yahoo_process_picture_upload(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+			checksum = atoi(pair->value);
+			break;
+		}
+	}
+
+	switch (status) {
+	case 1:		/* this is a request, ignore for now */
+		YAHOO_CALLBACK(ext_yahoo_got_buddyicon_request) (yd->client_id,
+			to, from);
+		break;
+	case 2:		/* this is cool - we get a picture :) */
+		YAHOO_CALLBACK(ext_yahoo_got_buddyicon) (yd->client_id, to,
+			from, url, checksum);
+		break;
+	}
+}
+
+static void yahoo_process_picture_upload(struct yahoo_input_data *yid,
+	struct yahoo_packet *pkt)
 {
 	struct yahoo_data *yd = yid->yd;
@@ -1699,5 +1724,5 @@
 		return;		/* something went wrong */
 	
-	for(l = pkt->hash; l; l = l->next)
+	for (l = pkt->hash; l; l = l->next)
 	{
 		struct yahoo_pair *pair = l->data;
@@ -1717,5 +1742,5 @@
 	}
 
-	YAHOO_CALLBACK(ext_yahoo_buddyicon_uploaded)(yd->client_id, url);
+	YAHOO_CALLBACK(ext_yahoo_buddyicon_uploaded) (yd->client_id, url);
 }
 
@@ -1873,6 +1898,6 @@
 	const unsigned char *magic_ptr;
 
-	unsigned int  magic[64];
-	unsigned int  magic_work=0;
+	unsigned int magic[64];
+	unsigned int magic_work = 0;
 
 	char comparison_src[20];
@@ -1991,6 +2016,6 @@
 	
 	do { 
-		unsigned int     bl = 0;  
-		unsigned int     cl = magic[magic_cnt++]; 
+		unsigned int bl = 0;  
+		unsigned int cl = magic[magic_cnt++]; 
 		
 		if (magic_cnt >= magic_len) 
@@ -2018,5 +2043,5 @@
 	
 		
-	for(x = 0; x < 4; x++) 
+	for (x = 0; x < 4; x++) 
 		magic_key_char[x] = comparison_src[x];
 
@@ -2024,7 +2049,7 @@
 	memcpy( chal, magic_key_char, 4 );
         x = 1;
-	for( i = 0; i < 0xFFFF && x; i++ )
+	for ( i = 0; i < 0xFFFF && x; i++ )
 	{
-		for( j = 0; j < 5 && x; j++ )
+		for ( j = 0; j < 5 && x; j++ )
 		{
 			chal[4] = i;
@@ -2034,5 +2059,5 @@
 			md5_append( &ctx, chal, 7 );
 			md5_finish( &ctx, result );
-			if( memcmp( comparison_src + 4, result, 16 ) == 0 )
+			if ( memcmp( comparison_src + 4, result, 16 ) == 0 )
 			{
 				depth = i;
@@ -2110,7 +2135,7 @@
 
 	for (x = 0; x < 20; x += 2) {
-		unsigned int    val = 0;
-		unsigned int    lookup = 0;
-		char            byte[6];
+		unsigned int val = 0;
+		unsigned int lookup = 0;
+		char byte[6];
 
 		memset(&byte, 0, 6);
@@ -2353,15 +2378,15 @@
 	
 	if (req->status_code != 200) {
-		YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 2000 + req->status_code, NULL);
+		YAHOO_CALLBACK(ext_yahoo_login_response) (yd->client_id, 2000 + req->status_code, NULL);
 		goto fail;
 	}
 	
 	if (sscanf(req->reply_body, "%d", &st) != 1 || st != 0) {
-		YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, yahoo_https_status_parse(st), NULL);
+		YAHOO_CALLBACK(ext_yahoo_login_response) (yd->client_id, yahoo_https_status_parse(st), NULL);
 		goto fail;
 	}
 	
 	if ((had->token = yahoo_ha_find_key(req->reply_body, "ymsgr")) == NULL) {
-		YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 3001, NULL);
+		YAHOO_CALLBACK(ext_yahoo_login_response) (yd->client_id, 3001, NULL);
 		goto fail;
 	}
@@ -2409,10 +2434,10 @@
 
 	if (req->status_code != 200) {
-		YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 2000 + req->status_code, NULL);
+		YAHOO_CALLBACK(ext_yahoo_login_response) (yd->client_id, 2000 + req->status_code, NULL);
 		goto fail;
 	}
 	
 	if (sscanf(req->reply_body, "%d", &st) != 1 || st != 0) {
-		YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, yahoo_https_status_parse(st), NULL);
+		YAHOO_CALLBACK(ext_yahoo_login_response) (yd->client_id, yahoo_https_status_parse(st), NULL);
 		goto fail;
 	}
@@ -2421,5 +2446,5 @@
 	    (yd->cookie_t = yahoo_ha_find_key(req->reply_body, "T")) == NULL ||
 	    (crumb = yahoo_ha_find_key(req->reply_body, "crumb")) == NULL) {
-		YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 3002, NULL);
+		YAHOO_CALLBACK(ext_yahoo_login_response) (yd->client_id, 3002, NULL);
 		goto fail;
 	}
@@ -2498,6 +2523,6 @@
 	char *login_id;
 	char *handle;
-	char *url=NULL;
-	int  login_status=0;
+	char *url = NULL;
+	int login_status = 0;
 
 	YList *l;
@@ -2515,11 +2540,12 @@
 	}
 
-	if(pkt->status == 0xffffffff) {
-		YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, login_status, url);
+	if (pkt->status == 0xffffffff) {
+		YAHOO_CALLBACK(ext_yahoo_login_response) (yd->client_id, login_status, url);
 	/*	yahoo_logoff(yd->client_id);*/
 	}
 }
 
-static void yahoo_process_mail(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+static void yahoo_process_mail(struct yahoo_input_data *yid,
+	struct yahoo_packet *pkt)
 {
 	struct yahoo_data *yd = yid->yd;
@@ -2547,10 +2573,13 @@
 		char from[1024];
 		snprintf(from, sizeof(from), "%s (%s)", who, email);
-		YAHOO_CALLBACK(ext_yahoo_mail_notify)(yd->client_id, from, subj, count);
-	} else if(count > 0)
-		YAHOO_CALLBACK(ext_yahoo_mail_notify)(yd->client_id, NULL, NULL, count);
-}
-
-static void yahoo_process_contact(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+		YAHOO_CALLBACK(ext_yahoo_mail_notify) (yd->client_id, from,
+			subj, count);
+	} else if (count > 0)
+		YAHOO_CALLBACK(ext_yahoo_mail_notify) (yd->client_id, NULL,
+			NULL, count);
+}
+
+static void yahoo_process_contact(struct yahoo_input_data *yid,
+	struct yahoo_packet *pkt)
 {
 	struct yahoo_data *yd = yid->yd;
@@ -2561,5 +2590,5 @@
 	long tm = 0L;
 	int state = YAHOO_STATUS_AVAILABLE;
-	int online = FALSE;
+	int online = 0;
 	int away = 0;
 	int idle = 0;
@@ -2590,16 +2619,19 @@
 		else if (pair->key == 60)
 			mobile = strtol(pair->value, NULL, 10);
-		
+
 	}
 
 	if (id)
-		YAHOO_CALLBACK(ext_yahoo_contact_added)(yd->client_id, id, who, msg);
+		YAHOO_CALLBACK(ext_yahoo_contact_added) (yd->client_id, id, who,
+			msg);
 	else if (name)
-		YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, name, state, msg, away, idle, mobile);
-	else if(pkt->status == 0x07)
-		YAHOO_CALLBACK(ext_yahoo_rejected)(yd->client_id, who, msg);
-}
-
-static void yahoo_process_buddyadd(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+		YAHOO_CALLBACK(ext_yahoo_status_changed) (yd->client_id, name,
+			state, msg, away, idle, mobile);
+	else if (pkt->status == 0x07)
+		YAHOO_CALLBACK(ext_yahoo_rejected) (yd->client_id, who, msg);
+}
+
+static void yahoo_process_buddyadd(struct yahoo_input_data *yid,
+	struct yahoo_packet *pkt)
 {
 	struct yahoo_data *yd = yid->yd;
@@ -2609,5 +2641,5 @@
 	char *me = NULL;
 
-	struct yahoo_buddy *bud=NULL;
+	struct yahoo_buddy *bud = NULL;
 
 	YList *l;
@@ -2624,13 +2656,11 @@
 	}
 
-	yahoo_dump_unhandled(pkt);
-
-	if(!who)
-		return;
-	if(!where)
+	if (!who)
+		return;
+	if (!where)
 		where = "Unknown";
 
 	/* status: 0 == Successful, 1 == Error (does not exist), 2 == Already in list */
-	if( status == 0 ) {
+	if ( status == 0 ) {
 		bud = y_new0(struct yahoo_buddy, 1);
 		bud->id = strdup(who);
@@ -2642,15 +2672,15 @@
 		/* Possibly called already, but at least the call above doesn't
 		   seem to happen every time (not anytime I tried). */
-		YAHOO_CALLBACK(ext_yahoo_contact_added)(yd->client_id, me, who, NULL);
-	}
-
-/*	YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, who, status, NULL, (status==YAHOO_STATUS_AVAILABLE?0:1)); */
+		YAHOO_CALLBACK(ext_yahoo_contact_added) (yd->client_id, me, who, NULL);
+	}
+
+/*	YAHOO_CALLBACK(ext_yahoo_status_changed) (yd->client_id, who, status, NULL, (status==YAHOO_STATUS_AVAILABLE?0:1)); */
 }
 
 static void yahoo_process_contact_ymsg13(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
 {
-	char* who=NULL;
-	char* me=NULL;	
-	char* msg=NULL;
+	char* who = NULL;
+	char* me = NULL;	
+	char* msg = NULL;
 	YList *l;
 	for (l = pkt->hash; l; l = l->next) {
@@ -2664,9 +2694,10 @@
 	}
 
-	if(pkt->status==3)
-		YAHOO_CALLBACK(ext_yahoo_contact_auth_request)(yid->yd->client_id, me, who, msg);
-}
-
-static void yahoo_process_buddydel(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+	if (pkt->status==3)
+		YAHOO_CALLBACK(ext_yahoo_contact_auth_request) (yid->yd->client_id, me, who, msg);
+}
+
+static void yahoo_process_buddydel(struct yahoo_input_data *yid,
+	struct yahoo_packet *pkt)
 {
 	struct yahoo_data *yd = yid->yd;
@@ -2691,10 +2722,11 @@
 			unk_66 = strtol(pair->value, NULL, 10);
 		else
-			DEBUG_MSG(("unknown key: %d = %s", pair->key, pair->value));
-	}
-
-	if(!who || !where)
-		return;
-	
+			DEBUG_MSG(("unknown key: %d = %s", pair->key,
+					pair->value));
+	}
+
+	if (!who || !where)
+		return;
+
 	bud = y_new0(struct yahoo_buddy, 1);
 	bud->id = strdup(who);
@@ -2707,5 +2739,5 @@
 	FREE(bud);
 
-	if(buddy) {
+	if (buddy) {
 		bud = buddy->data;
 		yd->buddies = y_list_remove_link(yd->buddies, buddy);
@@ -2717,14 +2749,15 @@
 		FREE(bud);
 
-		bud=NULL;
-	}
-}
-
-static void yahoo_process_ignore(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+		bud = NULL;
+	}
+}
+
+static void yahoo_process_ignore(struct yahoo_input_data *yid,
+	struct yahoo_packet *pkt)
 {
 	char *who = NULL;
-	int  status = 0;
+	int status = 0;
 	char *me = NULL;
-	int  un_ignore = 0;
+	int un_ignore = 0;
 
 	YList *l;
@@ -2735,25 +2768,25 @@
 		if (pair->key == 1)
 			me = pair->value;
-		if (pair->key == 13) /* 1 == ignore, 2 == unignore */ 
+		if (pair->key == 13)	/* 1 == ignore, 2 == unignore */
 			un_ignore = strtol(pair->value, NULL, 10);
-		if (pair->key == 66) 
+		if (pair->key == 66)
 			status = strtol(pair->value, NULL, 10);
 	}
-
 
 	/*
 	 * status
-	 * 	0  - ok
-	 * 	2  - already in ignore list, could not add
-	 * 	3  - not in ignore list, could not delete
-	 * 	12 - is a buddy, could not add
+	 *      0  - ok
+	 *      2  - already in ignore list, could not add
+	 *      3  - not in ignore list, could not delete
+	 *      12 - is a buddy, could not add
 	 */
 
 /*	if(status)
-		YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, who, 0, status);
-*/	
-}
-
-static void yahoo_process_voicechat(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+		YAHOO_CALLBACK(ext_yahoo_error) (yd->client_id, who, 0, status);
+*/
+}
+
+static void yahoo_process_voicechat(struct yahoo_input_data *yid,
+	struct yahoo_packet *pkt)
 {
 	char *who = NULL;
@@ -2770,10 +2803,11 @@
 			me = pair->value;
 		if (pair->key == 13)
-			voice_room=pair->value;
-		if (pair->key == 57) 
-			room=pair->value;
-	}
-
-	NOTICE(("got voice chat invite from %s in %s to identity %s", who, room, me));
+			voice_room = pair->value;
+		if (pair->key == 57)
+			room = pair->value;
+	}
+
+	NOTICE(("got voice chat invite from %s in %s to identity %s", who, room,
+			me));
 	/* 
 	 * send: s:0 1:me 5:who 57:room 13:1
@@ -2787,8 +2821,9 @@
 }
 
-static void yahoo_process_ping(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+static void yahoo_process_ping(struct yahoo_input_data *yid,
+	struct yahoo_packet *pkt)
 {
 	char *errormsg = NULL;
-	
+
 	YList *l;
 	for (l = pkt->hash; l; l = l->next) {
@@ -2797,7 +2832,7 @@
 			errormsg = pair->value;
 	}
-	
+
 	NOTICE(("got ping packet"));
-	YAHOO_CALLBACK(ext_yahoo_got_ping)(yid->yd->client_id, errormsg);
+	YAHOO_CALLBACK(ext_yahoo_got_ping) (yid->yd->client_id, errormsg);
 }
 
@@ -2808,10 +2843,10 @@
 	char *data = NULL;
 	char *packet = NULL;
-	unsigned char magic_nr[] = {0, 1, 0};
+	unsigned char magic_nr[] = { 0, 1, 0 };
 	unsigned char header_len = 8;
 	unsigned int len = 0;
 	unsigned int pos = 0;
 
-	if(error || fd <= 0) {
+	if (error || fd <= 0) {
 		FREE(who);
 		FREE(yid);
@@ -2821,5 +2856,5 @@
 	yid->fd = fd;
 	inputs = y_list_prepend(inputs, yid);
-	
+
 	/* send initial packet */
 	if (who)
@@ -2831,6 +2866,5 @@
 
 	/* send data */
-	if (who)
-	{
+	if (who) {
 		data = strdup("g=");
 		data = y_string_append(data, who);
@@ -2851,8 +2885,11 @@
 	FREE(data);
 
-	yid->read_tag=YAHOO_CALLBACK(ext_yahoo_add_handler)(yid->yd->client_id, fd, YAHOO_INPUT_READ, yid);
-}
-
-static void yahoo_webcam_get_server(struct yahoo_input_data *y, char *who, char *key)
+	yid->read_tag =
+		YAHOO_CALLBACK(ext_yahoo_add_handler) (yid->yd->client_id, fd,
+		YAHOO_INPUT_READ, yid);
+}
+
+static void yahoo_webcam_get_server(struct yahoo_input_data *y, char *who,
+	char *key)
 {
 	struct yahoo_input_data *yid = y_new0(struct yahoo_input_data, 1);
@@ -2862,15 +2899,17 @@
 	yid->yd = y->yd;
 	yid->wcm = y_new0(struct yahoo_webcam, 1);
-	yid->wcm->user = who?strdup(who):NULL;
-	yid->wcm->direction = who?YAHOO_WEBCAM_DOWNLOAD:YAHOO_WEBCAM_UPLOAD;
+	yid->wcm->user = who ? strdup(who) : NULL;
+	yid->wcm->direction = who ? YAHOO_WEBCAM_DOWNLOAD : YAHOO_WEBCAM_UPLOAD;
 	yid->wcm->key = strdup(key);
 
-	YAHOO_CALLBACK(ext_yahoo_connect_async)(yid->yd->client_id, yss->webcam_host, yss->webcam_port, 
-			_yahoo_webcam_get_server_connected, yid);
-
-}
-
-static YList *webcam_queue=NULL;
-static void yahoo_process_webcam_key(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+	YAHOO_CALLBACK(ext_yahoo_connect_async) (yid->yd->client_id,
+		yss->webcam_host, yss->webcam_port,
+		_yahoo_webcam_get_server_connected, yid);
+
+}
+
+static YList *webcam_queue = NULL;
+static void yahoo_process_webcam_key(struct yahoo_input_data *yid,
+	struct yahoo_packet *pkt)
 {
 	char *me = NULL;
@@ -2879,15 +2918,15 @@
 
 	YList *l;
-	// yahoo_dump_unhandled(pkt);
+	yahoo_dump_unhandled(pkt);
 	for (l = pkt->hash; l; l = l->next) {
 		struct yahoo_pair *pair = l->data;
 		if (pair->key == 5)
 			me = pair->value;
-		if (pair->key == 61) 
-			key=pair->value;
+		if (pair->key == 61)
+			key = pair->value;
 	}
 
 	l = webcam_queue;
-	if(!l)
+	if (!l)
 		return;
 	who = l->data;
@@ -2898,10 +2937,9 @@
 }
 
-static void yahoo_packet_process(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+static void yahoo_packet_process(struct yahoo_input_data *yid,
+	struct yahoo_packet *pkt)
 {
 	DEBUG_MSG(("yahoo_packet_process: 0x%02x", pkt->service));
-	yahoo_dump_unhandled(pkt);
-	switch (pkt->service)
-	{
+	switch (pkt->service) {
 	case YAHOO_SERVICE_USERSTAT:
 	case YAHOO_SERVICE_LOGON:
@@ -3022,5 +3060,5 @@
 }
 
-static struct yahoo_packet * yahoo_getdata(struct yahoo_input_data * yid)
+static struct yahoo_packet *yahoo_getdata(struct yahoo_input_data *yid)
 {
 	struct yahoo_packet *pkt;
@@ -3029,5 +3067,5 @@
 	int pktlen;
 
-	if(!yd)
+	if (!yd)
 		return NULL;
 
@@ -3038,11 +3076,11 @@
 	}
 
-	pos += 4; /* YMSG */
+	pos += 4;		/* YMSG */
 	pos += 2;
 	pos += 2;
 
-	pktlen = yahoo_get16(yid->rxqueue + pos); pos += 2;
-	DEBUG_MSG(("%d bytes to read, rxlen is %d", 
-			pktlen, yid->rxlen));
+	pktlen = yahoo_get16(yid->rxqueue + pos);
+	pos += 2;
+	DEBUG_MSG(("%d bytes to read, rxlen is %d", pktlen, yid->rxlen));
 
 	if (yid->rxlen < (YAHOO_PACKET_HDRLEN + pktlen)) {
@@ -3056,9 +3094,12 @@
 	pkt = yahoo_packet_new(0, 0, 0);
 
-	pkt->service = yahoo_get16(yid->rxqueue + pos); pos += 2;
-	pkt->status = yahoo_get32(yid->rxqueue + pos); pos += 4;
+	pkt->service = yahoo_get16(yid->rxqueue + pos);
+	pos += 2;
+	pkt->status = yahoo_get32(yid->rxqueue + pos);
+	pos += 4;
 	DEBUG_MSG(("Yahoo Service: 0x%02x Status: %d", pkt->service,
-				pkt->status));
-	pkt->id = yahoo_get32(yid->rxqueue + pos); pos += 4;
+			pkt->status));
+	pkt->id = yahoo_get32(yid->rxqueue + pos);
+	pos += 4;
 
 	yd->session_id = pkt->id;
@@ -3068,10 +3109,11 @@
 	yid->rxlen -= YAHOO_PACKET_HDRLEN + pktlen;
 	DEBUG_MSG(("rxlen == %d, rxqueue == %p", yid->rxlen, yid->rxqueue));
-	if (yid->rxlen>0) {
-		unsigned char *tmp = y_memdup(yid->rxqueue + YAHOO_PACKET_HDRLEN 
-				+ pktlen, yid->rxlen);
+	if (yid->rxlen > 0) {
+		unsigned char *tmp = y_memdup(yid->rxqueue + YAHOO_PACKET_HDRLEN
+			+ pktlen, yid->rxlen);
 		FREE(yid->rxqueue);
 		yid->rxqueue = tmp;
-		DEBUG_MSG(("new rxlen == %d, rxqueue == %p", yid->rxlen, yid->rxqueue));
+		DEBUG_MSG(("new rxlen == %d, rxqueue == %p", yid->rxlen,
+				yid->rxqueue));
 	} else {
 		DEBUG_MSG(("freed rxqueue == %p", yid->rxqueue));
@@ -3082,116 +3124,194 @@
 }
 
-static void yahoo_yab_read(struct yab *yab, unsigned char *d, int len)
+static struct yab *yahoo_yab_read(unsigned char *d, int len)
 {
 	char *st, *en;
 	char *data = (char *)d;
-	data[len]='\0';
+	struct yab *yab = NULL;
+
+	data[len] = '\0';
 
 	DEBUG_MSG(("Got yab: %s", data));
-	st = en = strstr(data, "userid=\"");
-	if(st) {
-		st += strlen("userid=\"");
-		en = strchr(st, '"'); *en++ = '\0';
+	st = en = strstr(data, "e0=\"");
+	if (st) {
+		yab = y_new0(struct yab, 1);
+
+		st += strlen("e0=\"");
+		en = strchr(st, '"');
+		*en++ = '\0';
+		yab->email = yahoo_xmldecode(st);
+	}
+
+	if (!en)
+		return NULL;
+
+	st = strstr(en, "id=\"");
+	if (st) {
+		st += strlen("id=\"");
+		en = strchr(st, '"');
+		*en++ = '\0';
+		yab->yid = atoi(yahoo_xmldecode(st));
+	}
+
+	st = strstr(en, "fn=\"");
+	if (st) {
+		st += strlen("fn=\"");
+		en = strchr(st, '"');
+		*en++ = '\0';
+		yab->fname = yahoo_xmldecode(st);
+	}
+
+	st = strstr(en, "ln=\"");
+	if (st) {
+		st += strlen("ln=\"");
+		en = strchr(st, '"');
+		*en++ = '\0';
+		yab->lname = yahoo_xmldecode(st);
+	}
+
+	st = strstr(en, "nn=\"");
+	if (st) {
+		st += strlen("nn=\"");
+		en = strchr(st, '"');
+		*en++ = '\0';
+		yab->nname = yahoo_xmldecode(st);
+	}
+
+	st = strstr(en, "yi=\"");
+	if (st) {
+		st += strlen("yi=\"");
+		en = strchr(st, '"');
+		*en++ = '\0';
 		yab->id = yahoo_xmldecode(st);
 	}
 
-	st = strstr(en, "fname=\"");
-	if(st) {
-		st += strlen("fname=\"");
-		en = strchr(st, '"'); *en++ = '\0';
-		yab->fname = yahoo_xmldecode(st);
-	}
-
-	st = strstr(en, "lname=\"");
-	if(st) {
-		st += strlen("lname=\"");
-		en = strchr(st, '"'); *en++ = '\0';
-		yab->lname = yahoo_xmldecode(st);
-	}
-
-	st = strstr(en, "nname=\"");
-	if(st) {
-		st += strlen("nname=\"");
-		en = strchr(st, '"'); *en++ = '\0';
-		yab->nname = yahoo_xmldecode(st);
-	}
-
-	st = strstr(en, "email=\"");
-	if(st) {
-		st += strlen("email=\"");
-		en = strchr(st, '"'); *en++ = '\0';
-		yab->email = yahoo_xmldecode(st);
-	}
-
 	st = strstr(en, "hphone=\"");
-	if(st) {
+	if (st) {
 		st += strlen("hphone=\"");
-		en = strchr(st, '"'); *en++ = '\0';
+		en = strchr(st, '"');
+		*en++ = '\0';
 		yab->hphone = yahoo_xmldecode(st);
 	}
 
 	st = strstr(en, "wphone=\"");
-	if(st) {
+	if (st) {
 		st += strlen("wphone=\"");
-		en = strchr(st, '"'); *en++ = '\0';
+		en = strchr(st, '"');
+		*en++ = '\0';
 		yab->wphone = yahoo_xmldecode(st);
 	}
 
 	st = strstr(en, "mphone=\"");
-	if(st) {
+	if (st) {
 		st += strlen("mphone=\"");
-		en = strchr(st, '"'); *en++ = '\0';
+		en = strchr(st, '"');
+		*en++ = '\0';
 		yab->mphone = yahoo_xmldecode(st);
 	}
 
 	st = strstr(en, "dbid=\"");
-	if(st) {
+	if (st) {
 		st += strlen("dbid=\"");
-		en = strchr(st, '"'); *en++ = '\0';
+		en = strchr(st, '"');
+		*en++ = '\0';
 		yab->dbid = atoi(st);
 	}
-}
-
-static struct yab * yahoo_getyab(struct yahoo_input_data *yid)
+
+	return yab;
+}
+
+static struct yab *yahoo_getyab(struct yahoo_input_data *yid)
 {
 	struct yab *yab = NULL;
-	int pos = 0, end=0;
+	int pos = 0, end = 0;
 	struct yahoo_data *yd = yid->yd;
 
-	if(!yd)
+	if (!yd)
 		return NULL;
 
+	do {
+		DEBUG_MSG(("rxlen is %d", yid->rxlen));
+
+		if (yid->rxlen <= strlen("<ct"))
+			return NULL;
+
+		/* start with <ct */
+		while (pos < yid->rxlen - strlen("<ct") + 1
+			&& memcmp(yid->rxqueue + pos, "<ct", strlen("<ct")))
+			pos++;
+
+		if (pos >= yid->rxlen - 1)
+			return NULL;
+
+		end = pos + 2;
+		/* end with > */
+		while (end < yid->rxlen - strlen(">")
+			&& memcmp(yid->rxqueue + end, ">", strlen(">")))
+			end++;
+
+		if (end >= yid->rxlen - 1)
+			return NULL;
+
+		yab = yahoo_yab_read(yid->rxqueue + pos, end + 2 - pos);
+
+		yid->rxlen -= end + 1;
+		DEBUG_MSG(("rxlen == %d, rxqueue == %p", yid->rxlen,
+				yid->rxqueue));
+		if (yid->rxlen > 0) {
+			unsigned char *tmp =
+				y_memdup(yid->rxqueue + end + 1, yid->rxlen);
+			FREE(yid->rxqueue);
+			yid->rxqueue = tmp;
+			DEBUG_MSG(("new rxlen == %d, rxqueue == %p", yid->rxlen,
+					yid->rxqueue));
+		} else {
+			DEBUG_MSG(("freed rxqueue == %p", yid->rxqueue));
+			FREE(yid->rxqueue);
+		}
+
+	} while (!yab && end < yid->rxlen - 1);
+
+	return yab;
+}
+
+static char *yahoo_getwebcam_master(struct yahoo_input_data *yid)
+{
+	unsigned int pos = 0;
+	unsigned int len = 0;
+	unsigned int status = 0;
+	char *server = NULL;
+	struct yahoo_data *yd = yid->yd;
+
+	if (!yid || !yd)
+		return NULL;
+
 	DEBUG_MSG(("rxlen is %d", yid->rxlen));
 
-	if(yid->rxlen <= strlen("<record"))
+	len = yid->rxqueue[pos++];
+	if (yid->rxlen < len)
 		return NULL;
 
-	/* start with <record */
-	while(pos < yid->rxlen-strlen("<record")+1 
-			&& memcmp(yid->rxqueue + pos, "<record", strlen("<record")))
-		pos++;
-
-	if(pos >= yid->rxlen-1)
-		return NULL;
-
-	end = pos+2;
-	/* end with /> */
-	while(end < yid->rxlen-strlen("/>")+1 && memcmp(yid->rxqueue + end, "/>", strlen("/>")))
-		end++;
-
-	if(end >= yid->rxlen-1)
-		return NULL;
-
-	yab = y_new0(struct yab, 1);
-	yahoo_yab_read(yab, yid->rxqueue + pos, end+2-pos);
-	
-
-	yid->rxlen -= end+1;
+	/* extract status (0 = ok, 6 = webcam not online) */
+	status = yid->rxqueue[pos++];
+
+	if (status == 0) {
+		pos += 2;	/* skip next 2 bytes */
+		server = y_memdup(yid->rxqueue + pos, 16);
+		pos += 16;
+	} else if (status == 6) {
+		YAHOO_CALLBACK(ext_yahoo_webcam_closed)
+			(yd->client_id, yid->wcm->user, 4);
+	}
+
+	/* skip rest of the data */
+
+	yid->rxlen -= len;
 	DEBUG_MSG(("rxlen == %d, rxqueue == %p", yid->rxlen, yid->rxqueue));
-	if (yid->rxlen>0) {
-		unsigned char *tmp = y_memdup(yid->rxqueue + end + 1, yid->rxlen);
+	if (yid->rxlen > 0) {
+		unsigned char *tmp = y_memdup(yid->rxqueue + pos, yid->rxlen);
 		FREE(yid->rxqueue);
 		yid->rxqueue = tmp;
-		DEBUG_MSG(("new rxlen == %d, rxqueue == %p", yid->rxlen, yid->rxqueue));
+		DEBUG_MSG(("new rxlen == %d, rxqueue == %p", yid->rxlen,
+				yid->rxqueue));
 	} else {
 		DEBUG_MSG(("freed rxqueue == %p", yid->rxqueue));
@@ -3199,88 +3319,36 @@
 	}
 
-
-	return yab;
-}
-
-static char * yahoo_getwebcam_master(struct yahoo_input_data *yid)
-{
-	unsigned int pos=0;
-	unsigned int len=0;
-	unsigned int status=0;
-	char *server=NULL;
+	return server;
+}
+
+static int yahoo_get_webcam_data(struct yahoo_input_data *yid)
+{
+	unsigned char reason = 0;
+	unsigned int pos = 0;
+	unsigned int begin = 0;
+	unsigned int end = 0;
+	unsigned int closed = 0;
+	unsigned char header_len = 0;
+	char *who;
+	int connect = 0;
 	struct yahoo_data *yd = yid->yd;
 
-	if(!yid || !yd)
-		return NULL;
+	if (!yd)
+		return -1;
+
+	if (!yid->wcm || !yid->wcd || !yid->rxlen)
+		return -1;
 
 	DEBUG_MSG(("rxlen is %d", yid->rxlen));
 
-	len = yid->rxqueue[pos++];
-	if (yid->rxlen < len)
-		return NULL;
-
-	/* extract status (0 = ok, 6 = webcam not online) */
-	status = yid->rxqueue[pos++];
-
-	if (status == 0)
-	{
-		pos += 2; /* skip next 2 bytes */
-		server =  y_memdup(yid->rxqueue+pos, 16);
-		pos += 16;
-	}
-	else if (status == 6)
-	{
-		YAHOO_CALLBACK(ext_yahoo_webcam_closed)
-			(yd->client_id, yid->wcm->user, 4);
-	}
-
-	/* skip rest of the data */
-
-	yid->rxlen -= len;
-	DEBUG_MSG(("rxlen == %d, rxqueue == %p", yid->rxlen, yid->rxqueue));
-	if (yid->rxlen>0) {
-		unsigned char *tmp = y_memdup(yid->rxqueue + pos, yid->rxlen);
-		FREE(yid->rxqueue);
-		yid->rxqueue = tmp;
-		DEBUG_MSG(("new rxlen == %d, rxqueue == %p", yid->rxlen, yid->rxqueue));
-	} else {
-		DEBUG_MSG(("freed rxqueue == %p", yid->rxqueue));
-		FREE(yid->rxqueue);
-	}
-
-	return server;
-}
-
-static int yahoo_get_webcam_data(struct yahoo_input_data *yid)
-{
-	unsigned char reason=0;
-	unsigned int pos=0;
-	unsigned int begin=0;
-	unsigned int end=0;
-	unsigned int closed=0;
-	unsigned char header_len=0;
-	char *who;
-	int connect=0;
-	struct yahoo_data *yd = yid->yd;
-
-	if(!yd)
-		return -1;
-
-	if(!yid->wcm || !yid->wcd || !yid->rxlen)
-		return -1;
-
-	DEBUG_MSG(("rxlen is %d", yid->rxlen));
-
 	/* if we are not reading part of image then read header */
-	if (!yid->wcd->to_read)
-	{
-		header_len=yid->rxqueue[pos++];
-		yid->wcd->packet_type=0;
+	if (!yid->wcd->to_read) {
+		header_len = yid->rxqueue[pos++];
+		yid->wcd->packet_type = 0;
 
 		if (yid->rxlen < header_len)
 			return 0;
 
-		if (header_len >= 8)
-		{
+		if (header_len >= 8) {
 			reason = yid->rxqueue[pos++];
 			/* next 2 bytes should always be 05 00 */
@@ -3290,6 +3358,5 @@
 			yid->wcd->to_read = yid->wcd->data_size;
 		}
-		if (header_len >= 13)
-		{
+		if (header_len >= 13) {
 			yid->wcd->packet_type = yid->rxqueue[pos++];
 			yid->wcd->timestamp = yahoo_get32(yid->rxqueue + pos);
@@ -3303,5 +3370,6 @@
 	begin = pos;
 	pos += yid->wcd->to_read;
-	if (pos > yid->rxlen) pos = yid->rxlen;
+	if (pos > yid->rxlen)
+		pos = yid->rxlen;
 
 	/* if it is not an image then make sure we have the whole packet */
@@ -3316,5 +3384,5 @@
 
 	DEBUG_MSG(("packet type %.2X, data length %d", yid->wcd->packet_type,
-		yid->wcd->data_size));
+			yid->wcd->data_size));
 
 	/* find out what kind of packet we got */
@@ -3332,5 +3400,5 @@
 					who = y_memdup(yid->rxqueue + begin, end - begin);
 					who[end - begin - 1] = 0;
-					YAHOO_CALLBACK(ext_yahoo_webcam_viewer)(yd->client_id, who + 2, 2);
+					YAHOO_CALLBACK(ext_yahoo_webcam_viewer) (yd->client_id, who + 2, 2);
 					FREE(who);
 				}
@@ -3342,5 +3410,5 @@
 				/* 1 = accepted viewing permission */
 				if (yid->wcd->timestamp == 0) {
-					YAHOO_CALLBACK(ext_yahoo_webcam_closed)(yd->client_id, yid->wcm->user, 3);
+					YAHOO_CALLBACK(ext_yahoo_webcam_closed) (yd->client_id, yid->wcm->user, 3);
 				}
 			}
@@ -3351,5 +3419,5 @@
 			break;
 		case 0x02: /* image data */
-			YAHOO_CALLBACK(ext_yahoo_got_webcam_image)(yd->client_id, 
+			YAHOO_CALLBACK(ext_yahoo_got_webcam_image) (yd->client_id, 
 					yid->wcm->user, yid->rxqueue + begin,
 					yid->wcd->data_size, pos - begin,
@@ -3358,5 +3426,5 @@
 		case 0x05: /* response packets when uploading */
 			if (!yid->wcd->data_size) {
-				YAHOO_CALLBACK(ext_yahoo_webcam_data_request)(yd->client_id, yid->wcd->timestamp);
+				YAHOO_CALLBACK(ext_yahoo_webcam_data_request) (yd->client_id, yid->wcd->timestamp);
 			}
 			break;
@@ -3371,5 +3439,5 @@
 					break;
 			}
-			YAHOO_CALLBACK(ext_yahoo_webcam_closed)(yd->client_id, yid->wcm->user, closed);
+			YAHOO_CALLBACK(ext_yahoo_webcam_closed) (yd->client_id, yid->wcm->user, closed);
 			break;
 		case 0x0C: /* user connected */
@@ -3379,14 +3447,14 @@
 				who[pos - begin] = 0;
 				if (yid->wcd->packet_type == 0x0C)
-					connect=1;
+					connect = 1;
 				else
-					connect=0;
-				YAHOO_CALLBACK(ext_yahoo_webcam_viewer)(yd->client_id, who, connect);
+					connect = 0;
+				YAHOO_CALLBACK(ext_yahoo_webcam_viewer) (yd->client_id, who, connect);
 				FREE(who);
 			}
 			break;
 		case 0x13: /* user data */
-			/* i=user_ip (ip of the user we are viewing) */
-			/* j=user_ext_ip (external ip of the user we */
+			/* i = user_ip (ip of the user we are viewing) */
+			/* j = user_ext_ip (external ip of the user we */
  			/*                are viewing) */
 			break;
@@ -3422,5 +3490,5 @@
 
 	LOG(("write callback: id=%d fd=%d data=%p", id, fd, data));
-	if(!yid || !yid->txqueues || !find_conn_by_id(id))
+	if (!yid || !yid->txqueues || !find_conn_by_id(id))
 		return -2;
 	
@@ -3429,12 +3497,12 @@
 	len = yahoo_send_data(fd, tx->queue, MIN(1024, tx->len));
 
-	if(len == -1 && errno == EAGAIN)
+	if (len == -1 && errno == EAGAIN)
 		return 1;
 
-	if(len <= 0) {
+	if (len <= 0) {
 		int e = errno;
 		DEBUG_MSG(("len == %d (<= 0)", len));
-		while(yid->txqueues) {
-			YList *l=yid->txqueues;
+		while (yid->txqueues) {
+			YList *l = yid->txqueues;
 			tx = l->data;
 			free(tx->queue);
@@ -3444,7 +3512,7 @@
 		}
 		LOG(("yahoo_write_ready(%d, %d) len < 0", id, fd));
-		YAHOO_CALLBACK(ext_yahoo_remove_handler)(id, yid->write_tag);
+		YAHOO_CALLBACK(ext_yahoo_remove_handler) (id, yid->write_tag);
 		yid->write_tag = 0;
-		errno=e;
+		errno = e;
 		return 0;
 	}
@@ -3452,10 +3520,10 @@
 
 	tx->len -= len;
-	if(tx->len > 0) {
+	if (tx->len > 0) {
 		unsigned char *tmp = y_memdup(tx->queue + len, tx->len);
 		FREE(tx->queue);
 		tx->queue = tmp;
 	} else {
-		YList *l=yid->txqueues;
+		YList *l = yid->txqueues;
 		free(tx->queue);
 		free(tx);
@@ -3463,10 +3531,10 @@
 		y_list_free_1(l);
 		/*
-		if(!yid->txqueues) 
+		if (!yid->txqueues) 
 			LOG(("yahoo_write_ready(%d, %d) !yxqueues", id, fd));
 		*/
-		if(!yid->txqueues) {
+		if (!yid->txqueues) {
 			LOG(("yahoo_write_ready(%d, %d) !yxqueues", id, fd));
-			YAHOO_CALLBACK(ext_yahoo_remove_handler)(id, yid->write_tag);
+			YAHOO_CALLBACK(ext_yahoo_remove_handler) (id, yid->write_tag);
 			yid->write_tag = 0;
 		}
@@ -3482,5 +3550,5 @@
 	int id = yd->client_id;
 
-	if(over)
+	if (over)
 		return;
 
@@ -3500,9 +3568,9 @@
 static void yahoo_process_chatcat_connection(struct yahoo_input_data *yid, int over)
 {
-	if(over)
+	if (over)
 		return;
 
 	if (strstr((char*)yid->rxqueue+(yid->rxlen-20), "</content>")) {
-		YAHOO_CALLBACK(ext_yahoo_chat_cat_xml)(yid->yd->client_id, (char*)yid->rxqueue);
+		YAHOO_CALLBACK(ext_yahoo_chat_cat_xml) (yid->yd->client_id, (char*)yid->rxqueue);
 	}
 }
@@ -3513,22 +3581,22 @@
 	struct yab *yab;
 	YList *buds;
-	int changed=0;
+	int changed = 0;
 	int id = yd->client_id;
 
-	if(over)
-		return;
-
-	while(find_input_by_id_and_type(id, YAHOO_CONNECTION_YAB) 
+	if (over)
+		return;
+
+	while (find_input_by_id_and_type(id, YAHOO_CONNECTION_YAB) 
 			&& (yab = yahoo_getyab(yid)) != NULL) {
-		if(!yab->id)
+		if (!yab->id)
 			continue;
-		changed=1;
-		for(buds = yd->buddies; buds; buds=buds->next) {
-			struct yahoo_buddy * bud = buds->data;
-			if(!strcmp(bud->id, yab->id)) {
+		changed = 1;
+		for (buds = yd->buddies; buds; buds = buds->next) {
+			struct yahoo_buddy *bud = buds->data;
+			if (!strcmp(bud->id, yab->id)) {
 				bud->yab_entry = yab;
-				if(yab->nname) {
+				if (yab->nname) {
 					bud->real_name = strdup(yab->nname);
-				} else if(yab->fname && yab->lname) {
+				} else if (yab->fname && yab->lname) {
 					bud->real_name = y_new0(char, 
 							strlen(yab->fname)+
@@ -3537,5 +3605,5 @@
 					sprintf(bud->real_name, "%s %s",
 							yab->fname, yab->lname);
-				} else if(yab->fname) {
+				} else if (yab->fname) {
 					bud->real_name = strdup(yab->fname);
 				}
@@ -3545,24 +3613,24 @@
 	}
 
-	if(changed)
-		YAHOO_CALLBACK(ext_yahoo_got_buddies)(yd->client_id, yd->buddies);
+	if (changed)
+		YAHOO_CALLBACK(ext_yahoo_got_buddies) (yd->client_id, yd->buddies);
 }
 
 static void yahoo_process_search_connection(struct yahoo_input_data *yid, int over)
 {
-	struct yahoo_found_contact *yct=NULL;
+	struct yahoo_found_contact *yct = NULL;
 	char *p = (char *)yid->rxqueue, *np, *cp;
 	int k, n;
-	int start=0, found=0, total=0;
-	YList *contacts=NULL;
+	int start = 0, found=0, total=0;
+	YList *contacts = NULL;
 	struct yahoo_input_data *pyid = find_input_by_id_and_type(yid->yd->client_id, YAHOO_CONNECTION_PAGER);
 
-	if(!over || !pyid)
-		return;
-
-	if(p && (p=strstr(p, "\r\n\r\n"))) {
+	if (!over || !pyid)
+		return;
+
+	if (p && (p = strstr(p, "\r\n\r\n"))) {
 		p += 4;
 
-		for(k = 0; (p = strchr(p, 4)) && (k < 4); k++) {
+		for (k = 0; (p = strchr(p, 4)) && (k < 4); k++) {
 			p++;
 			n = atoi(p);
@@ -3574,13 +3642,13 @@
 		}
 
-		if(p)
+		if (p)
 			p++;
 
-		k=0;
-		while(p && *p) {
+		k = 0;
+		while (p && *p) {
 			cp = p;
 			np = strchr(p, 4);
 
-			if(!np)
+			if (!np)
 				break;
 			*np = 0;
@@ -3589,5 +3657,5 @@
 			switch(k++) {
 				case 1:
-					if(strlen(cp) > 2 && y_list_length(contacts) < total) {
+					if (strlen(cp) > 2 && y_list_length(contacts) < total) {
 						yct = y_new0(struct yahoo_found_contact, 1);
 						contacts = y_list_append(contacts, yct);
@@ -3607,5 +3675,5 @@
 					break;
 				case 5: 
-					if(strcmp(cp, "5") != 0)
+					if (strcmp(cp, "5") != 0)
 						yct->location = cp;
 					k = 0;
@@ -3615,7 +3683,7 @@
 	}
 
-	YAHOO_CALLBACK(ext_yahoo_got_search_result)(yid->yd->client_id, found, start, total, contacts);
-
-	while(contacts) {
+	YAHOO_CALLBACK(ext_yahoo_got_search_result) (yid->yd->client_id, found, start, total, contacts);
+
+	while (contacts) {
 		YList *node = contacts;
 		contacts = y_list_remove_link(contacts, node);
@@ -3631,12 +3699,12 @@
 	struct yahoo_data *yd = yid->yd;
 	char conn_type[100];
-	char *data=NULL;
-	char *packet=NULL;
+	char *data = NULL;
+	char *packet = NULL;
 	unsigned char magic_nr[] = {1, 0, 0, 0, 1};
-	unsigned header_len=0;
-	unsigned int len=0;
-	unsigned int pos=0;
-
-	if(error || fd <= 0) {
+	unsigned header_len = 0;
+	unsigned int len = 0;
+	unsigned int pos = 0;
+
+	if (error || fd <= 0) {
 		FREE(yid);
 		return;
@@ -3724,5 +3792,5 @@
 	FREE(data);
 
-	yid->read_tag=YAHOO_CALLBACK(ext_yahoo_add_handler)(yid->yd->client_id, yid->fd, YAHOO_INPUT_READ, yid);
+	yid->read_tag = YAHOO_CALLBACK(ext_yahoo_add_handler) (yid->yd->client_id, yid->fd, YAHOO_INPUT_READ, yid);
 }
 
@@ -3749,5 +3817,5 @@
 
 	LOG(("Connecting to: %s:%d", wcm->server, wcm->port));
-	YAHOO_CALLBACK(ext_yahoo_connect_async)(y->yd->client_id, wcm->server, wcm->port,
+	YAHOO_CALLBACK(ext_yahoo_connect_async) (y->yd->client_id, wcm->server, wcm->port,
 			_yahoo_webcam_connected, yid);
 
@@ -3759,5 +3827,5 @@
 	struct yahoo_server_settings *yss;
 
-	if(over)
+	if (over)
 		return;
 
@@ -3783,5 +3851,5 @@
 	int fd = yid->fd;
 
-	if(over)
+	if (over)
 		return;
 
@@ -3808,5 +3876,5 @@
 
 	LOG(("read callback: id=%d fd=%d data=%p", id, fd, data));
-	if(!yid)
+	if (!yid)
 		return -2;
 
@@ -3814,7 +3882,7 @@
 	do {
 		len = read(fd, buf, sizeof(buf));
-	} while(len == -1 && errno == EINTR);
-
-	if(len == -1 && (errno == EAGAIN||errno == EINTR))	/* we'll try again later */
+	} while (len == -1 && errno == EINTR);
+
+	if (len == -1 && (errno == EAGAIN||errno == EINTR))	/* we'll try again later */
 		return 1;
 
@@ -3823,6 +3891,6 @@
 		DEBUG_MSG(("len == %d (<= 0)", len));
 
-		if(yid->type == YAHOO_CONNECTION_PAGER) {
-			YAHOO_CALLBACK(ext_yahoo_error)(yid->yd->client_id, "Connection closed by server", 1, E_CONNECTION);
+		if (yid->type == YAHOO_CONNECTION_PAGER) {
+			YAHOO_CALLBACK(ext_yahoo_error) (yid->yd->client_id, "Connection closed by server", 1, E_CONNECTION);
 		}
 
@@ -3831,8 +3899,8 @@
 
 		/* no need to return an error, because we've already fixed it */
-		if(len == 0)
+		if (len == 0)
 			return 1;
 
-		errno=e;
+		errno = e;
 		LOG(("read error: %s", strerror(errno)));
 		return -1;
@@ -3855,5 +3923,5 @@
 	yd = y_new0(struct yahoo_data, 1);
 
-	if(!yd)
+	if (!yd)
 		return 0;
 
@@ -3894,16 +3962,16 @@
 	struct yahoo_server_settings *yss = yd->server_settings;
 
-	if(error) {
-		if(fallback_ports[ccd->i]) {
+	if (error) {
+		if (fallback_ports[ccd->i]) {
 			int tag;
 			yss->pager_port = fallback_ports[ccd->i++];
-			tag = YAHOO_CALLBACK(ext_yahoo_connect_async)(yd->client_id, yss->pager_host,
+			tag = YAHOO_CALLBACK(ext_yahoo_connect_async) (yd->client_id, yss->pager_host,
 					yss->pager_port, yahoo_connected, ccd);
 
-			if(tag > 0)
-				ccd->tag=tag;
+			if (tag > 0)
+				ccd->tag = tag;
 		} else {
 			FREE(ccd);
-			YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_SOCK, NULL);
+			YAHOO_CALLBACK(ext_yahoo_login_response) (yd->client_id, YAHOO_LOGIN_SOCK, NULL);
 		}
 		return;
@@ -3913,5 +3981,5 @@
 
 	/* fd < 0 && error == 0 means connect was cancelled */
-	if(fd < 0)
+	if (fd < 0)
 		return;
 
@@ -3930,5 +3998,5 @@
 	yahoo_packet_free(pkt);
 
-	yid->read_tag=YAHOO_CALLBACK(ext_yahoo_add_handler)(yid->yd->client_id, yid->fd, YAHOO_INPUT_READ, yid);
+	yid->read_tag = YAHOO_CALLBACK(ext_yahoo_add_handler) (yid->yd->client_id, yid->fd, YAHOO_INPUT_READ, yid);
 }
 
@@ -3940,5 +4008,5 @@
 	int tag;
 
-	if(!yd)
+	if (!yd)
 		return;
 
@@ -3949,5 +4017,5 @@
 	ccd = y_new0(struct connect_callback_data, 1);
 	ccd->yd = yd;
-	tag = YAHOO_CALLBACK(ext_yahoo_connect_async)(yd->client_id, yss->pager_host, yss->pager_port, 
+	tag = YAHOO_CALLBACK(ext_yahoo_connect_async) (yd->client_id, yss->pager_host, yss->pager_port, 
 			yahoo_connected, ccd);
 
@@ -3956,8 +4024,8 @@
 	 * so ccd will have been freed
 	 */
-	if(tag > 0)
+	if (tag > 0)
 		ccd->tag = tag;
-	else if(tag < 0)
-		YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_SOCK, NULL);
+	else if (tag < 0)
+		YAHOO_CALLBACK(ext_yahoo_login_response) (yd->client_id, YAHOO_LOGIN_SOCK, NULL);
 }
 
@@ -3966,5 +4034,5 @@
 {
 	struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
-	if(!yid)
+	if (!yid)
 		return 0;
 	else
@@ -3979,5 +4047,5 @@
 	char pic_str[10];
 
-	if(!yid)
+	if (!yid)
 		return;
 
@@ -3988,5 +4056,5 @@
 	snprintf(pic_str, sizeof(pic_str), "%d", picture);
 	
-	if(from && strcmp(from, yd->user))
+	if (from && strcmp(from, yd->user))
 		yahoo_packet_hash(pkt, 0, yd->user);
 	yahoo_packet_hash(pkt, 1, from?from:yd->user);
@@ -3994,5 +4062,5 @@
 	yahoo_packet_hash(pkt, 14, what);
 
-	if(utf8)
+	if (utf8)
 		yahoo_packet_hash(pkt, 97, "1");
 
@@ -4012,5 +4080,5 @@
 	struct yahoo_data *yd;
 	struct yahoo_packet *pkt = NULL;
-	if(!yid)
+	if (!yid)
 		return;
 
@@ -4037,5 +4105,5 @@
 	char s[4];
 
-	if(!yid)
+	if (!yid)
 		return;
 
@@ -4062,5 +4130,5 @@
 	yahoo_packet_free(pkt);
 
-	if(old_status == YAHOO_STATUS_INVISIBLE) {
+	if (old_status == YAHOO_STATUS_INVISIBLE) {
 		pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBILITY, YAHOO_STATUS_AVAILABLE, 0);
 		yahoo_packet_hash(pkt, 13, "1");
@@ -4076,5 +4144,5 @@
 	struct yahoo_packet *pkt = NULL;
 
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4082,5 +4150,5 @@
 	LOG(("yahoo_logoff: current status: %d", yd->current_status));
 
-	if(yd->current_status != -1 && 0) {
+	if (yd->current_status != -1 && 0) {
 		/* Meh. Don't send this. The event handlers are not going to
 		   get to do this so it'll just leak memory. And the TCP
@@ -4097,5 +4165,5 @@
 	do {
 		yahoo_input_close(yid);
-	} while((yid = find_input_by_id(id)));
+	} while ((yid = find_input_by_id(id)));
 }
 
@@ -4106,5 +4174,5 @@
 	struct yahoo_packet *pkt = NULL;
 
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4121,5 +4189,5 @@
 {
 	struct yahoo_input_data *yid = data;
-	if(fd <= 0) {
+	if (fd <= 0) {
 		inputs = y_list_remove(inputs, yid);
 		FREE(yid);
@@ -4128,5 +4196,5 @@
 
 	yid->fd = fd;
-	yid->read_tag=YAHOO_CALLBACK(ext_yahoo_add_handler)(yid->yd->client_id, fd, YAHOO_INPUT_READ, yid);
+	yid->read_tag = YAHOO_CALLBACK(ext_yahoo_add_handler) (yid->yd->client_id, fd, YAHOO_INPUT_READ, yid);
 }
 
@@ -4138,5 +4206,5 @@
 	char buff[1024];
 
-	if(!yd)
+	if (!yd)
 		return;
 
@@ -4156,5 +4224,5 @@
 }
 
-void yahoo_set_yab(int id, struct yab * yab)
+void yahoo_set_yab(int id, struct yab *yab)
 {
 	struct yahoo_data *yd = find_conn_by_id(id);
@@ -4165,5 +4233,5 @@
 	int size = sizeof(url)-1;
 
-	if(!yd)
+	if (!yd)
 		return;
 
@@ -4174,5 +4242,5 @@
 	strncpy(url, "http://insider.msg.yahoo.com/ycontent/?addab2=0", size);
 
-	if(yab->dbid) {
+	if (yab->dbid) {
 		/* change existing yab */
 		char tmp[32];
@@ -4182,5 +4250,5 @@
 	}
 
-	if(yab->fname) {
+	if (yab->fname) {
 		strncat(url, "&fn=", size - strlen(url));
 		temp = yahoo_urlencode(yab->fname);
@@ -4188,5 +4256,5 @@
 		free(temp);
 	}
-	if(yab->lname) {
+	if (yab->lname) {
 		strncat(url, "&ln=", size - strlen(url));
 		temp = yahoo_urlencode(yab->lname);
@@ -4198,5 +4266,5 @@
 	strncat(url, temp, size - strlen(url));
 	free(temp);
-	if(yab->nname) {
+	if (yab->nname) {
 		strncat(url, "&nn=", size - strlen(url));
 		temp = yahoo_urlencode(yab->nname);
@@ -4204,5 +4272,5 @@
 		free(temp);
 	}
-	if(yab->email) {
+	if (yab->email) {
 		strncat(url, "&e=", size - strlen(url));
 		temp = yahoo_urlencode(yab->email);
@@ -4210,5 +4278,5 @@
 		free(temp);
 	}
-	if(yab->hphone) {
+	if (yab->hphone) {
 		strncat(url, "&hp=", size - strlen(url));
 		temp = yahoo_urlencode(yab->hphone);
@@ -4216,5 +4284,5 @@
 		free(temp);
 	}
-	if(yab->wphone) {
+	if (yab->wphone) {
 		strncat(url, "&wp=", size - strlen(url));
 		temp = yahoo_urlencode(yab->wphone);
@@ -4222,5 +4290,5 @@
 		free(temp);
 	}
-	if(yab->mphone) {
+	if (yab->mphone) {
 		strncat(url, "&mp=", size - strlen(url));
 		temp = yahoo_urlencode(yab->mphone);
@@ -4239,5 +4307,5 @@
 }
 
-void yahoo_set_identity_status(int id, const char * identity, int active)
+void yahoo_set_identity_status(int id, const char *identity, int active)
 {
 	struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
@@ -4245,5 +4313,5 @@
 	struct yahoo_packet *pkt = NULL;
 
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4264,5 +4332,5 @@
 	struct yahoo_packet *pkt = NULL;
 
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4279,6 +4347,6 @@
 	struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
 	struct yahoo_data *yd;
-	struct yahoo_packet *pkt=NULL;
-	if(!yid)
+	struct yahoo_packet *pkt = NULL;
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4311,5 +4379,5 @@
 	struct yahoo_packet *pkt;
 
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4346,5 +4414,5 @@
 	struct yahoo_packet *pkt = NULL;
 
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4363,9 +4431,9 @@
 	struct yahoo_data *yd;
 
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
 
-	struct yahoo_packet* pkt=NULL;
+	struct yahoo_packet* pkt = NULL;
 	pkt= yahoo_packet_new(YAHOO_SERVICE_CONTACT_YMSG13,YAHOO_STATUS_AVAILABLE,0);
 
@@ -4382,9 +4450,9 @@
 	struct yahoo_data *yd;
 
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
 
-	struct yahoo_packet* pkt=NULL;
+	struct yahoo_packet* pkt = NULL;
 	pkt= yahoo_packet_new(YAHOO_SERVICE_CONTACT_YMSG13,YAHOO_STATUS_AVAILABLE,0);
 
@@ -4408,5 +4476,5 @@
 	struct yahoo_packet *pkt;
 
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4429,5 +4497,5 @@
 	struct yahoo_packet *pkt;
 
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4450,5 +4518,5 @@
 	struct yahoo_packet *pkt;
 
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4472,5 +4540,5 @@
 	struct yahoo_packet *pkt = NULL;
 
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4499,5 +4567,5 @@
 	struct yahoo_packet *pkt = NULL;
 
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4512,5 +4580,5 @@
 }
 
-void yahoo_conference_addinvite(int id, const char * from, const char *who, const char *room, const YList * members, const char *msg)
+void yahoo_conference_addinvite(int id, const char *from, const char *who, const char *room, const YList *members, const char *msg)
 {
 	struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
@@ -4518,5 +4586,5 @@
 	struct yahoo_packet *pkt;
 		
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4529,5 +4597,5 @@
 	yahoo_packet_hash(pkt, 58, msg);
 	yahoo_packet_hash(pkt, 13, "0");
-	for(; members; members = members->next) {
+	for (; members; members = members->next) {
 		yahoo_packet_hash(pkt, 52, (char *)members->data);
 		yahoo_packet_hash(pkt, 53, (char *)members->data);
@@ -4540,5 +4608,5 @@
 }
 
-void yahoo_conference_invite(int id, const char * from, YList *who, const char *room, const char *msg)
+void yahoo_conference_invite(int id, const char *from, YList *who, const char *room, const char *msg)
 {
 	struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
@@ -4546,5 +4614,5 @@
 	struct yahoo_packet *pkt;
 		
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4554,5 +4622,5 @@
 	yahoo_packet_hash(pkt, 1, (from?from:yd->user));
 	yahoo_packet_hash(pkt, 50, yd->user);
-	for(; who; who = who->next) {
+	for (; who; who = who->next) {
 		yahoo_packet_hash(pkt, 52, (char *)who->data);
 	}
@@ -4572,5 +4640,5 @@
 	struct yahoo_packet *pkt;
 		
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4579,5 +4647,5 @@
 
 	yahoo_packet_hash(pkt, 1, (from?from:yd->user));
-	for(; who; who = who->next) {
+	for (; who; who = who->next) {
 		yahoo_packet_hash(pkt, 3, (char *)who->data);
 	}
@@ -4589,5 +4657,5 @@
 }
 
-void yahoo_conference_decline(int id, const char * from, YList *who, const char *room, const char *msg)
+void yahoo_conference_decline(int id, const char *from, YList *who, const char *room, const char *msg)
 {
 	struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
@@ -4595,5 +4663,5 @@
 	struct yahoo_packet *pkt;
 		
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4602,5 +4670,5 @@
 
 	yahoo_packet_hash(pkt, 1, (from?from:yd->user));
-	for(; who; who = who->next) {
+	for (; who; who = who->next) {
 		yahoo_packet_hash(pkt, 3, (char *)who->data);
 	}
@@ -4613,5 +4681,5 @@
 }
 
-void yahoo_conference_logoff(int id, const char * from, YList *who, const char *room)
+void yahoo_conference_logoff(int id, const char *from, YList *who, const char *room)
 {
 	struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
@@ -4619,5 +4687,5 @@
 	struct yahoo_packet *pkt;
 		
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4626,5 +4694,5 @@
 
 	yahoo_packet_hash(pkt, 1, (from?from:yd->user));
-	for(; who; who = who->next) {
+	for (; who; who = who->next) {
 		yahoo_packet_hash(pkt, 3, (char *)who->data);
 	}
@@ -4636,5 +4704,5 @@
 }
 
-void yahoo_conference_message(int id, const char * from, YList *who, const char *room, const char *msg, int utf8)
+void yahoo_conference_message(int id, const char *from, YList *who, const char *room, const char *msg, int utf8)
 {
 	struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
@@ -4642,5 +4710,5 @@
 	struct yahoo_packet *pkt;
 		
-	if(!yid)
+	if (!yid)
 		return;
 	yd = yid->yd;
@@ -4649,5 +4717,5 @@
 
 	yahoo_packet_hash(pkt, 1, (from?from:yd->user));
-	for(; who; who = who->next) {
+	for (; who; who = who->next) {
 		yahoo_packet_hash(pkt, 53, (char *)who->data);
 	}
@@ -4655,5 +4723,5 @@
 	yahoo_packet_hash(pkt, 14, msg);
 
-	if(utf8)
+	if (utf8)
 		yahoo_packet_hash(pkt, 97, "1");
 
@@ -4670,5 +4738,5 @@
 	char buff[1024];
 
-	if(!yd)
+	if (!yd)
 		return;
 
@@ -4696,5 +4764,5 @@
 	struct yahoo_packet *pkt;
 		
-	if(!yid)
+	if (!yid)
 		return;
 
@@ -4731,5 +4799,5 @@
 	char buf[2];
 		
-	if(!yid)
+	if (!yid)
 		return;
 
@@ -4745,5 +4813,5 @@
 	yahoo_packet_hash(pkt, 124, buf);
 
-	if(utf8)
+	if (utf8)
 		yahoo_packet_hash(pkt, 97, "1");
 
@@ -4760,5 +4828,5 @@
 	struct yahoo_packet *pkt;
 		
-	if(!yid)
+	if (!yid)
 		return;
 
@@ -4780,5 +4848,5 @@
 	struct yahoo_packet *pkt;
 
-	if( !yid )
+	if ( !yid )
 		return;
 
@@ -4801,5 +4869,5 @@
 	char checksum_str[10];
 
-	if( !yid )
+	if ( !yid )
 		return;
 
@@ -4827,5 +4895,5 @@
 	char type_str[10];
 
-	if( !yid )
+	if ( !yid )
 		return;
 
@@ -4850,5 +4918,5 @@
 	char checksum_str[10];
 
-	if( !yid )
+	if ( !yid )
 		return;
 
@@ -4859,5 +4927,5 @@
 	pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_CHECKSUM, YAHOO_STATUS_AVAILABLE, 0);
 	yahoo_packet_hash(pkt, 1, yd->user);
-	if( who != 0 )
+	if ( who != 0 )
 		yahoo_packet_hash(pkt, 5, who);
 	yahoo_packet_hash(pkt, 192, checksum_str);
@@ -4872,5 +4940,5 @@
 	struct yahoo_input_data *yid = find_input_by_id_and_webcam_user(id, who);
 
-	if(yid)
+	if (yid)
 		yahoo_input_close(yid);
 }
@@ -4882,5 +4950,5 @@
 	struct yahoo_packet *pkt;
 		
-	if(!yid)
+	if (!yid)
 		return;
 
@@ -4968,5 +5036,5 @@
 	struct yahoo_packet *pkt;
 		
-	if(!yid)
+	if (!yid)
 		return;
 
@@ -4991,5 +5059,5 @@
 	char *ctext, *p;
 
-	if(!yd)
+	if (!yd)
 		return;
 
@@ -5006,5 +5074,5 @@
 
 	ctext = strdup(text);
-	while((p = strchr(ctext, ' ')))
+	while ((p = strchr(ctext, ' ')))
 		*p = '+';
 
@@ -5027,8 +5095,8 @@
 	struct yahoo_search_state *yss;
 
-	if(!yid)
-		return;
-
-	if(!yid->ys)
+	if (!yid)
+		return;
+
+	if (!yid->ys)
 		yid->ys = y_new0(struct yahoo_search_state, 1);
 
@@ -5051,10 +5119,10 @@
 	struct yahoo_search_state *yss;
 
-	if(!yid || !yid->ys)
+	if (!yid || !yid->ys)
 		return;
 
 	yss = yid->ys;
 
-	if(start == -1)
+	if (start == -1)
 		start = yss->lsearch_nstart + yss->lsearch_nfound;
 
@@ -5078,5 +5146,5 @@
 	unsigned char buff[1024];
 
-	if(fd <= 0) {
+	if (fd <= 0) {
 		sfd->callback(id, fd, error, sfd->user_data);
 		FREE(sfd);
@@ -5097,5 +5165,5 @@
 	write(yid->fd, buff, 4);
 
-	/*	YAHOO_CALLBACK(ext_yahoo_add_handler)(nyd->fd, YAHOO_INPUT_READ); */
+	/*	YAHOO_CALLBACK(ext_yahoo_add_handler) (nyd->fd, YAHOO_INPUT_READ); */
 
 	sfd->callback(id, fd, error, sfd->user_data);
@@ -5103,6 +5171,6 @@
 	inputs = y_list_remove(inputs, yid);
 	/*
-	while(yahoo_tcp_readline(buff, sizeof(buff), nyd->fd) > 0) {
-	if(!strcmp(buff, ""))
+	while (yahoo_tcp_readline(buff, sizeof(buff), nyd->fd) > 0) {
+	if (!strcmp(buff, ""))
 	break;
 }
@@ -5121,10 +5189,10 @@
 	char size_str[10];
 	char expire_str[10];
-	long content_length=0;
+	long content_length = 0;
 	unsigned char buff[1024];
 	char url[255];
 	struct send_file_data *sfd;
 
-	if(!yd)
+	if (!yd)
 		return;
 
@@ -5171,5 +5239,5 @@
 	unsigned char buff[1024];
 
-	if(fd <= 0) {
+	if (fd <= 0) {
 		sfd->callback(id, fd, error, sfd->user_data);
 		FREE(sfd);
@@ -5190,5 +5258,5 @@
 	write(yid->fd, buff, 4);
 
-/*	YAHOO_CALLBACK(ext_yahoo_add_handler)(nyd->fd, YAHOO_INPUT_READ); */
+/*	YAHOO_CALLBACK(ext_yahoo_add_handler) (nyd->fd, YAHOO_INPUT_READ); */
 
 	sfd->callback(id, fd, error, sfd->user_data);
@@ -5196,6 +5264,6 @@
 	inputs = y_list_remove(inputs, yid);
 	/*
-	while(yahoo_tcp_readline(buff, sizeof(buff), nyd->fd) > 0) {
-		if(!strcmp(buff, ""))
+	while (yahoo_tcp_readline(buff, sizeof(buff), nyd->fd) > 0) {
+		if (!strcmp(buff, ""))
 			break;
 	}
@@ -5214,10 +5282,10 @@
 	struct yahoo_packet *pkt = NULL;
 	char size_str[10];
-	long content_length=0;
+	long content_length = 0;
 	unsigned char buff[1024];
 	char url[255];
 	struct send_file_data *sfd;
 
-	if(!yd)
+	if (!yd)
 		return;
 
@@ -5258,45 +5326,45 @@
 {
 	struct yahoo_data *yd = find_conn_by_id(id);
-	if(!yd)
+	if (!yd)
 		return YAHOO_STATUS_OFFLINE;
 	return yd->current_status;
 }
 
-const YList * yahoo_get_buddylist(int id)
+const YList *yahoo_get_buddylist(int id)
 {
 	struct yahoo_data *yd = find_conn_by_id(id);
-	if(!yd)
+	if (!yd)
 		return NULL;
 	return yd->buddies;
 }
 
-const YList * yahoo_get_ignorelist(int id)
+const YList *yahoo_get_ignorelist(int id)
 {
 	struct yahoo_data *yd = find_conn_by_id(id);
-	if(!yd)
+	if (!yd)
 		return NULL;
 	return yd->ignore;
 }
 
-const YList * yahoo_get_identities(int id)
+const YList *yahoo_get_identities(int id)
 {
 	struct yahoo_data *yd = find_conn_by_id(id);
-	if(!yd)
+	if (!yd)
 		return NULL;
 	return yd->identities;
 }
 
-const char * yahoo_get_cookie(int id, const char *which)
+const char *yahoo_get_cookie(int id, const char *which)
 {
 	struct yahoo_data *yd = find_conn_by_id(id);
-	if(!yd)
+	if (!yd)
 		return NULL;
-	if(!strncasecmp(which, "y", 1))
+	if (!strncasecmp(which, "y", 1))
 		return yd->cookie_y;
-	if(!strncasecmp(which, "t", 1))
+	if (!strncasecmp(which, "t", 1))
 		return yd->cookie_t;
-	if(!strncasecmp(which, "c", 1))
+	if (!strncasecmp(which, "c", 1))
 		return yd->cookie_c;
-	if(!strncasecmp(which, "login", 5))
+	if (!strncasecmp(which, "login", 5))
 		return yd->login_cookie;
 	return NULL;
@@ -5307,5 +5375,5 @@
 {
 	struct yahoo_data *yd = find_conn_by_id(id);
-	if(!yd)
+	if (!yd)
 		return;
 
@@ -5313,5 +5381,5 @@
 }
 
-const char * yahoo_get_profile_url( void )
+const char *yahoo_get_profile_url( void )
 {
 	return profile_url;
Index: protocols/yahoo/yahoo2.h
===================================================================
--- protocols/yahoo/yahoo2.h	(revision 56699f009a608ecff3a247a08b3d0105a5e17153)
+++ protocols/yahoo/yahoo2.h	(revision c36f73bd317dd55d7e70275a6425faa4be7bfd8c)
@@ -62,5 +62,4 @@
 /* who always means the buddy you're acting on */
 /* id is the successful value returned by yahoo_init */
-
 
 /* init returns a connection id used to identify the connection hereon */
@@ -88,74 +87,91 @@
  * You should set at least local_host if you intend to use webcams
  */
-int  yahoo_init_with_attributes(const char *username, const char *password, ...);
+	int yahoo_init_with_attributes(const char *username,
+		const char *password, ...);
 
 /* yahoo_init does the same as yahoo_init_with_attributes, assuming defaults
  * for all attributes */
-int  yahoo_init(const char *username, const char *password);
-
-
+	int yahoo_init(const char *username, const char *password);
 
 /* release all resources held by this session */
 /* you need to call yahoo_close for a session only if
  * yahoo_logoff is never called for it (ie, it was never logged in) */
-void yahoo_close(int id);
+	void yahoo_close(int id);
 /* login logs in to the server */
 /* initial is of type enum yahoo_status.  see yahoo2_types.h */
-void yahoo_login(int id, int initial);
-void yahoo_logoff(int id);
+	void yahoo_login(int id, int initial);
+	void yahoo_logoff(int id);
 /* reloads status of all buddies */
-void yahoo_refresh(int id);
+	void yahoo_refresh(int id);
 /* activates/deactivates an identity */
-void yahoo_set_identity_status(int id, const char * identity, int active);
+	void yahoo_set_identity_status(int id, const char *identity,
+		int active);
 /* regets the entire buddy list from the server */
-void yahoo_get_list(int id);
+	void yahoo_get_list(int id);
 /* download buddy contact information from your yahoo addressbook */
-void yahoo_get_yab(int id);
+	void yahoo_get_yab(int id);
 /* add/modify an address book entry.  if yab->dbid is set, it will */
 /* modify that entry else it creates a new entry */
-void yahoo_set_yab(int id, struct yab * yab);
-void yahoo_keepalive(int id);
-void yahoo_chat_keepalive(int id);
+	void yahoo_set_yab(int id, struct yab *yab);
+	void yahoo_keepalive(int id);
+	void yahoo_chat_keepalive(int id);
 
 /* from is the identity you're sending from.  if NULL, the default is used */
 /* utf8 is whether msg is a utf8 string or not. */
-void yahoo_send_im(int id, const char *from, const char *who, const char *msg, int utf8, int picture);
+	void yahoo_send_im(int id, const char *from, const char *who,
+		const char *msg, int utf8, int picture);
+	void yahoo_send_buzz(int id, const char *from, const char *who);
 /* if type is true, send typing notice, else send stopped typing notice */
-void yahoo_send_typing(int id, const char *from, const char *who, int typ);
+	void yahoo_send_typing(int id, const char *from, const char *who,
+		int typ);
 
 /* used to set away/back status. */
 /* away says whether the custom message is an away message or a sig */
-void yahoo_set_away(int id, enum yahoo_status state, const char *msg, int away);
-
-void yahoo_add_buddy(int id, const char *who, const char *group, const char *msg);
-void yahoo_remove_buddy(int id, const char *who, const char *group);
-void yahoo_reject_buddy(int id, const char *who, const char *msg);
-void yahoo_stealth_buddy(int id, const char *who, int unstealth);
+	void yahoo_set_away(int id, enum yahoo_status state, const char *msg,
+		int away);
+
+	void yahoo_add_buddy(int id, const char *who, const char *group,
+		const char *msg);
+	void yahoo_remove_buddy(int id, const char *who, const char *group);
+	void yahoo_confirm_buddy(int id, const char *who, int reject,
+		const char *msg);
+	void yahoo_stealth_buddy(int id, const char *who, int unstealth);
 /* if unignore is true, unignore, else ignore */
-void yahoo_ignore_buddy(int id, const char *who, int unignore);
-void yahoo_change_buddy_group(int id, const char *who, const char *old_group, const char *new_group);
-void yahoo_group_rename(int id, const char *old_group, const char *new_group);
-
-void yahoo_conference_invite(int id, const char * from, YList *who, const char *room, const char *msg);
-void yahoo_conference_addinvite(int id, const char * from, const char *who, const char *room, const YList * members, const char *msg);
-void yahoo_conference_decline(int id, const char * from, YList *who, const char *room, const char *msg);
-void yahoo_conference_message(int id, const char * from, YList *who, const char *room, const char *msg, int utf8);
-void yahoo_conference_logon(int id, const char * from, YList *who, const char *room);
-void yahoo_conference_logoff(int id, const char * from, YList *who, const char *room);
+	void yahoo_ignore_buddy(int id, const char *who, int unignore);
+	void yahoo_change_buddy_group(int id, const char *who,
+		const char *old_group, const char *new_group);
+	void yahoo_group_rename(int id, const char *old_group,
+		const char *new_group);
+
+	void yahoo_conference_invite(int id, const char *from, YList *who,
+		const char *room, const char *msg);
+	void yahoo_conference_addinvite(int id, const char *from,
+		const char *who, const char *room, const YList *members,
+		const char *msg);
+	void yahoo_conference_decline(int id, const char *from, YList *who,
+		const char *room, const char *msg);
+	void yahoo_conference_message(int id, const char *from, YList *who,
+		const char *room, const char *msg, int utf8);
+	void yahoo_conference_logon(int id, const char *from, YList *who,
+		const char *room);
+	void yahoo_conference_logoff(int id, const char *from, YList *who,
+		const char *room);
 
 /* Get a list of chatrooms */
-void yahoo_get_chatrooms(int id,int chatroomid);
+	void yahoo_get_chatrooms(int id, int chatroomid);
 /* join room with specified roomname and roomid */
-void yahoo_chat_logon(int id, const char *from, const char *room, const char *roomid);
+	void yahoo_chat_logon(int id, const char *from, const char *room,
+		const char *roomid);
 /* Send message "msg" to room with specified roomname, msgtype is 1-normal message or 2-/me mesage */
-void yahoo_chat_message(int id, const char *from, const char *room, const char *msg, const int msgtype, const int utf8);
+	void yahoo_chat_message(int id, const char *from, const char *room,
+		const char *msg, const int msgtype, const int utf8);
 /* Log off chat */
-void yahoo_chat_logoff(int id, const char *from);
+	void yahoo_chat_logoff(int id, const char *from);
 
 /* requests a webcam feed */
 /* who is the person who's webcam you would like to view */
 /* if who is null, then you're the broadcaster */
-void yahoo_webcam_get_feed(int id, const char *who);
-void yahoo_webcam_close_feed(int id, const char *who);
+	void yahoo_webcam_get_feed(int id, const char *who);
+	void yahoo_webcam_close_feed(int id, const char *who);
 
 /* sends an image when uploading */
@@ -163,13 +179,14 @@
 /* in bytes. The timestamp is the time in milliseconds since we started the */
 /* webcam. */
-void yahoo_webcam_send_image(int id, unsigned char *image, unsigned int length, unsigned int timestamp);
+	void yahoo_webcam_send_image(int id, unsigned char *image,
+		unsigned int length, unsigned int timestamp);
 
 /* this function should be called if we want to allow a user to watch the */
 /* webcam. Who is the user we want to accept. */
 /* Accept user (accept = 1), decline user (accept = 0) */
-void yahoo_webcam_accept_viewer(int id, const char* who, int accept);
+	void yahoo_webcam_accept_viewer(int id, const char *who, int accept);
 
 /* send an invitation to a user to view your webcam */
-void yahoo_webcam_invite(int id, const char *who);
+	void yahoo_webcam_invite(int id, const char *who);
 
 /* will set up a connection and initiate file transfer.
@@ -177,10 +194,20 @@
  * the file data to
  */
-void yahoo_send_file(int id, const char *who, const char *msg, const char *name, unsigned long size,
+	void yahoo_send_file(int id, const char *who, const char *msg,
+		const char *name, unsigned long size,
 		yahoo_get_fd_callback callback, void *data);
 
+/*
+ * Respond to a file transfer request. Be sure to provide the callback data
+ * since that is your only chance to recognize future callbacks
+ */
+	void yahoo_send_file_transfer_response(int client_id, int response,
+		char *id, void *data);
+
+
 /* send a search request
  */
-void yahoo_search(int id, enum yahoo_search_type t, const char *text, enum yahoo_search_gender g, enum yahoo_search_agerange ar,
+	void yahoo_search(int id, enum yahoo_search_type t, const char *text,
+		enum yahoo_search_gender g, enum yahoo_search_agerange ar,
 		int photo, int yahoo_only);
 
@@ -190,9 +217,5 @@
  * where the above three are passed to ext_yahoo_got_search_result
  */
-void yahoo_search_again(int id, int start);
-
-/* returns a socket fd to a url for downloading a file. */
-void yahoo_get_url_handle(int id, const char *url, 
-		yahoo_get_url_handle_callback callback, void *data);
+	void yahoo_search_again(int id, int start);
 
 /* these should be called when input is available on a fd */
@@ -203,20 +226,20 @@
 
 /* utility functions. these do not hit the server */
-enum yahoo_status yahoo_current_status(int id);
-const YList * yahoo_get_buddylist(int id);
-const YList * yahoo_get_ignorelist(int id);
-const YList * yahoo_get_identities(int id);
+	enum yahoo_status yahoo_current_status(int id);
+	const YList *yahoo_get_buddylist(int id);
+	const YList *yahoo_get_ignorelist(int id);
+	const YList *yahoo_get_identities(int id);
 /* 'which' could be y, t, c or login.  This may change in later versions. */
-const char  * yahoo_get_cookie(int id, const char *which);
+	const char *yahoo_get_cookie(int id, const char *which);
 
 /* returns the url used to get user profiles - you must append the user id */
 /* as of now this is http://profiles.yahoo.com/ */
 /* You'll have to do urlencoding yourself, but see yahoo_httplib.h first */
-const char  * yahoo_get_profile_url( void );
-
-void yahoo_buddyicon_request(int id, const char *who);
-
-void yahoo_accept_buddy_ymsg13(int,const char*,const char*);
-void yahoo_reject_buddy_ymsg13(int,const char*,const char*,const char*);
+	const char *yahoo_get_profile_url(void);
+
+	void yahoo_buddyicon_request(int id, const char *who);
+
+	void yahoo_accept_buddy_ymsg13(int,const char*, const char*);
+	void yahoo_reject_buddy_ymsg13(int,const char*, const char*, const char*);
 
 #include "yahoo_httplib.h"
@@ -225,4 +248,3 @@
 }
 #endif
-
 #endif
Index: protocols/yahoo/yahoo2_callbacks.h
===================================================================
--- protocols/yahoo/yahoo2_callbacks.h	(revision 56699f009a608ecff3a247a08b3d0105a5e17153)
+++ protocols/yahoo/yahoo2_callbacks.h	(revision c36f73bd317dd55d7e70275a6425faa4be7bfd8c)
@@ -30,5 +30,4 @@
  */
 
-
 #ifndef YAHOO2_CALLBACKS_H
 #define YAHOO2_CALLBACKS_H
@@ -46,9 +45,9 @@
  */
 
-typedef enum {
-	YAHOO_INPUT_READ = 1 << 0,
-	YAHOO_INPUT_WRITE = 1 << 1,
-	YAHOO_INPUT_EXCEPTION = 1 << 2
-} yahoo_input_condition;
+	typedef enum {
+		YAHOO_INPUT_READ = 1 << 0,
+		YAHOO_INPUT_WRITE = 1 << 1,
+		YAHOO_INPUT_EXCEPTION = 1 << 2
+	} yahoo_input_condition;
 
 /*
@@ -94,6 +93,6 @@
  * 	url  - url to reactivate account if locked
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_login_response)(int id, int succ, const char *url);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_login_response) (int id, int succ,
+		const char *url);
 
 /*
@@ -104,6 +103,5 @@
  * 	buds - the buddy list
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddies)(int id, YList * buds);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddies) (int id, YList *buds);
 
 /*
@@ -114,6 +112,5 @@
  * 	igns - the ignore list
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ignore)(int id, YList * igns);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ignore) (int id, YList *igns);
 
 /*
@@ -124,6 +121,5 @@
  * 	ids  - the identity list
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_got_identities)(int id, YList * ids);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_got_identities) (int id, YList *ids);
 
 /*
@@ -133,6 +129,5 @@
  * 	id   - the id that identifies the server connection
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_got_cookies)(int id);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_got_cookies) (int id);
 
 /*
@@ -143,6 +138,6 @@
  *  errormsg - optional error message
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ping)(int id, const char *errormsg);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ping) (int id,
+		const char *errormsg);
 
 /*
@@ -159,6 +154,19 @@
  *	TODO: add support for pager, chat, and game states
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_status_changed)(int id, const char *who, int stat, const char *msg, int away, int idle, int mobile);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_status_changed) (int id,
+		const char *who, int stat, const char *msg, int away, int idle,
+		int mobile);
+
+/*
+ * Name: ext_yahoo_got_buzz
+ * 	Called when remote user sends you a buzz.
+ * Params:
+ * 	id   - the id that identifies the server connection
+ * 	me   - the identity the message was sent to
+ * 	who  - the handle of the remote user
+ * 	tm   - timestamp of message if offline
+ */
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buzz) (int id, const char *me,
+		const char *who, long tm);
 
 /*
@@ -177,6 +185,6 @@
  * 	utf8 - whether the message is encoded as utf8 or not
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_got_im)(int id, const char *me, const char *who, const char *msg, long tm, int stat, int utf8);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_got_im) (int id, const char *me,
+		const char *who, const char *msg, long tm, int stat, int utf8);
 
 /*
@@ -191,6 +199,7 @@
  *	members - the initial members of the conference (null terminated list)
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_got_conf_invite)(int id, const char *me, const char *who, const char *room, const char *msg, YList *members);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_got_conf_invite) (int id,
+		const char *me, const char *who, const char *room,
+		const char *msg, YList *members);
 
 /*
@@ -204,6 +213,7 @@
  * 	msg  - the declining message
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userdecline)(int id, const char *me, const char *who, const char *room, const char *msg);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userdecline) (int id,
+		const char *me, const char *who, const char *room,
+		const char *msg);
 
 /*
@@ -216,6 +226,6 @@
  * 	room - the room joined
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userjoin)(int id, const char *me, const char *who, const char *room);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userjoin) (int id,
+		const char *me, const char *who, const char *room);
 
 /*
@@ -228,6 +238,6 @@
  * 	room - the room left
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userleave)(int id, const char *me, const char *who, const char *room);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userleave) (int id,
+		const char *me, const char *who, const char *room);
 
 /*
@@ -238,6 +248,6 @@
  * 	xml     - ?
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_cat_xml)(int id, const char *xml);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_cat_xml) (int id,
+		const char *xml);
 
 /*
@@ -254,6 +264,6 @@
  *	fd	- the socket where the connection is coming from (for tracking)
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_join)(int id, const char *me, const char *room, const char *topic, YList *members, int fd);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_join) (int id, const char *me,
+		const char *room, const char *topic, YList *members, int fd);
 
 /*
@@ -266,6 +276,7 @@
  * 	who  - the user who has joined, Must be freed by the client
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userjoin)(int id, const char *me, const char *room, struct yahoo_chat_member *who);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userjoin) (int id,
+		const char *me, const char *room,
+		struct yahoo_chat_member *who);
 
 /*
@@ -278,6 +289,6 @@
  * 	who  - the user who has left (Just the User ID)
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userleave)(int id, const char *me, const char *room, const char *who);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userleave) (int id,
+		const char *me, const char *room, const char *who);
 
 /*
@@ -294,6 +305,7 @@
  * 	utf8 - whether the message is utf8 encoded or not
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_message)(int id, const char *me, const char *who, const char *room, const char *msg, int msgtype, int utf8);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_message) (int id,
+		const char *me, const char *who, const char *room,
+		const char *msg, int msgtype, int utf8);
 
 /*
@@ -310,6 +322,6 @@
  *	nothing.
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahoologout)(int id, const char *me);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahoologout) (int id,
+		const char *me);
 
 /*
@@ -327,6 +339,6 @@
  *	nothing.
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahooerror)(int id, const char *me);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahooerror) (int id,
+		const char *me);
 
 /*
@@ -341,6 +353,7 @@
  * 	utf8 - whether the message is utf8 encoded or not
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_message)(int id, const char *me, const char *who, const char *room, const char *msg, int utf8);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_message) (int id,
+		const char *me, const char *who, const char *room,
+		const char *msg, int utf8);
 
 /*
@@ -381,6 +394,6 @@
  * 	msg  - any message sent
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_added)(int id, const char *myid, const char *who, const char *msg);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_added) (int id,
+		const char *myid, const char *who, const char *msg);
 
 /*
@@ -392,6 +405,6 @@
  * 	msg  - any message sent
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_rejected)(int id, const char *who, const char *msg);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_rejected) (int id, const char *who,
+		const char *msg);
 
 /*
@@ -404,6 +417,6 @@
  * 	stat - 1 if typing, 0 if stopped typing
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_typing_notify)(int id, const char *me, const char *who, int stat);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_typing_notify) (int id,
+		const char *me, const char *who, int stat);
 
 /*
@@ -428,6 +441,6 @@
  * 	cnt  - mail count - 0 if new mail notification
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_mail_notify)(int id, const char *from, const char *subj, int cnt);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_mail_notify) (int id,
+		const char *from, const char *subj, int cnt);
 
 /*
@@ -450,5 +463,6 @@
  * 	checksum - the checksum of the icon content
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon)(int id, const char *me, const char *who, const char *url, int checksum);
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon) (int id,
+		const char *me, const char *who, const char *url, int checksum);
 
 /*
@@ -461,5 +475,6 @@
  * 	checksum - the checksum of the icon content
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_checksum)(int id, const char *me,const char *who, int checksum);
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_checksum) (int id,
+		const char *me, const char *who, int checksum);
 
 /*
@@ -471,5 +486,6 @@
  * 	who - the yahoo id of the buddy that requested the buddy icon
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_request)(int id, const char *me, const char *who);
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_request) (int id,
+		const char *me, const char *who);
 
 /*
@@ -480,5 +496,6 @@
  * 	url - remote url, the uploaded buddy icon can be fetched from
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_buddyicon_uploaded)(int id, const char *url);
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_buddyicon_uploaded) (int id,
+		const char *url);
 
 /*
@@ -505,8 +522,8 @@
  *	a timestamp to stay in sync
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_got_webcam_image)(int id, const char * who,
-		const unsigned char *image, unsigned int image_size, unsigned int real_size,
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_got_webcam_image) (int id,
+		const char *who, const unsigned char *image,
+		unsigned int image_size, unsigned int real_size,
 		unsigned int timestamp);
-
 
 /*
@@ -518,6 +535,6 @@
  * 	from - who the invitation is from
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite)(int id, const char *me, const char *from);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite) (int id,
+		const char *me, const char *from);
 
 /*
@@ -530,6 +547,6 @@
  *	accept - 0 (decline), 1 (accept)
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite_reply)(int id, const char *me, const char *from, int accept);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite_reply) (int id,
+		const char *me, const char *from, int accept);
 
 /*
@@ -545,6 +562,6 @@
  *	         4 = user does not have webcam online
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_closed)(int id, const char *who, int reason);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_closed) (int id,
+		const char *who, int reason);
 
 /*
@@ -560,6 +577,6 @@
  * 		   if you need to use the information, make a copy
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_got_search_result)(int id, int found, int start, int total, YList *contacts);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_got_search_result) (int id,
+		int found, int start, int total, YList *contacts);
 
 /*
@@ -572,6 +589,6 @@
  * 	num  - Which error is this
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_error)(int id, const char *err, int fatal, int num);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_error) (int id, const char *err,
+		int fatal, int num);
 
 /*
@@ -583,6 +600,6 @@
  *	connect - 0=disconnect 1=connect 2=request
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_viewer)(int id, const char *who, int connect);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_viewer) (int id,
+		const char *who, int connect);
 
 /*
@@ -593,6 +610,6 @@
  *	send - whether to send images or not
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_data_request)(int id, int send);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_data_request) (int id,
+		int send);
 
 /*
@@ -604,6 +621,5 @@
  * 	0
  */
-int YAHOO_CALLBACK_TYPE(ext_yahoo_log)(const char *fmt, ...);
-
+	int YAHOO_CALLBACK_TYPE(ext_yahoo_log) (const char *fmt, ...);
 
 /*
@@ -620,6 +636,6 @@
  * Returns: a tag to be used when removing the handler
  */
-int YAHOO_CALLBACK_TYPE(ext_yahoo_add_handler)(int id, int fd, yahoo_input_condition cond, void *data);
-
+	int YAHOO_CALLBACK_TYPE(ext_yahoo_add_handler) (int id, int fd,
+		yahoo_input_condition cond, void *data);
 
 /*
@@ -630,6 +646,5 @@
  * 	tag  - the handler tag to remove
  */
-void YAHOO_CALLBACK_TYPE(ext_yahoo_remove_handler)(int id, int tag);
-
+	void YAHOO_CALLBACK_TYPE(ext_yahoo_remove_handler) (int id, int tag);
 
 /*
@@ -642,10 +657,9 @@
  * 	a unix file descriptor to the socket
  */
-int YAHOO_CALLBACK_TYPE(ext_yahoo_connect)(const char *host, int port);
-
+	int YAHOO_CALLBACK_TYPE(ext_yahoo_connect) (const char *host, int port);
 
 /*
  * Name: ext_yahoo_connect_async
- * 	Connect to a host:port asynchronously.  This function should return
+ * 	Connect to a host:port asynchronously. This function should return
  * 	immediately returing a tag used to identify the connection handler,
  * 	or a pre-connect error (eg: host name lookup failure).
@@ -663,6 +677,7 @@
  * 	a unix file descriptor to the socket
  */
-int YAHOO_CALLBACK_TYPE(ext_yahoo_connect_async)(int id, const char *host, int port, 
-		yahoo_connect_callback callback, void *callback_data);
+	int YAHOO_CALLBACK_TYPE(ext_yahoo_connect_async) (int id,
+		const char *host, int port, yahoo_connect_callback callback,
+		void *callback_data);
 
 #ifdef USE_STRUCT_CALLBACKS
@@ -673,5 +688,5 @@
  * before doing anything else
  */
-void yahoo_register_callbacks(struct yahoo_callbacks * tyc);
+void yahoo_register_callbacks(struct yahoo_callbacks *tyc);
 
 #undef YAHOO_CALLBACK_TYPE
Index: protocols/yahoo/yahoo2_types.h
===================================================================
--- protocols/yahoo/yahoo2_types.h	(revision 56699f009a608ecff3a247a08b3d0105a5e17153)
+++ protocols/yahoo/yahoo2_types.h	(revision c36f73bd317dd55d7e70275a6425faa4be7bfd8c)
@@ -201,4 +201,5 @@
 
 struct yab {
+	int yid;
 	char *id;
 	char *fname;
Index: protocols/yahoo/yahoo_fn.h
===================================================================
--- protocols/yahoo/yahoo_fn.h	(revision 56699f009a608ecff3a247a08b3d0105a5e17153)
+++ protocols/yahoo/yahoo_fn.h	(revision c36f73bd317dd55d7e70275a6425faa4be7bfd8c)
@@ -19,15 +19,14 @@
  */
 
-#define IDENT  1 /* identify function */
-#define XOR    2 /* xor with arg1 */
-#define MULADD 3 /* multipy by arg1 then add arg2 */
-#define LOOKUP 4 /* lookup each byte in the table pointed to by arg1 */
-#define BITFLD 5 /* reorder bits according to table pointed to by arg1 */
+#define IDENT  1		/* identify function */
+#define XOR    2		/* xor with arg1 */
+#define MULADD 3		/* multipy by arg1 then add arg2 */
+#define LOOKUP 4		/* lookup each byte in the table pointed to by arg1 */
+#define BITFLD 5		/* reorder bits according to table pointed to by arg1 */
 
-struct yahoo_fn
-{
-	int type; 
+struct yahoo_fn {
+	int type;
 	long arg1, arg2;
 };
 
-int yahoo_xfrm( int table, int depth, int seed );
+int yahoo_xfrm(int table, int depth, int seed);
Index: protocols/yahoo/yahoo_util.c
===================================================================
--- protocols/yahoo/yahoo_util.c	(revision 56699f009a608ecff3a247a08b3d0105a5e17153)
+++ protocols/yahoo/yahoo_util.c	(revision c36f73bd317dd55d7e70275a6425faa4be7bfd8c)
@@ -36,10 +36,10 @@
 #include "yahoo_util.h"
 
-char * y_string_append(char * string, char * append)
+char *y_string_append(char *string, char *append)
 {
 	int size = strlen(string) + strlen(append) + 1;
-	char * new_string = y_renew(char, string, size);
+	char *new_string = y_renew(char, string, size);
 
-	if(new_string == NULL) {
+	if (new_string == NULL) {
 		new_string = y_new(char, size);
 		strcpy(new_string, string);
Index: protocols/yahoo/yahoo_util.h
===================================================================
--- protocols/yahoo/yahoo_util.h	(revision 56699f009a608ecff3a247a08b3d0105a5e17153)
+++ protocols/yahoo/yahoo_util.h	(revision c36f73bd317dd55d7e70275a6425faa4be7bfd8c)
@@ -61,15 +61,17 @@
 # define y_renew(type, mem, n)	(type *)realloc(mem, n)
 
-void * y_memdup(const void * addr, int n);
-char ** y_strsplit(char * str, char * sep, int nelem);
-void y_strfreev(char ** vector);
+void *y_memdup(const void *addr, int n);
+char **y_strsplit(char *str, char *sep, int nelem);
+void y_strfreev(char **vector);
 
-int strncasecmp(const char * s1, const char * s2, size_t n);
-int strcasecmp(const char * s1, const char * s2);
+#ifndef _WIN32
+int strncasecmp(const char *s1, const char *s2, size_t n);
+int strcasecmp(const char *s1, const char *s2);
 
-char * strdup(const char *s);
+char *strdup(const char *s);
 
 int snprintf(char *str, size_t size, const char *format, ...);
 int vsnprintf(char *str, size_t size, const char *format, va_list ap);
+#endif
 
 #endif
@@ -95,7 +97,7 @@
  * You must free it yourself
  */
-char * y_string_append(char * str, char * append);
-char * y_str_to_utf8(const char * in);
-char * y_utf8_to_str(const char * in);
+char *y_string_append(char *str, char *append);
+char *y_str_to_utf8(const char *in);
+char *y_utf8_to_str(const char *in);
 
 #endif
