Mercurial > pidgin
changeset 3048:e729c064bc1b
[gaim-migrate @ 3061]
Some Image send fixes, and elimination of some compile warnings. There are still far too many (read: more than zero)
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Fri, 15 Mar 2002 00:56:15 +0000 |
parents | 388230971b20 |
children | dd4d4c59a2a4 |
files | ChangeLog src/conversation.c src/dialogs.c src/list.c src/protocols/jabber/jabber.c src/protocols/oscar/oscar.c src/protocols/oscar/txqueue.c |
diffstat | 7 files changed, 38 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Mar 15 00:28:16 2002 +0000 +++ b/ChangeLog Fri Mar 15 00:56:15 2002 +0000 @@ -17,6 +17,7 @@ * Buddylist tab placement option (Thanks Jason Willis) * Protocol specific smiley faces * Italian translation added + * IM Image sending version 0.53 (02/28/2002): * Updated Polish Translation (thanks Przemyslaw Sulek)
--- a/src/conversation.c Fri Mar 15 00:28:16 2002 +0000 +++ b/src/conversation.c Fri Mar 15 00:56:15 2002 +0000 @@ -1092,9 +1092,10 @@ g_snprintf(buf, limit, "%s", buffy); g_free(buffy); } - + if (!c->is_chat) { char *buffy; + gboolean binary = FALSE; buffy = g_strdup(buf); plugin_event(event_im_displayed_sent, c->gc, c->name, &buffy, 0); @@ -1102,23 +1103,23 @@ int imflags = 0; if (c->check && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->check))) imflags = IM_FLAG_CHECKBOX; + if (c->images) { int id, offset; char *bigbuf; GSList *tmplist = c->images; id = 1; - length = strlen(buffy) + strlen("<BINARY></BINARY>"); - bigbuf = g_malloc(length); - g_snprintf(bigbuf, strlen(buffy)+strlen("<BINARY> ") + 1, "%s<BINARY>", buffy); - offset = strlen(buffy) + strlen("<BINARY>"); + while (tmplist) { FILE *imgfile; char *filename; struct stat st; char imgtag[1024]; + if (stat(tmplist->data, &st) != 0) { debug_printf("Could not stat %s\n", tmplist->data); - break; + tmplist = tmplist->next; + continue; } /* Here we check to make sure the user still wants to send the @@ -1130,18 +1131,29 @@ g_snprintf(imgtag, sizeof(imgtag), "<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">", filename, id, (int)st.st_size); - if (!strstr(buffy, imgtag)) { + + if (strstr(buffy, imgtag) == 0) { + debug_printf("Not sending image: %s\n", tmplist->data); tmplist = tmplist->next; continue; } + if (!binary) { + length = strlen(buffy) + strlen("<BINARY></BINARY>"); + bigbuf = g_malloc(length + 1); + g_snprintf(bigbuf, strlen(buffy) + strlen("<BINARY> ") + 1, + "%s<BINARY>", buffy); + offset = strlen(buffy) + strlen("<BINARY>"); + binary = TRUE; + } g_snprintf(imgtag, sizeof(imgtag), "<DATA ID=\"%d\" SIZE=\"%d\">", id, (int)st.st_size); length = length + strlen(imgtag) + st.st_size + strlen("</DATA>");; - bigbuf = g_realloc(bigbuf, length); + bigbuf = g_realloc(bigbuf, length + 1); if (!(imgfile = fopen(tmplist->data, "r"))) { debug_printf("Could not open %s\n", tmplist->data); + tmplist = tmplist->next; continue; } g_snprintf(bigbuf + offset, strlen(imgtag) + 1, "%s", imgtag); @@ -1153,9 +1165,12 @@ id++; tmplist = tmplist->next; } - - g_snprintf(bigbuf + offset, strlen("</BINARY>") + 1, "</BINARY>"); - err =serv_send_im(c->gc, c->name, bigbuf, length, imflags); + if (binary) { + g_snprintf(bigbuf + offset, strlen("</BINARY>") + 1, "</BINARY>"); + err =serv_send_im(c->gc, c->name, bigbuf, length, imflags); + } else { + err = serv_send_im(c->gc, c->name, buffy, -1, imflags); + } if (err > 0) { GSList *tempy = c->images; while (tempy) { @@ -1164,7 +1179,10 @@ } g_slist_free(tempy); c->images = NULL; - write_to_conv(c, bigbuf, WFLAG_SEND, NULL, time(NULL), length); + if (binary) + write_to_conv(c, bigbuf, WFLAG_SEND, NULL, time(NULL), length); + else + write_to_conv(c, buffy, WFLAG_SEND, NULL, time(NULL), -1); if (c->makesound && (sound_options & OPT_SOUND_SEND)) play_sound(SEND); if (im_options & OPT_IM_POPDOWN) @@ -1172,7 +1190,8 @@ } - g_free(bigbuf); + if (binary) + g_free(bigbuf); } else { err =serv_send_im(c->gc, c->name, buffy, -1, imflags); if (err > 0) {
--- a/src/dialogs.c Fri Mar 15 00:28:16 2002 +0000 +++ b/src/dialogs.c Fri Mar 15 00:56:15 2002 +0000 @@ -37,6 +37,7 @@ #include <netinet/in.h> #include <arpa/inet.h> #include <errno.h> +#include <math.h> #include <gtk/gtk.h> #include "gaim.h"
--- a/src/list.c Fri Mar 15 00:28:16 2002 +0000 +++ b/src/list.c Fri Mar 15 00:56:15 2002 +0000 @@ -372,7 +372,7 @@ nm[i++] = *tmp++; while (*tmp != ':' && *tmp) - *tmp++; + tmp++; if (*tmp == ':') *tmp++ = '\0';
--- a/src/protocols/jabber/jabber.c Fri Mar 15 00:28:16 2002 +0000 +++ b/src/protocols/jabber/jabber.c Fri Mar 15 00:56:15 2002 +0000 @@ -1602,7 +1602,7 @@ static void jabber_remove_buddy(struct gaim_connection *gc, char *name, char *group) { - xmlnode x, y; + xmlnode x; char *realwho; gjconn gjc = ((struct jabber_data *)gc->proto_data)->gjc; @@ -2802,40 +2802,6 @@ } /* - * Like gjab_reqauth(), only different - */ -static void gjab_reqregreqs(gjconn gjc) -{ - xmlnode x, y, z; - char *user; - - if (!gjc) - return; - - x = jutil_iqnew(JPACKET__GET, NS_REGISTER); - y = xmlnode_get_tag(x, "query"); - - xmlnode_put_attrib(x, "to", "jimsun.linxnet.com"); - /* - xmlnode_put_attrib(x, "from", "jseymour@jimsun.linxnet.com"); - */ - /* - user = gjc->user->user; - - if (user) { - z = xmlnode_insert_tag(y, "username"); - xmlnode_insert_cdata(z, user, -1); - } - z = xmlnode_insert_tag(y, "password"); - xmlnode_insert_cdata(z, gjc->pass, -1); - */ - - debug_printf("jabber: registration packet: %s\n", xmlnode2str(x)); - gjab_send(gjc, x); - xmlnode_free(x); -} - -/* * Like jabber_handlestate(), only different */ static void jabber_handle_registration_state(gjconn gjc, int state)
--- a/src/protocols/oscar/oscar.c Fri Mar 15 00:28:16 2002 +0000 +++ b/src/protocols/oscar/oscar.c Fri Mar 15 00:56:15 2002 +0000 @@ -2423,6 +2423,7 @@ aim_send_typing(odata->sess, dim->conn, typing); return 0; } +static void oscar_ask_direct_im(struct gaim_connection *gc, char *name); static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int len, int imflags) { struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
--- a/src/protocols/oscar/txqueue.c Fri Mar 15 00:28:16 2002 +0000 +++ b/src/protocols/oscar/txqueue.c Fri Mar 15 00:56:15 2002 +0000 @@ -241,7 +241,7 @@ (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM)) { /* I strongly suspect that this is a horrible thing to do * and I feel really guilty doing it. */ - char *sn = aim_directim_getsn(conn); + const char *sn = aim_directim_getsn(conn); aim_rxcallback_t userfunc; while (count - wrote > 1024) { wrote = wrote + aim_send(conn->fd, bs->data + bs->offset + wrote, 1024);