Mercurial > pidgin.yaz
comparison src/protocols/oscar/oscar.c @ 2197:8f1ca76e46f5
[gaim-migrate @ 2207]
able to send out buddy icon now (i keep typing "buggy icon" - freudian slip?). just have to be able to choose it now.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 30 Aug 2001 02:37:36 +0000 |
parents | 016c5307f26b |
children | cff4fbe01c7b |
comparison
equal
deleted
inserted
replaced
2196:016c5307f26b | 2197:8f1ca76e46f5 |
---|---|
455 if (n->watcher > 0) | 455 if (n->watcher > 0) |
456 gaim_input_remove(n->watcher); | 456 gaim_input_remove(n->watcher); |
457 odata->direct_ims = g_slist_remove(odata->direct_ims, n); | 457 odata->direct_ims = g_slist_remove(odata->direct_ims, n); |
458 g_free(n); | 458 g_free(n); |
459 } | 459 } |
460 #if USE_PIXBUF | |
461 while (odata->hasicons) { | 460 while (odata->hasicons) { |
462 struct icon_req *n = odata->hasicons->data; | 461 struct icon_req *n = odata->hasicons->data; |
463 g_free(n->user); | 462 g_free(n->user); |
464 odata->hasicons = g_slist_remove(odata->hasicons, n); | 463 odata->hasicons = g_slist_remove(odata->hasicons, n); |
465 g_free(n); | 464 g_free(n); |
466 } | 465 } |
467 #endif | |
468 if (gc->inpa > 0) | 466 if (gc->inpa > 0) |
469 gaim_input_remove(gc->inpa); | 467 gaim_input_remove(gc->inpa); |
470 if (odata->cnpa > 0) | 468 if (odata->cnpa > 0) |
471 gaim_input_remove(odata->cnpa); | 469 gaim_input_remove(odata->cnpa); |
472 if (odata->paspa > 0) | 470 if (odata->paspa > 0) |
1282 ir->length = args->iconlength; | 1280 ir->length = args->iconlength; |
1283 ir->checksum = args->iconchecksum; | 1281 ir->checksum = args->iconchecksum; |
1284 ir->timestamp = args->iconstamp; | 1282 ir->timestamp = args->iconstamp; |
1285 } | 1283 } |
1286 | 1284 |
1285 if (gc->iconfile && (args->icbmflags & AIM_IMFLAGS_BUDDYREQ)) { | |
1286 FILE *file; | |
1287 struct stat st; | |
1288 | |
1289 if (!stat(gc->iconfile, &st)) { | |
1290 char *buf = g_malloc(st.st_size); | |
1291 file = fopen(gc->iconfile, "r"); | |
1292 if (file) { | |
1293 fread(buf, 1, st.st_size, file); | |
1294 aim_send_icon(sess, command->conn, userinfo->sn, buf, st.st_size, | |
1295 st.st_mtime, aim_iconsum(buf, st.st_size)); | |
1296 fclose(file); | |
1297 } | |
1298 g_free(buf); | |
1299 } | |
1300 } | |
1301 | |
1287 /* | 1302 /* |
1288 * Quickly convert it to eight bit format, replacing | 1303 * Quickly convert it to eight bit format, replacing |
1289 * non-ASCII UNICODE characters with their equivelent | 1304 * non-ASCII UNICODE characters with their equivelent |
1290 * HTML entity. | 1305 * HTML entity. |
1291 */ | 1306 */ |
2039 return aim_send_im_direct(odata->sess, dim->conn, message); | 2054 return aim_send_im_direct(odata->sess, dim->conn, message); |
2040 } else { | 2055 } else { |
2041 if (away) | 2056 if (away) |
2042 return aim_send_im(odata->sess, odata->conn, name, AIM_IMFLAGS_AWAY, message); | 2057 return aim_send_im(odata->sess, odata->conn, name, AIM_IMFLAGS_AWAY, message); |
2043 else { | 2058 else { |
2059 struct aim_sendimext_args args; | |
2060 | |
2044 int flags = AIM_IMFLAGS_ACK; | 2061 int flags = AIM_IMFLAGS_ACK; |
2045 #if USE_PIXBUF | 2062 |
2046 GSList *h = odata->hasicons; | 2063 GSList *h = odata->hasicons; |
2047 struct icon_req *ir = NULL; | 2064 struct icon_req *ir = NULL; |
2048 char *who = normalize(name); | 2065 char *who = normalize(name); |
2066 | |
2067 struct stat st; | |
2068 | |
2049 while (h) { | 2069 while (h) { |
2050 ir = h->data; | 2070 ir = h->data; |
2051 if (ir->request && !strcmp(who, ir->user)) | 2071 if (ir->request && !strcmp(who, ir->user)) |
2052 break; | 2072 break; |
2053 h = h->next; | 2073 h = h->next; |
2055 if (h) { | 2075 if (h) { |
2056 ir->request = FALSE; | 2076 ir->request = FALSE; |
2057 flags |= AIM_IMFLAGS_BUDDYREQ; | 2077 flags |= AIM_IMFLAGS_BUDDYREQ; |
2058 debug_printf("sending buddy icon request with message\n"); | 2078 debug_printf("sending buddy icon request with message\n"); |
2059 } | 2079 } |
2060 #endif | 2080 |
2061 return aim_send_im(odata->sess, odata->conn, name, flags, message); | 2081 if (gc->iconfile && !stat(gc->iconfile, &st)) { |
2082 FILE *file = fopen(gc->iconfile, "r"); | |
2083 if (file) { | |
2084 char *buf = g_malloc(st.st_size); | |
2085 fread(buf, 1, st.st_size, file); | |
2086 | |
2087 args.iconlen = st.st_size; | |
2088 args.iconsum = aim_iconsum(buf, st.st_size); | |
2089 args.iconstamp = st.st_mtime; | |
2090 | |
2091 flags |= AIM_IMFLAGS_HASICON; | |
2092 | |
2093 fclose(file); | |
2094 g_free(buf); | |
2095 } | |
2096 } | |
2097 | |
2098 args.destsn = name; | |
2099 args.msg = message; | |
2100 args.msglen = strlen(message); | |
2101 args.flags = flags; | |
2102 | |
2103 return aim_send_im_ext(odata->sess, odata->conn, &args); | |
2062 } | 2104 } |
2063 } | 2105 } |
2064 } | 2106 } |
2065 | 2107 |
2066 static void oscar_get_info(struct gaim_connection *g, char *name) { | 2108 static void oscar_get_info(struct gaim_connection *g, char *name) { |