diff src/protocols/oscar/ft.c @ 4650:4938d12f6d48

[gaim-migrate @ 4961] This is mostly just me cleaning up some of my mess. The one important change is... I set what is believed to be the UTF8 capability flag for ICQ. I'm hoping this will tell ICQ2002 and more recent that we are able to accept UTF8 messages. Please test this and let us know what happens. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 05 Mar 2003 05:10:47 +0000
parents 440d3d870b84
children c050edba7b83
line wrap: on
line diff
--- a/src/protocols/oscar/ft.c	Tue Mar 04 21:38:05 2003 +0000
+++ b/src/protocols/oscar/ft.c	Wed Mar 05 05:10:47 2003 +0000
@@ -113,7 +113,7 @@
  * @param bufsize Size of buffer.
  * @param prevcheck Previous checksum.
  */
-faim_export fu32_t aim_oft_checksum(const unsigned char *buffer, int bufferlen, fu32_t prevcheck)
+faim_export fu32_t aim_oft_checksum_chunk(const unsigned char *buffer, int bufferlen, fu32_t prevcheck)
 {
 	fu32_t check = (prevcheck >> 16) & 0xffff, oldcheck;
 	int i;
@@ -138,6 +138,22 @@
 	return check << 16;
 }
 
+faim_export fu32_t aim_oft_checksum_file(char *filename) {
+	FILE *fd;
+	fu32_t checksum = 0xffff0000;
+
+	if ((fd = fopen(filename, "rb"))) {
+		int bytes;
+		char buffer[1024];
+
+		while ((bytes = fread(buffer, 1, 1024, fd)))
+			checksum = aim_oft_checksum_chunk(buffer, bytes, checksum);
+		fclose(fd);
+	}
+
+	return checksum;
+}
+
 /**
  * Create a listening socket on a given port.
  *