Changeset 6401db3


Ignore:
Timestamp:
Dec 1, 2012, 5:16:21 PM (11 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10
Children:
4a6f8b0, 048b1ff, 472dcbe
Parents:
ccc182c
git-author:
David Benjamin <davidben@mit.edu> (11/14/12 15:22:41)
git-committer:
David Benjamin <davidben@mit.edu> (12/01/12 17:16:21)
Message:
Fix display of pseudologins

After b9517cf7ce2959a6e86a52d25a98b1d03df56d58, they lost fields and
auth keys. They're faked, so they don't really have fields or auth, but
put them in anyway to appease existing styles.

Reported-By: Kevin Chen <kchen@mit.edu>
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • perl/lib/BarnOwl/Message/Zephyr.pm

    rbf70350 r6401db3  
    5151    my ($m) = @_;
    5252    return undef if (!$m->is_loginout);
     53    return undef if (!defined($m->fields));
    5354    return $m->fields->[2];
    5455}
     
    5758    my ($m) = @_;
    5859    return undef if (!$m->is_loginout);
     60    return undef if (!defined($m->fields));
    5961    return $m->fields->[0];
    6062}
  • perlconfig.c

    rd199207 r6401db3  
    9292                                      owl_new_sv(owl_message_get_##field(m)), 0)
    9393
    94   if (owl_message_get_notice(m)) {
     94  if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) {
    9595    /* Handle zephyr-specific fields... */
    96     AV *av_zfields;
    97 
    98     av_zfields = newAV();
    99     for (f = owl_zephyr_first_raw_field(owl_message_get_notice(m)); f != NULL;
    100          f = owl_zephyr_next_raw_field(owl_message_get_notice(m), f)) {
    101       ptr=owl_zephyr_field_as_utf8(owl_message_get_notice(m), f);
    102       av_push(av_zfields, owl_new_sv(ptr));
    103       g_free(ptr);
     96    AV *av_zfields = newAV();
     97    if (owl_message_get_notice(m)) {
     98      for (f = owl_zephyr_first_raw_field(owl_message_get_notice(m)); f != NULL;
     99           f = owl_zephyr_next_raw_field(owl_message_get_notice(m), f)) {
     100        ptr = owl_zephyr_field_as_utf8(owl_message_get_notice(m), f);
     101        av_push(av_zfields, owl_new_sv(ptr));
     102        g_free(ptr);
     103      }
     104      (void)hv_store(h, "auth", strlen("auth"),
     105                     owl_new_sv(owl_zephyr_get_authstr(owl_message_get_notice(m))), 0);
     106    } else {
     107      /* Incoming zephyrs without a ZNotice_t are pseudo-logins. To appease
     108       * existing styles, put in bogus 'auth' and 'fields' keys. */
     109      (void)hv_store(h, "auth", strlen("auth"), owl_new_sv("NO"), 0);
    104110    }
    105111    (void)hv_store(h, "fields", strlen("fields"), newRV_noinc((SV*)av_zfields), 0);
    106 
    107     (void)hv_store(h, "auth", strlen("auth"),
    108                    owl_new_sv(owl_zephyr_get_authstr(owl_message_get_notice(m))),0);
    109112  }
    110113
Note: See TracChangeset for help on using the changeset viewer.