Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zephyr.c

    r6201646 r1151f0b  
    354354  return(owl_strdup(""));
    355355}
    356 
    357 char *owl_zephyr_get_field_as_utf8(ZNotice_t *n, int j)
    358 {
    359   int i, count, save;
    360 
    361   /* If there's no message here, just run along now */
    362   if (n->z_message_len == 0)
    363     return(owl_strdup(""));
    364 
    365   count=save=0;
    366   for (i = 0; i < n->z_message_len; i++) {
    367     if (n->z_message[i]=='\0') {
    368       count++;
    369       if (count == j) {
    370         /* just found the end of the field we're looking for */
    371         return(owl_validate_or_convert(n->z_message + save));
    372       } else {
    373         save = i + 1;
    374       }
    375     }
    376   }
    377   /* catch the last field, which might not be null terminated */
    378   if (count == j - 1) {
    379     char *tmp, *out;
    380     tmp = owl_malloc(n->z_message_len-save+5);
    381     memcpy(tmp, n->z_message+save, n->z_message_len-save);
    382     tmp[n->z_message_len-save]='\0';
    383     out = owl_validate_or_convert(tmp);
    384     owl_free(tmp);
    385     return out;
    386   }
    387 
     356#else
     357char *owl_zephyr_get_field(void *n, int j)
     358{
    388359  return(owl_strdup(""));
    389 }
    390 #else
    391 char *owl_zephyr_get_field(void *n, int j)
    392 {
    393   return(owl_strdup(""));
    394 }
    395 char *owl_zephyr_get_field_as_utf8(ZNotice_t *n, int j)
    396 {
    397   return owl_zephyr_get_field(n, j);
    398360}
    399361#endif
     
    601563    }
    602564  } else if (!strcmp(retnotice->z_message, ZSRVACK_NOTSENT)) {
    603     if (strcasecmp(retnotice->z_class, "message")) {
    604       char buff[1024];
    605       owl_function_error("No one subscribed to class class %s", retnotice->z_class);
    606       sprintf(buff, "Could not send message to class %s: no one subscribed.\n", retnotice->z_class);
     565    #define BUFFLEN 1024
     566    if (retnotice->z_recipient == NULL
     567        || *retnotice->z_recipient == NULL
     568        || *retnotice->z_recipient == '@') {
     569      char buff[BUFFLEN];
     570      owl_function_error("No one subscribed to class %s", retnotice->z_class);
     571      snprintf(buff, BUFFLEN, "Could not send message to class %s: no one subscribed.\n", retnotice->z_class);
    607572      owl_function_adminmsg("", buff);
    608573    } else {
    609       char buff[1024];
     574      char buff[BUFFLEN];
    610575      tmp = short_zuser(retnotice->z_recipient);
    611       owl_function_error("%s: Not logged in or subscribing to messages.", tmp);
    612       sprintf(buff, "Could not send message to %s: not logged in or subscribing to messages.\n", tmp);
     576      owl_function_error("%s: Not logged in or subscribing.", tmp);
     577      snprintf(buff, BUFFLEN, "Could not send message to %s: not logged in or subscribing to", tmp);
     578      if(strcmp(retnotice->z_class, "message")) {
     579        snprintf(buff, BUFFLEN,
     580                 "%s class %s, instance %s.\n", buff,
     581                 retnotice->z_class,
     582                 retnotice->z_class_inst);
     583      } else {
     584        snprintf(buff, BUFFLEN,
     585                 "%s messages.\n", buff);
     586      }
    613587      owl_function_adminmsg("", buff);
    614588      owl_log_outgoing_zephyr_error(tmp, buff);
Note: See TracChangeset for help on using the changeset viewer.