Changeset 5a95b69 for stylefunc.c


Ignore:
Timestamp:
Dec 20, 2003, 1:35:36 PM (20 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
72836b5
Parents:
c8735aa
Message:
New code for getting users from .anyfile
Added the 'pseudologins' variable, and code to do it
new attributes 'pseudo' 'logintty' and 'loginhost'
File:
1 edited

Legend:

Unmodified
Added
Removed
  • stylefunc.c

    r97cd00be r5a95b69  
    4747      owl_fmtext_append_normal(fm, "\n");
    4848    } else if (owl_message_is_loginout(m)) {
    49       char *ptr, *host, *tty;
    50       int len;
    51 
    52       ptr=owl_zephyr_get_field(n, 1, &len);
    53       host=owl_malloc(len+10);
    54       strncpy(host, ptr, len);
    55       host[len]='\0';
    56 
    57       ptr=owl_zephyr_get_field(n, 3, &len);
    58       tty=owl_malloc(len+10);
    59       strncpy(tty, ptr, len);
    60       tty[len]='\0';
    61 
     49      char *host, *tty;
     50
     51      host=owl_message_get_attribute_value(m, "loginhost");
     52      tty=owl_message_get_attribute_value(m, "logintty");
     53     
    6254      if (owl_message_is_login(m)) {
    6355        owl_fmtext_append_bold(fm, "LOGIN");
    6456      } else if (owl_message_is_logout(m)) {
    6557        owl_fmtext_append_bold(fm, "LOGOUT");
     58      }
     59      if (owl_message_is_pseudo(m)) {
     60        owl_fmtext_append_bold(fm, " (PSEUDO)");
    6661      }
    6762      owl_fmtext_append_normal(fm, " for ");
     
    7065      owl_free(ptr);
    7166      owl_fmtext_append_normal(fm, " at ");
    72       owl_fmtext_append_normal(fm, host);
     67      owl_fmtext_append_normal(fm, host ? host : "");
    7368      owl_fmtext_append_normal(fm, " ");
    74       owl_fmtext_append_normal(fm, tty);
    75       owl_fmtext_append_normal(fm, "\n");
    76 
    77       owl_free(host);
    78       owl_free(tty);
     69      owl_fmtext_append_normal(fm, tty ? tty : "");
     70      owl_fmtext_append_normal(fm, "\n");
    7971    } else {
    8072      owl_fmtext_append_normal(fm, "From: ");
     
    266258      owl_fmtext_append_normal(fm, "\n");
    267259    } else if (owl_message_is_loginout(m)) {
    268       char *ptr, *host, *tty;
    269       int len;
    270 
    271       ptr=owl_zephyr_get_field(n, 1, &len);
    272       host=owl_malloc(len+10);
    273       strncpy(host, ptr, len);
    274       host[len]='\0';
    275 
    276       ptr=owl_zephyr_get_field(n, 3, &len);
    277       tty=owl_malloc(len+10);
    278       strncpy(tty, ptr, len);
    279       tty[len]='\0';
     260      char *host, *tty;
     261     
     262      host=owl_message_get_attribute_value(m, "loginhost");
     263      tty=owl_message_get_attribute_value(m, "logintty");
    280264     
    281265      if (owl_message_is_login(m)) {
     
    284268        owl_fmtext_append_bold(fm, "LOGOUT");
    285269      }
     270
     271      if (owl_message_is_pseudo(m)) owl_fmtext_append_bold(fm, " (PSEUDO)");
     272       
    286273      owl_fmtext_append_normal(fm, " for ");
    287274      ptr=short_zuser(owl_message_get_instance(m));
     
    289276      owl_free(ptr);
    290277      owl_fmtext_append_normal(fm, " at ");
    291       owl_fmtext_append_normal(fm, host);
     278      owl_fmtext_append_normal(fm, host ? host : "");
    292279      owl_fmtext_append_normal(fm, " ");
    293       owl_fmtext_append_normal(fm, tty);
     280      owl_fmtext_append_normal(fm, tty ? tty : "");
    294281      owl_fmtext_append_normal(fm, " ");
    295282      owl_fmtext_append_normal(fm, shorttimestr);
    296283      owl_fmtext_append_normal(fm, "\n");
    297 
    298       owl_free(host);
    299       owl_free(tty);
    300284    } else {
    301285      owl_fmtext_append_normal(fm, owl_message_get_class(m));
     
    482466
    483467    if (owl_message_is_loginout(m)) {
    484       char *ptr, *host, *tty;
    485       int len;
    486      
    487       ptr=owl_zephyr_get_field(n, 1, &len);
    488       host=owl_malloc(len+10);
    489       strncpy(host, ptr, len);
    490       host[len]='\0';
    491 
    492       ptr=owl_zephyr_get_field(n, 3, &len);
    493       tty=owl_malloc(len+10);
    494       strncpy(tty, ptr, len);
    495       tty[len]='\0';
     468      char *host, *tty;
     469     
     470      host=owl_message_get_attribute_value(m, "loginhost");
     471      tty=owl_message_get_attribute_value(m, "logintty");
    496472
    497473      if (owl_message_is_login(m)) {
    498         tmp=owl_sprintf(baseformat, "<", "LOGIN", "", sender);
     474        tmp=owl_sprintf(baseformat, "<", owl_message_is_pseudo(m)?"LOGIN-P":"LOGIN", "", sender);
    499475        owl_fmtext_append_normal(fm, tmp);
    500476        owl_free(tmp);
    501477      } else if (owl_message_is_logout(m)) {
    502         tmp=owl_sprintf(baseformat, "<", "LOGOUT", "", sender);
     478        tmp=owl_sprintf(baseformat, "<", owl_message_is_pseudo(m)?"LOGOUT-P":"LOGOUT", "", sender);
    503479        owl_fmtext_append_normal(fm, tmp);
    504480        owl_free(tmp);
     
    506482
    507483      owl_fmtext_append_normal(fm, "at ");
    508       owl_fmtext_append_normal(fm, host);
     484      owl_fmtext_append_normal(fm, host ? host : "");
    509485      owl_fmtext_append_normal(fm, " ");
    510       owl_fmtext_append_normal(fm, tty);
    511       owl_fmtext_append_normal(fm, "\n");
    512 
    513       owl_free(host);
    514       owl_free(tty);
     486      owl_fmtext_append_normal(fm, tty ? tty : "");
     487      owl_fmtext_append_normal(fm, "\n");
    515488
    516489    } else if (owl_message_is_ping(m)) {
     
    664637      owl_fmtext_append_normal(fm, "\n");
    665638    } else if (owl_message_is_loginout(m)) {
    666       char *ptr, *host, *tty;
    667       int len;
    668 
    669       ptr=owl_zephyr_get_field(n, 1, &len);
    670       host=owl_malloc(len+10);
    671       strncpy(host, ptr, len);
    672       host[len]='\0';
    673 
    674       ptr=owl_zephyr_get_field(n, 3, &len);
    675       tty=owl_malloc(len+10);
    676       strncpy(tty, ptr, len);
    677       tty[len]='\0';
     639      char *host, *tty;
     640     
     641      host=owl_message_get_attribute_value(m, "loginhost");
     642      tty=owl_message_get_attribute_value(m, "logintty");
    678643     
    679644      if (owl_message_is_login(m)) {
     
    682647        owl_fmtext_append_bold(fm, "LOGOUT");
    683648      }
     649      if (owl_message_is_pseudo(m)) owl_fmtext_append_bold(fm, " (PSEUDO)");
     650
    684651      owl_fmtext_append_normal(fm, " for ");
    685652      ptr=short_zuser(owl_message_get_instance(m));
     
    687654      owl_free(ptr);
    688655      owl_fmtext_append_normal(fm, " at ");
    689       owl_fmtext_append_normal(fm, host);
     656      owl_fmtext_append_normal(fm, host ? host : "");
    690657      owl_fmtext_append_normal(fm, " ");
    691       owl_fmtext_append_normal(fm, tty);
    692       owl_fmtext_append_normal(fm, "\n");
    693 
    694       owl_free(host);
    695       owl_free(tty);
     658      owl_fmtext_append_normal(fm, tty ? tty : "");
     659      owl_fmtext_append_normal(fm, "\n");
    696660    } else {
    697661      owl_fmtext_append_normal(fm, sender);
Note: See TracChangeset for help on using the changeset viewer.