Changeset 216e621
- Timestamp:
- Jan 11, 2008, 10:15:06 PM (17 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 0b7082c
- Parents:
- fe8cad8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
stylefunc.c
r9aba27b r216e621 221 221 } 222 222 223 void owl_stylefunc_default(owl_fmtext *fm, owl_message *m)224 {225 char *shorttimestr;226 #ifdef HAVE_LIBZEPHYR227 char *ptr, *zsigbuff, frombuff[LINE];228 ZNotice_t *n;229 #endif230 231 shorttimestr=owl_message_get_shorttimestr(m);232 233 if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) {234 #ifdef HAVE_LIBZEPHYR235 n=owl_message_get_notice(m);236 237 /* edit the from addr for printing */238 strcpy(frombuff, owl_message_get_sender(m));239 ptr=strchr(frombuff, '@');240 if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) {241 *ptr='\0';242 }243 244 /* set the message for printing */245 owl_fmtext_append_normal(fm, OWL_TABSTR);246 247 if (owl_message_is_ping(m) && owl_message_is_private(m)) {248 owl_fmtext_append_bold(fm, "PING");249 owl_fmtext_append_normal(fm, " from ");250 owl_fmtext_append_bold(fm, frombuff);251 owl_fmtext_append_normal(fm, "\n");252 } else if (owl_message_is_loginout(m)) {253 char *host, *tty;254 255 host=owl_message_get_attribute_value(m, "loginhost");256 tty=owl_message_get_attribute_value(m, "logintty");257 258 if (owl_message_is_login(m)) {259 owl_fmtext_append_bold(fm, "LOGIN");260 } else if (owl_message_is_logout(m)) {261 owl_fmtext_append_bold(fm, "LOGOUT");262 }263 264 if (owl_message_is_pseudo(m)) owl_fmtext_append_bold(fm, " (PSEUDO)");265 266 owl_fmtext_append_normal(fm, " for ");267 ptr=short_zuser(owl_message_get_instance(m));268 owl_fmtext_append_bold(fm, ptr);269 owl_free(ptr);270 owl_fmtext_append_normal(fm, " at ");271 owl_fmtext_append_normal(fm, host ? host : "");272 owl_fmtext_append_normal(fm, " ");273 owl_fmtext_append_normal(fm, tty ? tty : "");274 owl_fmtext_append_normal(fm, " ");275 owl_fmtext_append_normal(fm, shorttimestr);276 owl_fmtext_append_normal(fm, "\n");277 } else {278 owl_fmtext_append_normal(fm, owl_message_get_class(m));279 owl_fmtext_append_normal(fm, " / ");280 owl_fmtext_append_normal(fm, owl_message_get_instance(m));281 owl_fmtext_append_normal(fm, " / ");282 owl_fmtext_append_bold(fm, frombuff);283 if (strcasecmp(owl_message_get_realm(m), ZGetRealm())) {284 owl_fmtext_append_normal(fm, " {");285 owl_fmtext_append_normal(fm, owl_message_get_realm(m));286 owl_fmtext_append_normal(fm, "}");287 }288 if (strcmp(owl_message_get_opcode(m), "")) {289 owl_fmtext_append_normal(fm, " [");290 owl_fmtext_append_normal(fm, owl_message_get_opcode(m));291 owl_fmtext_append_normal(fm, "]");292 }293 294 owl_fmtext_append_normal(fm, " ");295 owl_fmtext_append_normal(fm, shorttimestr);296 297 /* stick on the zsig */298 zsigbuff=owl_malloc(strlen(owl_message_get_zsig(m))+30);299 owl_message_pretty_zsig(m, zsigbuff);300 owl_fmtext_append_normal(fm, " (");301 owl_fmtext_append_ztext(fm, zsigbuff);302 owl_fmtext_append_normal(fm, ")");303 owl_fmtext_append_normal(fm, "\n");304 owl_free(zsigbuff);305 306 owl_style_basic_format_body(fm, m);307 308 /* make private messages bold for smaat users */309 if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) {310 if (owl_message_is_personal(m)) {311 owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD);312 }313 }314 }315 316 #endif317 } else if (owl_message_is_type_zephyr(m) && owl_message_is_direction_out(m)) {318 char *zsigbuff, *foo;319 320 owl_fmtext_append_normal(fm, OWL_TABSTR);321 owl_fmtext_append_normal(fm, "Zephyr sent to ");322 foo=short_zuser(owl_message_get_recipient(m));323 owl_fmtext_append_normal(fm, foo);324 owl_free(foo);325 326 owl_fmtext_append_normal(fm, " ");327 owl_fmtext_append_normal(fm, shorttimestr);328 329 owl_fmtext_append_normal(fm, " (Zsig: ");330 331 zsigbuff=owl_malloc(strlen(owl_message_get_zsig(m))+30);332 owl_message_pretty_zsig(m, zsigbuff);333 owl_fmtext_append_ztext(fm, zsigbuff);334 owl_free(zsigbuff);335 336 owl_fmtext_append_normal(fm, ")");337 owl_fmtext_append_normal(fm, "\n");338 owl_style_basic_format_body(fm, m);339 } else if (owl_message_is_type_aim(m)) {340 if (owl_message_is_loginout(m)) {341 owl_fmtext_append_normal(fm, OWL_TABSTR);342 if (owl_message_is_login(m)) {343 owl_fmtext_append_bold(fm, "AIM LOGIN");344 } else {345 owl_fmtext_append_bold(fm, "AIM LOGOUT");346 }347 owl_fmtext_append_normal(fm, " for ");348 owl_fmtext_append_normal(fm, owl_message_get_sender(m));349 owl_fmtext_append_normal(fm, " ");350 owl_fmtext_append_normal(fm, shorttimestr);351 owl_fmtext_append_normal(fm, "\n");352 } else if (owl_message_is_direction_in(m)) {353 owl_fmtext_append_bold(fm, OWL_TABSTR);354 owl_fmtext_append_bold(fm, "AIM from ");355 owl_fmtext_append_bold(fm, owl_message_get_sender(m));356 357 owl_fmtext_append_normal(fm, " ");358 owl_fmtext_append_normal(fm, shorttimestr);359 360 owl_fmtext_append_bold(fm, "\n");361 owl_style_basic_format_body(fm, m);362 } else if (owl_message_is_direction_out(m)) {363 owl_fmtext_append_normal(fm, OWL_TABSTR);364 owl_fmtext_append_normal(fm, "AIM sent to ");365 owl_fmtext_append_normal(fm, owl_message_get_recipient(m));366 owl_fmtext_append_normal(fm, " ");367 owl_fmtext_append_normal(fm, shorttimestr);368 owl_fmtext_append_normal(fm, "\n");369 owl_style_basic_format_body(fm, m);370 }371 } else if (owl_message_is_type_admin(m)) {372 char *header;373 374 header=owl_message_get_attribute_value(m, "adminheader");375 376 owl_fmtext_append_normal(fm, OWL_TABSTR);377 owl_fmtext_append_bold(fm, "OWL ADMIN ");378 owl_fmtext_append_ztext(fm, header);379 owl_fmtext_append_normal(fm, "\n");380 owl_style_basic_format_body(fm, m);381 } else {382 char *header;383 384 header=owl_sprintf("%s from: %s to: %s",385 owl_message_get_type(m),386 owl_message_get_sender(m),387 owl_message_get_recipient(m));388 389 owl_fmtext_append_normal(fm, OWL_TABSTR);390 owl_fmtext_append_normal(fm, header);391 owl_fmtext_append_normal(fm, " ");392 owl_fmtext_append_normal(fm, shorttimestr);393 owl_fmtext_append_normal(fm, "\n");394 owl_style_basic_format_body(fm, m);395 }396 owl_free(shorttimestr);397 }398 399 223 void owl_stylefunc_oneline(owl_fmtext *fm, owl_message *m) 400 224 {
Note: See TracChangeset
for help on using the changeset viewer.