Changeset 4e29ecb for message.c


Ignore:
Timestamp:
Mar 24, 2011, 4:56:24 PM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
3a3863e
Parents:
5d56a27
Message:
Add zuser_realm and use it

We do not consistently (or correctly) extract the realm from a zuser.
Add a function and use it instead of ad-hoc strchr munging.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • message.c

    ra5b5d00 r4e29ecb  
    775775  struct hostent *hent;
    776776#endif /* ZNOTICE_SOCKADDR */
    777   const char *ptr;
    778777  char *tmp, *tmp2;
    779778  int len;
     
    808807  owl_message_set_zsig(m, owl_zephyr_get_zsig(n, &len));
    809808
    810   if ((ptr=strchr(n->z_recipient, '@'))!=NULL) {
    811     owl_message_set_realm(m, ptr+1);
    812   } else {
    813     owl_message_set_realm(m, owl_zephyr_get_realm());
    814   }
     809  owl_message_set_realm(m, zuser_realm(n->z_recipient));
    815810
    816811  /* Set the "isloginout" attribute if it's a login message */
     
    915910{
    916911  char *longuser;
    917   const char *ptr;
    918912
    919913#ifdef HAVE_LIBZEPHYR
     
    944938  }
    945939
    946   if ((ptr=strchr(longuser, '@'))!=NULL) {
    947     owl_message_set_realm(m, ptr+1);
    948   } else {
    949     owl_message_set_realm(m, owl_zephyr_get_realm());
    950   }
     940  owl_message_set_realm(m, zuser_realm(longuser));
    951941
    952942  owl_message_set_body(m, "<uninitialized>");
Note: See TracChangeset for help on using the changeset viewer.