comparison 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
comparison
equal deleted inserted replaced
4649:f04e2a5b637a 4650:4938d12f6d48
111 * 111 *
112 * @param buffer Buffer of data to checksum. Man I'd like to buff her... 112 * @param buffer Buffer of data to checksum. Man I'd like to buff her...
113 * @param bufsize Size of buffer. 113 * @param bufsize Size of buffer.
114 * @param prevcheck Previous checksum. 114 * @param prevcheck Previous checksum.
115 */ 115 */
116 faim_export fu32_t aim_oft_checksum(const unsigned char *buffer, int bufferlen, fu32_t prevcheck) 116 faim_export fu32_t aim_oft_checksum_chunk(const unsigned char *buffer, int bufferlen, fu32_t prevcheck)
117 { 117 {
118 fu32_t check = (prevcheck >> 16) & 0xffff, oldcheck; 118 fu32_t check = (prevcheck >> 16) & 0xffff, oldcheck;
119 int i; 119 int i;
120 unsigned short val; 120 unsigned short val;
121 121
134 check--; 134 check--;
135 } 135 }
136 check = ((check & 0x0000ffff) + (check >> 16)); 136 check = ((check & 0x0000ffff) + (check >> 16));
137 check = ((check & 0x0000ffff) + (check >> 16)); 137 check = ((check & 0x0000ffff) + (check >> 16));
138 return check << 16; 138 return check << 16;
139 }
140
141 faim_export fu32_t aim_oft_checksum_file(char *filename) {
142 FILE *fd;
143 fu32_t checksum = 0xffff0000;
144
145 if ((fd = fopen(filename, "rb"))) {
146 int bytes;
147 char buffer[1024];
148
149 while ((bytes = fread(buffer, 1, 1024, fd)))
150 checksum = aim_oft_checksum_chunk(buffer, bytes, checksum);
151 fclose(fd);
152 }
153
154 return checksum;
139 } 155 }
140 156
141 /** 157 /**
142 * Create a listening socket on a given port. 158 * Create a listening socket on a given port.
143 * 159 *