Changeset 85d1795
- Timestamp:
- Apr 16, 2007, 9:54:27 PM (18 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:
- d754b0a
- Parents:
- 1d7e094
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
message.c
ra387d12e r85d1795 851 851 m->zwriteline=strdup(""); 852 852 853 /* set the body */854 tmp=owl_zephyr_get_message(n);855 if (owl_global_is_newlinestrip(&g)) {856 tmp2=owl_util_stripnewlines(tmp);857 owl_message_set_body(m, tmp2);858 owl_free(tmp2);859 } else {860 owl_message_set_body(m, tmp);861 }862 owl_free(tmp);863 864 #ifdef OWL_ENABLE_ZCRYPT865 /* if zcrypt is enabled try to decrypt the message */866 if (owl_global_is_zcrypt(&g) && !strcasecmp(n->z_opcode, "crypt")) {867 char *out;868 int ret;869 870 out=owl_malloc(strlen(owl_message_get_body(m))*16+20);871 ret=owl_zcrypt_decrypt(out, owl_message_get_body(m), owl_message_get_class(m), owl_message_get_instance(m));872 if (ret==0) {873 owl_message_set_body(m, out);874 } else {875 owl_free(out);876 }877 }878 #endif879 880 853 /* save the hostname */ 881 854 owl_function_debugmsg("About to do gethostbyaddr"); … … 886 859 owl_message_set_hostname(m, inet_ntoa(n->z_sender_addr)); 887 860 } 861 862 /* set the body */ 863 tmp=owl_zephyr_get_message(n, m); 864 if (owl_global_is_newlinestrip(&g)) { 865 tmp2=owl_util_stripnewlines(tmp); 866 owl_message_set_body(m, tmp2); 867 owl_free(tmp2); 868 } else { 869 owl_message_set_body(m, tmp); 870 } 871 owl_free(tmp); 872 873 #ifdef OWL_ENABLE_ZCRYPT 874 /* if zcrypt is enabled try to decrypt the message */ 875 if (owl_global_is_zcrypt(&g) && !strcasecmp(n->z_opcode, "crypt")) { 876 char *out; 877 int ret; 878 879 out=owl_malloc(strlen(owl_message_get_body(m))*16+20); 880 ret=owl_zcrypt_decrypt(out, owl_message_get_body(m), owl_message_get_class(m), owl_message_get_instance(m)); 881 if (ret==0) { 882 owl_message_set_body(m, out); 883 } else { 884 owl_free(out); 885 } 886 } 887 #endif 888 888 } 889 889 #else -
zephyr.c
rbb2c60d r85d1795 381 381 * caller must free the return 382 382 */ 383 char *owl_zephyr_get_message(ZNotice_t *n )383 char *owl_zephyr_get_message(ZNotice_t *n, owl_message *m) 384 384 { 385 385 /* don't let ping messages have a body */ … … 388 388 } 389 389 390 /* deal with MIT Athena OLC messages */391 if (!strcasecmp(n->z_sender, "olc.matisse@ATHENA.MIT.EDU")) {392 return(owl_zephyr_get_field(n, 1));393 }394 390 /* deal with MIT NOC messages */ 395 else if (!strcasecmp(n->z_sender, "rcmd.achilles@ATHENA.MIT.EDU")) { 396 /* $opcode service on $instance $3.\n$4 */ 397 char *msg, *opcode, *instance, *field3, *field4; 398 399 opcode = n->z_opcode; 400 instance = n->z_class_inst; 391 if (!strcasecmp(n->z_default_format, "@center(@bold(NOC Message))\n\n@bold(Sender:) $1 <$sender>\n@bold(Time: ) $time\n\n@italic($opcode service on $instance $3.) $4\n")) { 392 char *msg, *field3, *field4; 393 401 394 field3 = owl_zephyr_get_field(n, 3); 402 395 field4 = owl_zephyr_get_field(n, 4); 403 396 404 msg = owl_sprintf("%s service on %s %s\n%s", opcode, instance, field3, field4);397 msg = owl_sprintf("%s service on %s %s\n%s", n->z_opcode, n->z_class_inst, field3, field4); 405 398 owl_free(field3); 406 399 owl_free(field4); … … 410 403 } 411 404 /* deal with MIT Discuss messages */ 412 else if (!strcasecmp(n->z_sender, "daemon@ATHENA.MIT.EDU") && 413 !strcasecmp(n->z_class, "DISCUSS")) { 414 /*New transaction [$1] entered in $2 415 From: $3 ($5) 416 Subject: $4 */ 417 405 else if (!strcasecmp(n->z_default_format, "New transaction [$1] entered in $2\nFrom: $3 ($5)\nSubject: $4")) { 418 406 char *msg, *field1, *field2, *field3, *field4, *field5; 419 407 … … 434 422 } 435 423 } 436 437 return(owl_zephyr_get_field(n, 2)); 424 /* deal with MIT Moira messages */ 425 else if (!strcasecmp(n->z_default_format, "MOIRA $instance on $fromhost:\n $message\n")) { 426 char *msg, *field1; 427 428 field1 = owl_zephyr_get_field(n, 1); 429 430 msg = owl_sprintf("MOIRA %s on %s: %s", n->z_class_inst, owl_message_get_hostname(m), field1); 431 owl_free(field1); 432 if (msg) { 433 return msg; 434 } 435 } 436 437 if (owl_zephyr_get_num_fields(n) == 1) { 438 return(owl_zephyr_get_field(n, 1)); 439 } 440 else { 441 return(owl_zephyr_get_field(n, 2)); 442 } 438 443 } 439 444 #endif … … 450 455 } 451 456 452 /* No zsig for OLC messages */ 453 if (!strcasecmp(n->z_sender, "olc.matisse@ATHENA.MIT.EDU")) { 457 /* If there's only one field, no zsig */ 458 if (owl_zephyr_get_num_fields(n) == 1) { 459 *k=0; 454 460 return(""); 455 461 }
Note: See TracChangeset
for help on using the changeset viewer.