From 8b4c4f6a5ad98a15aacdc415a9e1994030ac1335 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 3 May 2010 22:40:01 -0300 Subject: [PATCH] Added jmessage_new_copy_without_dests() to copy messages without copying the list of recipients. --- src/jinete/jmessage.cpp | 18 ++++++++++++++++++ src/jinete/jmessage.h | 1 + 2 files changed, 19 insertions(+) diff --git a/src/jinete/jmessage.cpp b/src/jinete/jmessage.cpp index aad13d2a1..4a6cdf2fb 100644 --- a/src/jinete/jmessage.cpp +++ b/src/jinete/jmessage.cpp @@ -107,6 +107,24 @@ JMessage jmessage_new_copy(const JMessage msg) return copy; } +JMessage jmessage_new_copy_without_dests(const JMessage msg) +{ + JMessage copy; + + assert(msg != NULL); + + copy = jnew(union jmessage, 1); + if (!copy) + return NULL; + + memcpy(copy, msg, sizeof(union jmessage)); + + copy->any.widgets = jlist_new(); + copy->any.used = false; + + return copy; +} + void jmessage_free(JMessage msg) { assert(msg != NULL); diff --git a/src/jinete/jmessage.h b/src/jinete/jmessage.h index aa1889d23..520924711 100644 --- a/src/jinete/jmessage.h +++ b/src/jinete/jmessage.h @@ -146,6 +146,7 @@ int ji_register_message_type(); JMessage jmessage_new(int type); JMessage jmessage_new_key_related(int type, int readkey_value); JMessage jmessage_new_copy(const JMessage msg); +JMessage jmessage_new_copy_without_dests(const JMessage msg); void jmessage_free(JMessage msg); void jmessage_add_dest(JMessage msg, JWidget widget);