Changeset 85d1795 for zephyr.c


Ignore:
Timestamp:
Apr 16, 2007, 9:54:27 PM (14 years ago)
Author:
Alejandro R. Sedeño <asedeno@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:
d754b0a
Parents:
1d7e094
Message:
Change special casing rules to refer to default format strings instead
of senders.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zephyr.c

    rbb2c60d r85d1795  
    381381 * caller must free the return
    382382 */
    383 char *owl_zephyr_get_message(ZNotice_t *n)
     383char *owl_zephyr_get_message(ZNotice_t *n, owl_message *m)
    384384{
    385385  /* don't let ping messages have a body */
     
    388388  }
    389389
    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   }
    394390  /* 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
    401394    field3 = owl_zephyr_get_field(n, 3);
    402395    field4 = owl_zephyr_get_field(n, 4);
    403396
    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);
    405398    owl_free(field3);
    406399    owl_free(field4);
     
    410403  }
    411404  /* 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")) {
    418406    char *msg, *field1, *field2, *field3, *field4, *field5;
    419407   
     
    434422    }
    435423  }
    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  }
    438443}
    439444#endif
     
    450455  }
    451456
    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;
    454460    return("");
    455461  }
Note: See TracChangeset for help on using the changeset viewer.