Changeset 8b32593


Ignore:
Timestamp:
Jun 10, 2003, 9:15:15 PM (17 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:
b97fce8
Parents:
f14a7ee
Message:
Added the 'oneline' style
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    rbd3f232 r8b32593  
    154154  s=owl_malloc(sizeof(owl_style));
    155155  owl_style_create_internal(s, "basic", &owl_stylefunc_basic);
     156  owl_global_add_style(&g, s);
     157
     158  s=owl_malloc(sizeof(owl_style));
     159  owl_style_create_internal(s, "oneline", &owl_stylefunc_oneline);
    156160  owl_global_add_style(&g, s);
    157161
  • stylefunc.c

    rbd3f232 r8b32593  
    3434    owl_fmtext_append_normal(fm, OWL_TABSTR);
    3535   
    36     if (!strcasecmp(owl_message_get_opcode(m), "ping")) {
     36    if (owl_message_is_ping(m)) {
    3737      owl_fmtext_append_bold(fm, "PING");
    3838      owl_fmtext_append_normal(fm, " from ");
    3939      owl_fmtext_append_bold(fm, frombuff);
    4040      owl_fmtext_append_normal(fm, "\n");
    41     } else if (!strcasecmp(owl_message_get_class(m), "login")) {
     41    } else if (owl_message_is_loginout(m)) {
    4242      char *ptr, host[LINE], tty[LINE];
    4343      int len;
     
    4949      strncpy(tty, ptr, len);
    5050      tty[len]='\0';
    51      
    52       if (!strcasecmp(owl_message_get_opcode(m), "user_login")) {
     51
     52      if (owl_message_is_login(m)) {
    5353        owl_fmtext_append_bold(fm, "LOGIN");
    54       } else if (!strcasecmp(owl_message_get_opcode(m), "user_logout")) {
     54      } else if (owl_message_is_logout(m)) {
    5555        owl_fmtext_append_bold(fm, "LOGOUT");
    5656      }
     
    225225    owl_fmtext_append_normal(fm, OWL_TABSTR);
    226226   
    227     if (!strcasecmp(owl_message_get_opcode(m), "ping") && owl_message_is_private(m)) {
     227    if (owl_message_is_ping(m) && owl_message_is_private(m)) {
    228228      owl_fmtext_append_bold(fm, "PING");
    229229      owl_fmtext_append_normal(fm, " from ");
    230230      owl_fmtext_append_bold(fm, frombuff);
    231231      owl_fmtext_append_normal(fm, "\n");
    232     } else if (!strcasecmp(n->z_class, "login")) {
     232    } else if (owl_message_is_loginout(m)) {
    233233      char *ptr, host[LINE], tty[LINE];
    234234      int len;
     
    241241      tty[len]='\0';
    242242     
    243       if (!strcasecmp(n->z_opcode, "user_login")) {
     243      if (owl_message_is_login(m)) {
    244244        owl_fmtext_append_bold(fm, "LOGIN");
    245       } else if (!strcasecmp(n->z_opcode, "user_logout")) {
     245      } else if (owl_message_is_logout(m)) {
    246246        owl_fmtext_append_bold(fm, "LOGOUT");
    247247      }
     
    384384  }
    385385}
     386
     387void owl_stylefunc_oneline(owl_fmtext *fm, owl_message *m)
     388{
     389  char *tmp;
     390
     391  if (owl_message_is_type_zephyr(m)) {
     392    owl_fmtext_append_spaces(fm, OWL_TAB);
     393    if (owl_message_is_login(m)) {
     394      tmp=owl_sprintf("< %-15.15s %-15.15s %-12.12s ", "LOGIN", "", owl_message_get_sender(m));
     395      owl_fmtext_append_normal(fm, tmp);
     396      owl_fmtext_append_normal(fm, "\n");
     397      if (tmp) owl_free(tmp);
     398    } 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));
     405      owl_fmtext_append_normal(fm, tmp);
     406      owl_fmtext_append_normal(fm, "\n");
     407      if (tmp) owl_free(tmp);
     408    } else {
     409      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));
     446        owl_fmtext_append_normal(fm, tmp);
     447        if (tmp) owl_free(tmp);
     448      } else if (owl_message_is_direction_out(m)) {
     449        tmp=owl_sprintf("> %-15.15s %-15.15s %-12.12s ", "AIM", "", owl_message_get_recipient(m));
     450        owl_fmtext_append_normal(fm, tmp);
     451        if (tmp) owl_free(tmp);
     452      }
     453     
     454      tmp=owl_strdup(owl_message_get_body(m));
     455      owl_util_tr(tmp, '\n', ' ');
     456      owl_fmtext_append_normal(fm, tmp);
     457      owl_fmtext_append_normal(fm, "\n");
     458      if (tmp) owl_free(tmp);
     459    }
     460
     461    /* make personal messages bold for smaat users */
     462    if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) {
     463      owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD);
     464    }
     465  } else if (owl_message_is_type_admin(m)) {
     466    owl_fmtext_append_spaces(fm, OWL_TAB);
     467    owl_fmtext_append_normal(fm, "< ADMIN                                        ");
     468   
     469    tmp=owl_strdup(owl_message_get_body(m));
     470    owl_util_tr(tmp, '\n', ' ');
     471    owl_fmtext_append_normal(fm, tmp);
     472    owl_fmtext_append_normal(fm, "\n");
     473    if (tmp) owl_free(tmp);
     474  }
     475
     476}
  • variable.c

    rbd3f232 r8b32593  
    199199                      NULL, owl_variable_tty_set, NULL),
    200200
    201   OWLVAR_STRING_FULL( "style" /* %OwlVarStub */, "default", "name of the current formatting style", "",
     201  OWLVAR_STRING_FULL( "style" /* %OwlVarStub */, "default", "name of the current formatting style",
     202                      "This sets the current message formatting style. Possbile\n"
     203                      "values include 'default' 'basic' 'oneline' and if\n"
     204                      "available, 'perl'\n",
    202205                      NULL, owl_variable_style_set, NULL),
    203206
Note: See TracChangeset for help on using the changeset viewer.