comparison src/protocols/oscar/oscar.c @ 9532:b27ab1b8395d

[gaim-migrate @ 10359] Fix bug 988882, submitted by Bj?rn Voigt. He also submitted a patch, but I like my way better. Anyhoo, thanks Bj?rn. Also committing some notes to myself because I'm too lazy to remove them and THEN commit. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 14 Jul 2004 22:47:20 +0000
parents 683660b4efeb
children e8611c712d0a
comparison
equal deleted inserted replaced
9531:06fe6ed7f63a 9532:b27ab1b8395d
508 default: 508 default:
509 tmp = NULL; 509 tmp = NULL;
510 break; 510 break;
511 } 511 }
512 if (tmp) 512 if (tmp)
513 g_string_append_printf(str, "%s%s", (bit == 1 ? "" : ", "), tmp); 513 g_string_append_printf(str, "%s%s", (*(str->str) == '\0' ? "" : ", "), tmp);
514 } 514 }
515 bit <<= 1; 515 bit <<= 1;
516 } 516 }
517 517
518 return g_string_free(str, FALSE); 518 return g_string_free(str, FALSE);
3069 3069
3070 if (!stat(iconfile, &st)) { 3070 if (!stat(iconfile, &st)) {
3071 char *buf = g_malloc(st.st_size); 3071 char *buf = g_malloc(st.st_size);
3072 file = fopen(iconfile, "rb"); 3072 file = fopen(iconfile, "rb");
3073 if (file) { 3073 if (file) {
3074 /* XXX - Use g_file_get_contents() */
3074 int len = fread(buf, 1, st.st_size, file); 3075 int len = fread(buf, 1, st.st_size, file);
3075 gaim_debug_info("oscar", 3076 gaim_debug_info("oscar",
3076 "Sending buddy icon to %s (%d bytes, " 3077 "Sending buddy icon to %s (%d bytes, "
3077 "%lu reported)\n", 3078 "%lu reported)\n",
3078 userinfo->sn, len, st.st_size); 3079 userinfo->sn, len, st.st_size);
4393 aim_ssi_delicon(od->sess); 4394 aim_ssi_delicon(od->sess);
4394 } else if (!stat(iconfile, &st)) { 4395 } else if (!stat(iconfile, &st)) {
4395 char *buf = g_malloc(st.st_size); 4396 char *buf = g_malloc(st.st_size);
4396 FILE *file = fopen(iconfile, "rb"); 4397 FILE *file = fopen(iconfile, "rb");
4397 if (file) { 4398 if (file) {
4399 /* XXX - Use g_file_get_contents()? */
4398 fread(buf, 1, st.st_size, file); 4400 fread(buf, 1, st.st_size, file);
4399 fclose(file); 4401 fclose(file);
4400 gaim_debug_info("oscar", 4402 gaim_debug_info("oscar",
4401 "Uploading icon to icon server\n"); 4403 "Uploading icon to icon server\n");
4402 aim_bart_upload(od->sess, buf, st.st_size); 4404 aim_bart_upload(od->sess, buf, st.st_size);
5198 5200
5199 if (iconfile && !stat(iconfile, &st)) { 5201 if (iconfile && !stat(iconfile, &st)) {
5200 FILE *file = fopen(iconfile, "rb"); 5202 FILE *file = fopen(iconfile, "rb");
5201 if (file) { 5203 if (file) {
5202 char *buf = g_malloc(st.st_size); 5204 char *buf = g_malloc(st.st_size);
5205 /* XXX - Use g_file_get_contents()? */
5203 fread(buf, 1, st.st_size, file); 5206 fread(buf, 1, st.st_size, file);
5204 fclose(file); 5207 fclose(file);
5205 5208
5206 args.iconlen = st.st_size; 5209 args.iconlen = st.st_size;
5207 args.iconsum = aimutil_iconsum(buf, st.st_size); 5210 args.iconsum = aimutil_iconsum(buf, st.st_size);
6525 aim_ssi_delicon(od->sess); 6528 aim_ssi_delicon(od->sess);
6526 } else if (!stat(iconfile, &st)) { 6529 } else if (!stat(iconfile, &st)) {
6527 char *buf = g_malloc(st.st_size); 6530 char *buf = g_malloc(st.st_size);
6528 FILE *file = fopen(iconfile, "rb"); 6531 FILE *file = fopen(iconfile, "rb");
6529 if (file) { 6532 if (file) {
6533 /* XXX - Use g_file_get_contents()? */
6530 fread(buf, 1, st.st_size, file); 6534 fread(buf, 1, st.st_size, file);
6531 fclose(file); 6535 fclose(file);
6532 gaim_debug_info("oscar", 6536 gaim_debug_info("oscar",
6533 "Uploading icon to icon server\n"); 6537 "Uploading icon to icon server\n");
6534 aim_bart_upload(od->sess, buf, st.st_size); 6538 aim_bart_upload(od->sess, buf, st.st_size);
7031 char *buf = g_malloc(st.st_size); 7035 char *buf = g_malloc(st.st_size);
7032 file = fopen(iconfile, "rb"); 7036 file = fopen(iconfile, "rb");
7033 if (file) { 7037 if (file) {
7034 md5_state_t *state; 7038 md5_state_t *state;
7035 char md5[16]; 7039 char md5[16];
7040 /* XXX - Use g_file_get_contents()? */
7036 int len = fread(buf, 1, st.st_size, file); 7041 int len = fread(buf, 1, st.st_size, file);
7037 fclose(file); 7042 fclose(file);
7038 state = g_malloc(sizeof(md5_state_t)); 7043 state = g_malloc(sizeof(md5_state_t));
7039 md5_init(state); 7044 md5_init(state);
7040 md5_append(state, buf, len); 7045 md5_append(state, buf, len);