Mercurial > pidgin
diff src/protocols/silc/silc.c @ 12303:01f689cd7b49
[gaim-migrate @ 14607]
Patch from Pekka Riikonen to optimize image sending in SILC by checking for
images only if the GAIM_MESSAGE_IMAGES flag is set.
committer: Tailor Script <tailor@pidgin.im>
| author | Stu Tomlinson <stu@nosnilmot.com> |
|---|---|
| date | Sat, 03 Dec 2005 18:00:01 +0000 |
| parents | 029802981b81 |
| children | 33026deed1ce |
line wrap: on
line diff
--- a/src/protocols/silc/silc.c Sat Dec 03 17:57:38 2005 +0000 +++ b/src/protocols/silc/silc.c Sat Dec 03 18:00:01 2005 +0000 @@ -1021,6 +1021,7 @@ char *message; SilcUInt32 message_len; SilcMessageFlags flags; + GaimMessageFlags gflags; } *SilcGaimIM; static void @@ -1066,27 +1067,30 @@ #ifdef HAVE_SILCMIME_H /* Check for images */ - list = silcgaim_image_message(im->message, (SilcUInt32 *)&im->flags); - if (list) { - /* Send one or more MIME message. If more than one, they - are MIME fragments due to over large message */ - SilcBuffer buf; + if (im->gflags & GAIM_MESSAGE_IMAGES) { + list = silcgaim_image_message(im->message, (SilcUInt32 *)&im->flags); + if (list) { + /* Send one or more MIME message. If more than one, they + are MIME fragments due to over large message */ + SilcBuffer buf; - silc_dlist_start(list); - while ((buf = silc_dlist_get(list)) != SILC_LIST_END) - silc_client_send_private_message(client, conn, - client_entry, im->flags, - buf->data, buf->len, - TRUE); - silc_mime_partial_free(list); - } else + silc_dlist_start(list); + while ((buf = silc_dlist_get(list)) != SILC_LIST_END) + silc_client_send_private_message(client, conn, + client_entry, im->flags, + buf->data, buf->len, + TRUE); + silc_mime_partial_free(list); + gaim_conv_im_write(GAIM_CONV_IM(convo), conn->local_entry->nickname, + im->message, 0, time(NULL)); + goto out; + } + } #endif - { - /* Send the message */ - silc_client_send_private_message(client, conn, client_entry, im->flags, - (unsigned char *)im->message, im->message_len, TRUE); - } + /* Send the message */ + silc_client_send_private_message(client, conn, client_entry, im->flags, + (unsigned char *)im->message, im->message_len, TRUE); gaim_conv_im_write(GAIM_CONV_IM(convo), conn->local_entry->nickname, im->message, 0, time(NULL)); goto out; @@ -1164,6 +1168,7 @@ im->message = g_strdup(message); im->message_len = strlen(im->message); im->flags = mflags; + im->gflags = flags; silc_client_get_clients(client, conn, nickname, NULL, silcgaim_send_im_resolved, im); silc_free(nickname); @@ -1173,29 +1178,34 @@ #ifdef HAVE_SILCMIME_H /* Check for images */ - list = silcgaim_image_message(message, &mflags); - if (list) { - /* Send one or more MIME message. If more than one, they - are MIME fragments due to over large message */ - SilcBuffer buf; + if (flags & GAIM_MESSAGE_IMAGES) { + list = silcgaim_image_message(message, &mflags); + if (list) { + /* Send one or more MIME message. If more than one, they + are MIME fragments due to over large message */ + SilcBuffer buf; - silc_dlist_start(list); - while ((buf = silc_dlist_get(list)) != SILC_LIST_END) - ret = - silc_client_send_private_message(client, conn, - clients[0], mflags, - buf->data, buf->len, - TRUE); - silc_mime_partial_free(list); - } else + silc_dlist_start(list); + while ((buf = silc_dlist_get(list)) != SILC_LIST_END) + ret = + silc_client_send_private_message(client, conn, + clients[0], mflags, + buf->data, buf->len, + TRUE); + silc_mime_partial_free(list); + g_free(tmp); + silc_free(nickname); + silc_free(clients); + return ret; + } + } #endif - { - /* Send private message directly */ - ret = silc_client_send_private_message(client, conn, clients[0], - mflags, - (unsigned char *)msg, - strlen(msg), TRUE); - } + + /* Send private message directly */ + ret = silc_client_send_private_message(client, conn, clients[0], + mflags, + (unsigned char *)msg, + strlen(msg), TRUE); g_free(tmp); silc_free(nickname);
