# HG changeset patch
# User Christopher O'Brien <siege@pidgin.im>
# Date 1136478502 0
# Node ID da9fd490cef9880c3608e4bbe652a449c038442e
# Parent  0f499f27b29addb52a11a057f7f28f188bb9ddad
[gaim-migrate @ 15080]
bugfix when sending multiple inline images over sametime

committer: Tailor Script <tailor@pidgin.im>

diff -r 0f499f27b29a -r da9fd490cef9 src/protocols/sametime/sametime.c
--- a/src/protocols/sametime/sametime.c	Thu Jan 05 05:56:13 2006 +0000
+++ b/src/protocols/sametime/sametime.c	Thu Jan 05 16:28:22 2006 +0000
@@ -3643,20 +3643,29 @@
 }
 
 
+static int mw_rand() {
+  static int seed = 0;
+
+  /* for diversity, not security. don't touch */
+  srand(time(NULL) ^ seed);
+  seed = rand();
+
+  return seed;
+}
+
+
 /** generates a random-ish content id string */
 static char *im_mime_content_id() {
-  srand(time(NULL));
   return g_strdup_printf("%03x@%05xmeanwhile",
-			 rand() & 0xfff, rand() & 0xfffff);
+			 mw_rand() & 0xfff, mw_rand() & 0xfffff);
 }
 
 
 /** generates a multipart/related content type with a random-ish
     boundary value */
 static char *im_mime_content_type() {
-  srand(time(NULL));
   return g_strdup_printf("multipart/related; boundary=related_MW%03x_%04x",
-                         rand() & 0xfff, rand() & 0xffff);
+                         mw_rand() & 0xfff, mw_rand() & 0xffff);
 }