Changeset f2d72128 for stylefunc.c


Ignore:
Timestamp:
Jan 16, 2008, 2:59:06 AM (13 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
ba2ca66, 61abb18
Parents:
ff13a6f
Message:
Move oneline style to perl. closes 43
File:
1 edited

Legend:

Unmodified
Added
Removed
  • stylefunc.c

    r0b7082c rf2d72128  
    220220  }
    221221}
    222 
    223 void owl_stylefunc_oneline(owl_fmtext *fm, owl_message *m)
    224 {
    225   char *tmp;
    226   char *baseformat="%s %-13.13s %-11.11s %-12.12s ";
    227   char *sender, *recip;
    228 #ifdef HAVE_LIBZEPHYR
    229   ZNotice_t *n;
    230 #endif
    231 
    232   sender=short_zuser(owl_message_get_sender(m));
    233   recip=short_zuser(owl_message_get_recipient(m));
    234  
    235   if (owl_message_is_type_zephyr(m)) {
    236 #ifdef HAVE_LIBZEPHYR
    237     n=owl_message_get_notice(m);
    238    
    239     owl_fmtext_append_spaces(fm, OWL_TAB);
    240 
    241     if (owl_message_is_loginout(m)) {
    242       char *host, *tty;
    243      
    244       host=owl_message_get_attribute_value(m, "loginhost");
    245       tty=owl_message_get_attribute_value(m, "logintty");
    246 
    247       if (owl_message_is_login(m)) {
    248         tmp=owl_sprintf(baseformat, "<", owl_message_is_pseudo(m)?"LOGIN-P":"LOGIN", "", sender);
    249         owl_fmtext_append_normal(fm, tmp);
    250         owl_free(tmp);
    251       } else if (owl_message_is_logout(m)) {
    252         tmp=owl_sprintf(baseformat, "<", owl_message_is_pseudo(m)?"LOGOUT-P":"LOGOUT", "", sender);
    253         owl_fmtext_append_normal(fm, tmp);
    254         owl_free(tmp);
    255       }
    256 
    257       owl_fmtext_append_normal(fm, "at ");
    258       owl_fmtext_append_normal(fm, host ? host : "");
    259       owl_fmtext_append_normal(fm, " ");
    260       owl_fmtext_append_normal(fm, tty ? tty : "");
    261       owl_fmtext_append_normal(fm, "\n");
    262 
    263     } else if (owl_message_is_ping(m)) {
    264       tmp=owl_sprintf(baseformat, "<", "PING", "", sender);
    265       owl_fmtext_append_normal(fm, tmp);
    266       owl_fmtext_append_normal(fm, "\n");
    267       owl_free(tmp);
    268 
    269     } else {
    270       if (owl_message_is_direction_in(m)) {
    271         tmp=owl_sprintf(baseformat, "<", owl_message_get_class(m), owl_message_get_instance(m), sender);
    272       } else if (owl_message_is_direction_out(m)) {
    273         tmp=owl_sprintf(baseformat, ">", owl_message_get_class(m), owl_message_get_instance(m), recip);
    274       } else {
    275         tmp=owl_sprintf(baseformat, "-", owl_message_get_class(m), owl_message_get_instance(m), sender);
    276       }
    277       owl_fmtext_append_normal(fm, tmp);
    278       if (tmp) owl_free(tmp);
    279      
    280       tmp=owl_strdup(owl_message_get_body(m));
    281       owl_text_tr(tmp, '\n', ' ');
    282       owl_fmtext_append_ztext(fm, tmp);
    283       owl_fmtext_append_normal(fm, "\n");
    284       if (tmp) owl_free(tmp);
    285     }
    286      
    287     /* make personal messages bold for smaat users */
    288     if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES) &&
    289         owl_message_is_personal(m) &&
    290         owl_message_is_direction_in(m)) {
    291       owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD);
    292     }
    293 
    294     owl_free(sender);
    295     owl_free(recip);
    296 #endif
    297   } else if (owl_message_is_type_aim(m)) {
    298     owl_fmtext_append_spaces(fm, OWL_TAB);
    299     if (owl_message_is_login(m)) {
    300       tmp=owl_sprintf(baseformat, "<", "AIM LOGIN", "", owl_message_get_sender(m));
    301       owl_fmtext_append_normal(fm, tmp);
    302       owl_fmtext_append_normal(fm, "\n");
    303       if (tmp) owl_free(tmp);
    304     } else if (owl_message_is_logout(m)) {
    305       tmp=owl_sprintf(baseformat, "<", "AIM LOGOUT", "", owl_message_get_sender(m));
    306       owl_fmtext_append_normal(fm, tmp);
    307       owl_fmtext_append_normal(fm, "\n");
    308       if (tmp) owl_free(tmp);
    309     } else {
    310       if (owl_message_is_direction_in(m)) {
    311         tmp=owl_sprintf(baseformat, "<", "AIM", "", owl_message_get_sender(m));
    312         owl_fmtext_append_normal(fm, tmp);
    313         if (tmp) owl_free(tmp);
    314       } else if (owl_message_is_direction_out(m)) {
    315         tmp=owl_sprintf(baseformat, ">", "AIM", "", owl_message_get_recipient(m));
    316         owl_fmtext_append_normal(fm, tmp);
    317         if (tmp) owl_free(tmp);
    318       }
    319      
    320       tmp=owl_strdup(owl_message_get_body(m));
    321       owl_text_tr(tmp, '\n', ' ');
    322       owl_fmtext_append_normal(fm, tmp);
    323       owl_fmtext_append_normal(fm, "\n");
    324       if (tmp) owl_free(tmp);
    325 
    326       /* make personal messages bold for smaat users */
    327       if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES) && owl_message_is_direction_in(m)) {
    328         owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD);
    329       }
    330     }
    331   } else if (owl_message_is_type_admin(m)) {
    332     owl_fmtext_append_spaces(fm, OWL_TAB);
    333     owl_fmtext_append_normal(fm, "< ADMIN                                  ");
    334    
    335     tmp=owl_strdup(owl_message_get_body(m));
    336     owl_text_tr(tmp, '\n', ' ');
    337     owl_fmtext_append_normal(fm, tmp);
    338     owl_fmtext_append_normal(fm, "\n");
    339     if (tmp) owl_free(tmp);
    340   } else {
    341     owl_fmtext_append_spaces(fm, OWL_TAB);
    342     owl_fmtext_append_normal(fm, "< LOOPBACK                               ");
    343    
    344     tmp=owl_strdup(owl_message_get_body(m));
    345     owl_text_tr(tmp, '\n', ' ');
    346     owl_fmtext_append_normal(fm, tmp);
    347     owl_fmtext_append_normal(fm, "\n");
    348     if (tmp) owl_free(tmp);
    349   }   
    350 
    351 }
Note: See TracChangeset for help on using the changeset viewer.