Bug #471079 (bnc) - Unable To Exclude Names
authorSankar P <psankar@novell.com>
Thu, 9 Sep 2010 05:06:23 +0000 (10:36 +0530)
committerBharath Acharya <abharath@novell.com>
Thu, 9 Sep 2010 05:06:23 +0000 (10:36 +0530)
Unable To Exclude Names From Email Groups.

Bug Report:
I have created a personal "On This Computer" email group with multiple people.
When I type in that group name it auto-completes and displays in the To: field
underlined.

If you right mouse click on that group you see a list of all people that are in
the group with checkboxes next to their name.  You are supposed to be able to
uncheck people from the group and they will not receive the message.  However,
people that you uncheck still receive the message.

addressbook/libebook/e-destination.c

index e28a627..e8066bf 100644 (file)
@@ -853,60 +853,51 @@ const gchar *
 e_destination_get_address (const EDestination *dest)
 {
        struct _EDestinationPrivate *priv;
+       CamelInternetAddress *addr = camel_internet_address_new ();
 
        g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
 
        priv = (struct _EDestinationPrivate *)dest->priv; /* cast out const */
 
-       if (priv->addr == NULL) {
-               CamelInternetAddress *addr = camel_internet_address_new ();
-
-               if (e_destination_is_evolution_list (dest)) {
-                       GList *iter = dest->priv->list_dests;
-
-                       while (iter) {
-                               EDestination *list_dest = E_DESTINATION (iter->data);
-
-                               if (!e_destination_empty (list_dest) && !list_dest->priv->ignored) {
-                                       const gchar *name, *email;
-                                       name = e_destination_get_name (list_dest);
-                                       email = e_destination_get_email (list_dest);
-
-                                       if (nonempty (name) && nonempty (email))
-                                               camel_internet_address_add (addr, name, email);
-                                       else if (nonempty (email))
-                                               camel_address_decode (CAMEL_ADDRESS (addr), email);
-                                       else /* this case loses i suppose, but there's
-                                               nothing we can do here */
-                                               camel_address_decode (CAMEL_ADDRESS (addr), name);
-                               }
-                               iter = g_list_next (iter);
-                       }
-
-                       priv->addr = camel_address_encode (CAMEL_ADDRESS (addr));
-               } else if (priv->raw) {
+       if (e_destination_is_evolution_list (dest)) {
+               GList *iter = dest->priv->list_dests;
 
-                       if (camel_address_unformat (CAMEL_ADDRESS (addr), priv->raw)) {
-                               priv->addr = camel_address_encode (CAMEL_ADDRESS (addr));
+               while (iter) {
+                       EDestination *list_dest = E_DESTINATION (iter->data);
+               
+                       if (!e_destination_empty (list_dest) && !list_dest->priv->ignored) {
+                               const char *name, *email;
+                               name = e_destination_get_name (list_dest);
+                               email = e_destination_get_email (list_dest);
+
+                               if (nonempty (name) && nonempty (email))
+                                       camel_internet_address_add (addr, name, email);
+                               else if (nonempty (email))
+                                       camel_address_decode (CAMEL_ADDRESS (addr), email);
+                               else /* this case loses i suppose, but there's
+                                       nothing we can do here */
+                                       camel_address_decode (CAMEL_ADDRESS (addr), name);
                        }
-               } else {
-                       const gchar *name, *email;
-                       name = e_destination_get_name (dest);
-                       email = e_destination_get_email (dest);
-
-                       if (nonempty (name) && nonempty (email))
-                               camel_internet_address_add (addr, name, email);
-                       else if (nonempty (email))
-                               camel_address_decode (CAMEL_ADDRESS (addr), email);
-                       else /* this case loses i suppose, but there's
-                               nothing we can do here */
-                               camel_address_decode (CAMEL_ADDRESS (addr), name);
-
-                       priv->addr = camel_address_encode (CAMEL_ADDRESS (addr));
-               }
-
-               g_object_unref (addr);
+                       iter = g_list_next (iter);
+               }               
+               priv->addr = camel_address_encode (CAMEL_ADDRESS (addr));
+       } else if (priv->raw) {
+               if (camel_address_unformat (CAMEL_ADDRESS (addr), priv->raw))
+                       priv->addr = camel_address_encode (CAMEL_ADDRESS (addr));
+       } else {
+               const char *name, *email;
+               name = e_destination_get_name (dest);
+               email = e_destination_get_email (dest);
+
+               if (nonempty (name) && nonempty (email))
+                       camel_internet_address_add (addr, name, email);
+               else if (nonempty (email))
+                       camel_address_decode (CAMEL_ADDRESS (addr), email);
+               else /* this case loses i suppose, but there's
+                       nothing we can do here */
+                       camel_address_decode (CAMEL_ADDRESS (addr), name);
        }
+       g_object_unref (addr);
 
        return priv->addr;
 }