# HG changeset patch # User Eric Warmenhoven # Date 999139056 0 # Node ID 8f1ca76e46f57afa037daeaf2d68ad412f5ef8d5 # Parent 016c5307f26b083857b34e29e148dea7953057fe [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 diff -r 016c5307f26b -r 8f1ca76e46f5 src/multi.h --- a/src/multi.h Thu Aug 30 00:19:06 2001 +0000 +++ b/src/multi.h Thu Aug 30 02:37:36 2001 +0000 @@ -77,6 +77,9 @@ /* email notification (MSN and Yahoo) */ GtkWidget *email_win; GtkWidget *email_label; + + /* buddy icon file */ + char *iconfile; }; struct proto_user_opt { diff -r 016c5307f26b -r 8f1ca76e46f5 src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Thu Aug 30 00:19:06 2001 +0000 +++ b/src/protocols/oscar/oscar.c Thu Aug 30 02:37:36 2001 +0000 @@ -457,14 +457,12 @@ odata->direct_ims = g_slist_remove(odata->direct_ims, n); g_free(n); } -#if USE_PIXBUF while (odata->hasicons) { struct icon_req *n = odata->hasicons->data; g_free(n->user); odata->hasicons = g_slist_remove(odata->hasicons, n); g_free(n); } -#endif if (gc->inpa > 0) gaim_input_remove(gc->inpa); if (odata->cnpa > 0) @@ -1284,6 +1282,23 @@ ir->timestamp = args->iconstamp; } + if (gc->iconfile && (args->icbmflags & AIM_IMFLAGS_BUDDYREQ)) { + FILE *file; + struct stat st; + + if (!stat(gc->iconfile, &st)) { + char *buf = g_malloc(st.st_size); + file = fopen(gc->iconfile, "r"); + if (file) { + fread(buf, 1, st.st_size, file); + aim_send_icon(sess, command->conn, userinfo->sn, buf, st.st_size, + st.st_mtime, aim_iconsum(buf, st.st_size)); + fclose(file); + } + g_free(buf); + } + } + /* * Quickly convert it to eight bit format, replacing * non-ASCII UNICODE characters with their equivelent @@ -2041,11 +2056,16 @@ if (away) return aim_send_im(odata->sess, odata->conn, name, AIM_IMFLAGS_AWAY, message); else { + struct aim_sendimext_args args; + int flags = AIM_IMFLAGS_ACK; -#if USE_PIXBUF + GSList *h = odata->hasicons; struct icon_req *ir = NULL; char *who = normalize(name); + + struct stat st; + while (h) { ir = h->data; if (ir->request && !strcmp(who, ir->user)) @@ -2057,8 +2077,30 @@ flags |= AIM_IMFLAGS_BUDDYREQ; debug_printf("sending buddy icon request with message\n"); } -#endif - return aim_send_im(odata->sess, odata->conn, name, flags, message); + + if (gc->iconfile && !stat(gc->iconfile, &st)) { + FILE *file = fopen(gc->iconfile, "r"); + if (file) { + char *buf = g_malloc(st.st_size); + fread(buf, 1, st.st_size, file); + + args.iconlen = st.st_size; + args.iconsum = aim_iconsum(buf, st.st_size); + args.iconstamp = st.st_mtime; + + flags |= AIM_IMFLAGS_HASICON; + + fclose(file); + g_free(buf); + } + } + + args.destsn = name; + args.msg = message; + args.msglen = strlen(message); + args.flags = flags; + + return aim_send_im_ext(odata->sess, odata->conn, &args); } } }