Changeset 87dfeb7 for perlconfig.c


Ignore:
Timestamp:
Mar 6, 2009, 6:31:40 PM (15 years ago)
Author:
Geoffrey Thomas <geofft@mit.edu>
Branches:
master, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
3b80321
Parents:
32f834a
git-author:
Geoffrey Thomas <geofft@mit.edu> (02/25/09 22:42:32)
git-committer:
Geoffrey Thomas <geofft@mit.edu> (03/06/09 18:31:40)
Message:
Populate the ZNotice_t in owl_perlconfig_hashref2message().

This lets you create zephyr-type messages from Perlspace by faking most of
the ZNotice struct, which the rest of the owl core tries to access.

Signed-off-by: Geoffrey Thomas <geofft@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perlconfig.c

    re8c6d8f r87dfeb7  
    129129   message2hashref and hashref2message. Currently we lose
    130130   zephyr-specific properties stored in the ZNotice_t
     131
     132   This has been somewhat addressed, but is still not lossless.
    131133 */
    132134owl_message * owl_perlconfig_hashref2message(SV *msg)
     
    173175      owl_message_set_attribute(m, "adminheader", "");
    174176  }
     177#ifdef HAVE_LIBZEPHYR
     178  if (owl_message_is_type_zephyr(m)) {
     179    ZNotice_t *n = &(m->notice);
     180    n->z_kind = ACKED;
     181    n->z_port = 0;
     182    n->z_auth = ZAUTH_NO;
     183    n->z_checked_auth = 0;
     184    n->z_class = owl_message_get_class(m);
     185    n->z_class_inst = owl_message_get_instance(m);
     186    n->z_opcode = owl_message_get_opcode(m);
     187    n->z_sender = owl_message_get_sender(m);
     188    n->z_recipient = owl_message_get_recipient(m);
     189    n->z_default_format = "[zephyr created from perl]";
     190    n->z_multinotice = "[zephyr created from perl]";
     191    n->z_num_other_fields = 0;
     192    n->z_message = owl_sprintf("%s%c%s", owl_message_get_zsig(m), '\0', owl_message_get_body(m));
     193    n->z_message_len = strlen(owl_message_get_zsig(m)) + strlen(owl_message_get_body(m)) + 1;
     194  }
     195#endif
    175196  return m;
    176197}
Note: See TracChangeset for help on using the changeset viewer.