Changeset 5ea6fea for stylefunc.c


Ignore:
Timestamp:
Jun 10, 2003, 9:44:07 PM (22 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:
65e3901
Parents:
b97fce8
Message:
Made the oneline format a little more compact and
  stripped off local zephyr realsm
File:
1 edited

Legend:

Unmodified
Added
Removed
  • stylefunc.c

    r8b32593 r5ea6fea  
    388388{
    389389  char *tmp;
    390 
     390  char *baseformat="%s %-13.13s %-11.11s %-12.12s ";
     391  char *sender, *recip;
     392
     393  sender=short_zuser(owl_message_get_sender(m));
     394  recip=short_zuser(owl_message_get_recipient(m));
     395 
    391396  if (owl_message_is_type_zephyr(m)) {
    392397    owl_fmtext_append_spaces(fm, OWL_TAB);
    393398    if (owl_message_is_login(m)) {
    394       tmp=owl_sprintf("< %-15.15s %-15.15s %-12.12s ", "LOGIN", "", owl_message_get_sender(m));
     399      tmp=owl_sprintf(baseformat, "<", "LOGIN", "", sender);
     400      owl_fmtext_append_normal(fm, tmp);
     401      owl_fmtext_append_normal(fm, "\n");
     402      owl_free(tmp);
     403    } else if (owl_message_is_logout(m)) {
     404      tmp=owl_sprintf(baseformat, "<", "LOGOUT", "", sender);
     405      owl_fmtext_append_normal(fm, tmp);
     406      owl_fmtext_append_normal(fm, "\n");
     407      owl_free(tmp);
     408    } else if (owl_message_is_ping(m)) {
     409      tmp=owl_sprintf(baseformat, "<", "PING", "", sender);
     410      owl_fmtext_append_normal(fm, tmp);
     411      owl_fmtext_append_normal(fm, "\n");
     412      owl_free(tmp);
     413    } else {
     414      if (owl_message_is_direction_in(m)) {
     415        tmp=owl_sprintf(baseformat, "<", owl_message_get_class(m), owl_message_get_instance(m), sender);
     416      } else if (owl_message_is_direction_out(m)) {
     417        tmp=owl_sprintf(baseformat, ">", owl_message_get_class(m), owl_message_get_instance(m), recip);
     418      } else {
     419        tmp=owl_sprintf(baseformat, "-", owl_message_get_class(m), owl_message_get_instance(m), sender);
     420      }
     421      owl_fmtext_append_normal(fm, tmp);
     422      if (tmp) owl_free(tmp);
     423     
     424      tmp=owl_strdup(owl_message_get_body(m));
     425      owl_util_tr(tmp, '\n', ' ');
     426      owl_fmtext_append_normal(fm, tmp);
     427      owl_fmtext_append_normal(fm, "\n");
     428      if (tmp) owl_free(tmp);
     429    }
     430     
     431    /* make personal messages bold for smaat users */
     432    if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES) && owl_message_is_personal(m)) {
     433      owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD);
     434    }
     435
     436    owl_free(sender);
     437    owl_free(recip);
     438   
     439  } else if (owl_message_is_type_aim(m)) {
     440    owl_fmtext_append_spaces(fm, OWL_TAB);
     441    if (owl_message_is_login(m)) {
     442      tmp=owl_sprintf(baseformat, "<", "AIM LOGIN", "", owl_message_get_sender(m));
    395443      owl_fmtext_append_normal(fm, tmp);
    396444      owl_fmtext_append_normal(fm, "\n");
    397445      if (tmp) owl_free(tmp);
    398446    } else if (owl_message_is_logout(m)) {
    399       tmp=owl_sprintf("< %-15.15s %-15.15s %-12.12s ", "LOGOUT", "", owl_message_get_sender(m));
    400       owl_fmtext_append_normal(fm, tmp);
    401       owl_fmtext_append_normal(fm, "\n");
    402       if (tmp) owl_free(tmp);
    403     } else if (owl_message_is_ping(m)) {
    404       tmp=owl_sprintf("< %-15.15s %-15.15s %-12.12s ", "PING", "", owl_message_get_sender(m));
     447      tmp=owl_sprintf(baseformat, "<", "AIM LOGOUT", "", owl_message_get_sender(m));
    405448      owl_fmtext_append_normal(fm, tmp);
    406449      owl_fmtext_append_normal(fm, "\n");
     
    408451    } else {
    409452      if (owl_message_is_direction_in(m)) {
    410         tmp=owl_sprintf("< %-15.15s %-15.15s %-12.12s ", owl_message_get_class(m), owl_message_get_instance(m), owl_message_get_sender(m));
    411       } else if (owl_message_is_direction_out(m)) {
    412         tmp=owl_sprintf("> %-15.15s %-15.15s %-12.12s ", owl_message_get_class(m), owl_message_get_instance(m), owl_message_get_recipient(m));
    413       } else {
    414         tmp=owl_sprintf("- %-15.15s %-15.15s %-12.12s ", owl_message_get_class(m), owl_message_get_instance(m), owl_message_get_sender(m));
    415       }
    416       owl_fmtext_append_normal(fm, tmp);
    417       if (tmp) owl_free(tmp);
    418      
    419       tmp=owl_strdup(owl_message_get_body(m));
    420       owl_util_tr(tmp, '\n', ' ');
    421       owl_fmtext_append_normal(fm, tmp);
    422       owl_fmtext_append_normal(fm, "\n");
    423       if (tmp) owl_free(tmp);
    424     }
    425      
    426     /* make personal messages bold for smaat users */
    427     if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES) && owl_message_is_personal(m)) {
    428       owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD);
    429     }
    430    
    431   } else if (owl_message_is_type_aim(m)) {
    432     owl_fmtext_append_spaces(fm, OWL_TAB);
    433     if (owl_message_is_login(m)) {
    434       tmp=owl_sprintf("< %-15.15s %-15.15s %-12.12s ", "AIM LOGIN", "", owl_message_get_sender(m));
    435       owl_fmtext_append_normal(fm, tmp);
    436       owl_fmtext_append_normal(fm, "\n");
    437       if (tmp) owl_free(tmp);
    438     } else if (owl_message_is_logout(m)) {
    439       tmp=owl_sprintf("< %-15.15s %-15.15s %-12.12s ", "AIM LOGOUT", "", owl_message_get_sender(m));
    440       owl_fmtext_append_normal(fm, tmp);
    441       owl_fmtext_append_normal(fm, "\n");
    442       if (tmp) owl_free(tmp);
    443     } else {
    444       if (owl_message_is_direction_in(m)) {
    445         tmp=owl_sprintf("< %-15.15s %-15.15s %-12.12s ", "AIM", "", owl_message_get_sender(m));
     453        tmp=owl_sprintf(baseformat, "<", "AIM", "", owl_message_get_sender(m));
    446454        owl_fmtext_append_normal(fm, tmp);
    447455        if (tmp) owl_free(tmp);
    448456      } else if (owl_message_is_direction_out(m)) {
    449         tmp=owl_sprintf("> %-15.15s %-15.15s %-12.12s ", "AIM", "", owl_message_get_recipient(m));
     457        tmp=owl_sprintf(baseformat, ">", "AIM", "", owl_message_get_recipient(m));
    450458        owl_fmtext_append_normal(fm, tmp);
    451459        if (tmp) owl_free(tmp);
Note: See TracChangeset for help on using the changeset viewer.