changeset 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 1b6167be6e58
children ae190d00b06d
files ChangeLog src/protocols/silc/TODO src/protocols/silc/silc.c
diffstat 3 files changed, 58 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Dec 03 17:57:38 2005 +0000
+++ b/ChangeLog	Sat Dec 03 18:00:01 2005 +0000
@@ -107,6 +107,11 @@
 	* Support for buddy icons
 	* Jabber User Directory searching
 
+	SILC Features:
+	* Whiteboard support (Pekka Riikonen)
+	* Sending/receiving images in IMs (Pekka Riikonen)
+	* Cipher and HMAC selection support (Pekka Riikonen)
+
 	Other Protocol Changes:
 	* Bonjour (Rendezvous) protocol support (Juanjo Molinero Horno, Google
 	  Summer of Code)
@@ -114,7 +119,6 @@
 	  Code)
 	* SIP/SIMPLE support (Thomas Butter, Google Summer of Code)
 	* Sametime protocol support
-	* SILC whiteboard support (Pekka Riikonen)
 
 	Other Noteworthy Changes:
 	* UPnP and NAT traversal support (Adam J. Warrington, Google Summer of
--- a/src/protocols/silc/TODO	Sat Dec 03 17:57:38 2005 +0000
+++ b/src/protocols/silc/TODO	Sat Dec 03 18:00:01 2005 +0000
@@ -8,3 +8,7 @@
 	- Add joined channels to buddy list automatically (during
 	  session)
 	- Add joined channels to buddy list automatically permanently
+
+Buddy icon
+	- After SILC Toolkit 1.0.2 buddy icon support can be added
+	  (SILC_ATTERIBUTE_USER_ICON).
--- 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);