Changeset b45293f for readconfig.c


Ignore:
Timestamp:
Oct 11, 2002, 11:56:23 PM (19 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
68b41b0
Parents:
2adaf1d
Message:
Outgoing messages now go through the config for formatting
File:
1 edited

Legend:

Unmodified
Added
Removed
  • readconfig.c

    r4b464a4 rb45293f  
    6262  /* create variables */
    6363  perl_get_sv("owl::id", TRUE);
     64  perl_get_sv("owl::type", TRUE);
     65  perl_get_sv("owl::direction", TRUE);
    6466  perl_get_sv("owl::class", TRUE);
    6567  perl_get_sv("owl::instance", TRUE);
     
    127129  int i, j, len;
    128130  char *ptr, *ptr2;
    129   ZNotice_t *n;
    130131
    131132  if (!owl_global_have_config(&g)) return("");
    132133
    133134  /* set owl::msg */
    134   n=owl_message_get_notice(m);
    135   ptr=owl_zephyr_get_message(n, &len);
     135  ptr=owl_message_get_body(m);
     136  len=strlen(ptr);
    136137  ptr2=owl_malloc(len+20);
    137138  memcpy(ptr2, ptr, len);
     
    144145
    145146  /* set owl::zsig */
    146   ptr=owl_zephyr_get_zsig(n, &len);
     147  ptr=owl_message_get_zsig(m);
     148  len=strlen(ptr);
    147149  if (len>0) {
    148150    ptr2=owl_malloc(len+20);
     
    165167  } else {
    166168    sv_setpv(perl_get_sv("owl::type", TRUE), "unknown");
     169  }
     170
     171  /* set owl::direction */
     172  if (owl_message_is_direction_in(m)) {
     173    sv_setpv(perl_get_sv("owl::direction", TRUE), "in");
     174  } else if (owl_message_is_direction_out(m)) {
     175    sv_setpv(perl_get_sv("owl::direction", TRUE), "out");
     176  } else if (owl_message_is_direction_none(m)) {
     177    sv_setpv(perl_get_sv("owl::direction", TRUE), "none");
     178  } else {
     179    sv_setpv(perl_get_sv("owl::direction", TRUE), "unknown");
    167180  }
    168181
     
    189202
    190203  /* set owl::fields */
    191   av_clear(perl_get_av("owl::fields", TRUE));
    192   j=owl_zephyr_get_num_fields(n);
    193   for (i=0; i<j; i++) {
    194     ptr=owl_zephyr_get_field(n, i+1, &len);
    195     ptr2=owl_malloc(len+10);
    196     memcpy(ptr2, ptr, len);
    197     ptr2[len]='\0';
    198     av_push(perl_get_av("owl::fields", TRUE), newSVpvn(ptr2, len));
    199     owl_free(ptr2);
     204  if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) {
     205    av_clear(perl_get_av("owl::fields", TRUE));
     206    j=owl_zephyr_get_num_fields(owl_message_get_notice(m));
     207    for (i=0; i<j; i++) {
     208      ptr=owl_zephyr_get_field(owl_message_get_notice(m), i+1, &len);
     209      ptr2=owl_malloc(len+10);
     210      memcpy(ptr2, ptr, len);
     211      ptr2[len]='\0';
     212      av_push(perl_get_av("owl::fields", TRUE), newSVpvn(ptr2, len));
     213      owl_free(ptr2);
     214    }
    200215  }
    201216
    202217  /* for backwards compatibilty, because I'm an idiot */
    203   av_clear(perl_get_av("fields", TRUE));
    204   j=owl_zephyr_get_num_fields(n);
    205   for (i=0; i<j; i++) {
    206     ptr=owl_zephyr_get_field(n, i+1, &len);
    207     ptr2=owl_malloc(len+10);
    208     memcpy(ptr2, ptr, len);
    209     ptr2[len]='\0';
    210     av_push(perl_get_av("fields", TRUE), newSVpvn(ptr2, len));
    211     owl_free(ptr2);
     218  if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) {
     219    av_clear(perl_get_av("fields", TRUE));
     220    j=owl_zephyr_get_num_fields(owl_message_get_notice(m));
     221    for (i=0; i<j; i++) {
     222      ptr=owl_zephyr_get_field(owl_message_get_notice(m), i+1, &len);
     223      ptr2=owl_malloc(len+10);
     224      memcpy(ptr2, ptr, len);
     225      ptr2[len]='\0';
     226      av_push(perl_get_av("fields", TRUE), newSVpvn(ptr2, len));
     227      owl_free(ptr2);
     228    }
    212229  }
    213230
Note: See TracChangeset for help on using the changeset viewer.