changeset 2138:cfa83a1b3d49

[gaim-migrate @ 2148] hopefully fixes any problems we might have with icq. also makes it so we can receive messages from people whose names are longer than 64 characters. this should be arbitrary. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 08 Aug 2001 20:09:57 +0000
parents 18722ae5b882
children a14e8459c233
files src/conversation.c src/protocols/icq/gaim_icq.c
diffstat 2 files changed, 24 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Wed Aug 08 19:55:12 2001 +0000
+++ b/src/conversation.c	Wed Aug 08 20:09:57 2001 +0000
@@ -163,7 +163,7 @@
 
 struct conversation *find_conversation(char *name)
 {
-	char *cuser = g_malloc(64);
+	char *cuser = g_malloc(1024);
 	struct conversation *c;
 	GList *cnv = conversations;
 
@@ -207,7 +207,7 @@
 
 struct log_conversation *find_log_info(char *name)
 {
-	char *pname = g_malloc(64);
+	char *pname = g_malloc(1024);
 	GList *lc = log_conversations;
 	struct log_conversation *l;
 
@@ -1395,28 +1395,28 @@
 		if (flags & WFLAG_WHISPER) {
 			/* if we're whispering, it's not an autoresponse */
 			if (meify(what)) {
-				str = g_malloc(64);
-				g_snprintf(str, 62, "***%s", who);
+				str = g_malloc(1024);
+				g_snprintf(str, 1024, "***%s", who);
 				strcpy(colour, "#6C2585\0");
 			} else {
-				str = g_malloc(64);
-				g_snprintf(str, 62, "*%s*:", who);
+				str = g_malloc(1024);
+				g_snprintf(str, 1024, "*%s*:", who);
 				strcpy(colour, "#00ff00\0");
 			}
 		} else {
 			if (meify(what)) {
-				str = g_malloc(64);
+				str = g_malloc(1024);
 				if (flags & WFLAG_AUTO)
-					g_snprintf(str, 62, "%s ***%s", AUTO_RESPONSE, who);
+					g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who);
 				else
-					g_snprintf(str, 62, "***%s", who);
+					g_snprintf(str, 1024, "***%s", who);
 				strcpy(colour, "#062585\0");
 			} else {
-				str = g_malloc(64);
+				str = g_malloc(1024);
 				if (flags & WFLAG_AUTO)
-					g_snprintf(str, 62, "%s %s", who, AUTO_RESPONSE);
+					g_snprintf(str, 1024, "%s %s", who, AUTO_RESPONSE);
 				else
-					g_snprintf(str, 62, "%s:", who);
+					g_snprintf(str, 1024, "%s:", who);
 				if (flags & WFLAG_RECV)
 					strcpy(colour, "#ff0000");
 				else if (flags & WFLAG_SEND)
--- a/src/protocols/icq/gaim_icq.c	Wed Aug 08 19:55:12 2001 +0000
+++ b/src/protocols/icq/gaim_icq.c	Wed Aug 08 20:09:57 2001 +0000
@@ -24,25 +24,6 @@
 
 static guint ack_timer = 0;
 
-static struct gaim_connection *find_gaim_conn_by_icq_link(icq_Link *link) {
-	GSList *c = connections;
-	struct gaim_connection *gc = NULL;
-	struct icq_data *id;
-
-	while (c) {
-		gc = (struct gaim_connection *)c->data;
-		if (gc->protocol == PROTO_ICQ) {
-			id = (struct icq_data *)gc->proto_data;
-			if (id->link == link)
-				break;
-		}
-		gc = NULL;
-		c = c->next;
-	}
-
-	return gc;
-}
-
 static char *icq_name() {
 	return "ICQ";
 }
@@ -97,7 +78,7 @@
 }
 
 static void icq_online(icq_Link *link) {
-	struct gaim_connection *gc = find_gaim_conn_by_icq_link(link);
+	struct gaim_connection *gc = link->icq_UserData;
 	struct icq_data *id = (struct icq_data *)gc->proto_data;
 	debug_printf("%s is now online.\n", gc->username);
 	account_online(gc);
@@ -108,7 +89,7 @@
 }
 
 static void icq_logged_off(icq_Link *link) {
-	struct gaim_connection *gc = find_gaim_conn_by_icq_link(link);
+	struct gaim_connection *gc = link->icq_UserData;
 	struct icq_data *id = (struct icq_data *)gc->proto_data;
 
 	if (icq_Connect(link, "icq.mirabilis.com", 4000) < 1) {
@@ -137,7 +118,7 @@
 
 static void icq_msg_incoming(icq_Link *link, unsigned long uin, unsigned char hour, unsigned char minute,
 			unsigned char day, unsigned char month, unsigned short year, const char *data) {
-	struct gaim_connection *gc = find_gaim_conn_by_icq_link(link);
+	struct gaim_connection *gc = link->icq_UserData;
 	char buf[256], *tmp = g_malloc(BUF_LONG);
 	g_snprintf(tmp, BUF_LONG, "%s", data);
 	g_snprintf(buf, sizeof buf, "%lu", uin);
@@ -149,7 +130,7 @@
 static void icq_user_online(icq_Link *link, unsigned long uin, unsigned long st,
 				unsigned long ip, unsigned short port, unsigned long real_ip,
 				unsigned char tcp_flags) {
-	struct gaim_connection *gc = find_gaim_conn_by_icq_link(link);
+	struct gaim_connection *gc = link->icq_UserData;
 	guint status;
 	char buf[256];
 
@@ -159,13 +140,13 @@
 }
 
 static void icq_user_offline(icq_Link *link, unsigned long uin) {
-	struct gaim_connection *gc = find_gaim_conn_by_icq_link(link);
+	struct gaim_connection *gc = link->icq_UserData;
 	char buf[256]; g_snprintf(buf, sizeof buf, "%lu", uin);
 	serv_got_update(gc, buf, 0, 0, 0, 0, 0, 0);
 }
 
 static void icq_user_status(icq_Link *link, unsigned long uin, unsigned long st) {
-	struct gaim_connection *gc = find_gaim_conn_by_icq_link(link);
+	struct gaim_connection *gc = link->icq_UserData;
 	guint status;
 	char buf[256];
 
@@ -193,7 +174,7 @@
 static void icq_url_incoming(icq_Link *link, unsigned long uin, unsigned char hour,
 				unsigned char minute, unsigned char day, unsigned char month,
 				unsigned short year, const char *url, const char *descr) {
-	struct gaim_connection *gc = find_gaim_conn_by_icq_link(link);
+	struct gaim_connection *gc = link->icq_UserData;
 	char *msg = g_malloc(BUF_LONG), buf[256];
 	g_snprintf(msg, BUF_LONG, "<A HREF=\"%s\">%s</A>", url, descr);
 	g_snprintf(buf, 256, "%lu", uin);
@@ -202,13 +183,13 @@
 }
 
 static void icq_wrong_passwd(icq_Link *link) {
-	struct gaim_connection *gc = find_gaim_conn_by_icq_link(link);
+	struct gaim_connection *gc = link->icq_UserData;
 	hide_login_progress(gc, "Invalid password.");
 	signoff(gc);
 }
 
 static void icq_invalid_uin(icq_Link *link) {
-	struct gaim_connection *gc = find_gaim_conn_by_icq_link(link);
+	struct gaim_connection *gc = link->icq_UserData;
 	hide_login_progress(gc, "Invalid UIN.");
 	signoff(gc);
 }
@@ -232,7 +213,7 @@
 static void icq_web_pager(icq_Link *link, unsigned char hour, unsigned char minute,
 		unsigned char day, unsigned char month, unsigned short year, const char *nick,
 		const char *email, const char *msg) {
-	struct gaim_connection *gc = find_gaim_conn_by_icq_link(link);
+	struct gaim_connection *gc = link->icq_UserData;
 	char *who = g_strdup_printf("ICQ Web Pager: %s (%s)", nick, email);
 	char *what = g_malloc(BUF_LONG);
 	g_snprintf(what, BUF_LONG, "%s", msg);
@@ -244,7 +225,7 @@
 static void icq_mail_express(icq_Link *link, unsigned char hour, unsigned char minute,
 		unsigned char day, unsigned char month, unsigned short year, const char *nick,
 		const char *email, const char *msg) {
-	struct gaim_connection *gc = find_gaim_conn_by_icq_link(link);
+	struct gaim_connection *gc = link->icq_UserData;
 	char *who = g_strdup_printf("ICQ Mail Express: %s (%s)", nick, email);
 	char *what = g_malloc(BUF_LONG);
 	g_snprintf(what, BUF_LONG, "%s", msg);
@@ -317,6 +298,7 @@
 	link->icq_InvalidUIN = icq_invalid_uin;
 	link->icq_Log = icq_do_log;
 	link->icq_RequestNotify = icq_req_not;
+	link->icq_UserData = gc;
 
 	if (proxytype == PROXY_SOCKS5)
 		icq_SetProxy(link, proxyhost, proxyport, proxyuser[0], proxyuser, proxypass);