changeset 12735:da9fd490cef9

[gaim-migrate @ 15080] bugfix when sending multiple inline images over sametime committer: Tailor Script <tailor@pidgin.im>
author Christopher O'Brien <siege@pidgin.im>
date Thu, 05 Jan 2006 16:28:22 +0000
parents 0f499f27b29a
children f49d49444c68
files src/protocols/sametime/sametime.c
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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);
 }