[2997] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

Re: Realms and outgoing messages

daemon@ATHENA.MIT.EDU (Anders Kaseorg)
Thu Mar 24 02:20:04 2011

Date: Thu, 24 Mar 2011 02:20:01 -0400 (EDT)
From: Anders Kaseorg <andersk@MIT.EDU>
To: David A Benjamin <davidben@mit.edu>
cc: barnowl-dev@mit.edu
In-Reply-To: <alpine.DEB.1.10.1103171443400.22032@dr-wily.mit.edu>

>     When you zephyr multiple people without using -C, show one outgoing m=
essage per recipient.

Can this commit subject be shortened to at most 76 characters?

This would be more readable if the owl_function_make_outgoing_zephyr =E2=86=
=92=20
owl_function_add_outgoing_zephyrs refactoring was split from the behavior=
=20
change.

+  if (owl_zwrite_get_numrecips(z) > recip_index) {

recip_index < owl_zwrite_get_numrecips(z) would be more consistent.

>     In duplicated outgoing zephyrs only reply on the relevant recipient

+  } else if (recip_index < owl_list_get_size(&(z->recips))) {
+      g_string_append_c(buf, ' ');
+      owl_string_append_quoted_arg(buf, owl_list_get_element(&(z->recips),=
 recip_index));

Those two lines are 2 spaces overindented.  The parens in &(z->recips)=20
could go away.

>     Add owl_zwrite_get_recip_n_with_realm

+  if (strcmp(z->realm, "")) {
+    return g_strdup_printf("%s@%s", (const char *) owl_zwrite_get_recip_n(=
z, n), z->realm);
+  } else {
+    return g_strdup_printf("%s", (const char *) owl_zwrite_get_recip_n(z, =
n));
+  }

Using strcmp=E2=80=99s return as bool is confusing; =E2=80=98if (strcmp(z->=
realm, "") !=3D=20
0)=E2=80=99 or =E2=80=98if (realm[0])=E2=80=99 is clearer.

Those casts can die now.  Also, g_strdup_printf("%s", =E2=80=A6) is g_strdu=
p(=E2=80=A6).

>     Correctly compute the realm from zusers and zwrite

This commit does three things: add and use zuser_realm; rewrite=20
short_zuser and long_zuser; set the realm in=20
owl_message_create_from_zwrite.  Again, would have preferred to see it=20
split.

+    /* TODO: We should maybe munge this into the case above, as that compa=
rison
+     * is a little overly clever. It's also not clear this codepath ever r=
uns
+     * anyway. */

It runs if owl_zwrite_get_numrecips(z) =3D=3D 0 in=20
owl_function_add_outgoing_zephyrs, right?

(Does it really make sense to have a message with no recipients?  Should=20
those be rewritten to have recipient =E2=80=98=E2=80=99 or recipient =E2=80=
=98*=E2=80=99 or something so=20
we don=E2=80=99t have weird behavior differences between those cases?)

+    owl_message_set_realm(m, strcmp(realm, "") ? realm : owl_zephyr_get_re=
alm());

Same strcmp comment.

I think that=E2=80=99s all I have.

Anders

home help back first fref pref prev next nref lref last post