- Timestamp:
- Oct 26, 2003, 3:23:38 PM (20 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- bc08664
- Parents:
- 70b53ec
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
zephyr.c
r269ed34 re3d9c77 485 485 486 486 if (owl_global_is_smartstrip(&g)) { 487 to=owl_ util_smartstripped_user(owl_message_get_sender(m));487 to=owl_zephyr_smartstripped_user(owl_message_get_sender(m)); 488 488 } else { 489 489 to=owl_strdup(owl_message_get_sender(m)); … … 794 794 } 795 795 796 797 798 /* Strip a local realm fron the zephyr user name. 799 * The caller must free the return 800 */ 801 char *short_zuser(char *in) 802 { 803 char *out, *ptr; 804 805 out=owl_strdup(in); 806 ptr=strchr(out, '@'); 807 if (ptr) { 808 if (!strcasecmp(ptr+1, owl_zephyr_get_realm())) { 809 *ptr='\0'; 810 } 811 } 812 return(out); 813 } 814 815 /* Append a local realm to the zephyr user name if necessary. 816 * The caller must free the return. 817 */ 818 char *long_zuser(char *in) 819 { 820 char *ptr; 821 822 if (NULL != (ptr=strchr(in, '@'))) { 823 return owl_strdup(in); 824 } else { 825 return owl_sprintf("%s@%s", in, owl_zephyr_get_realm()); 826 } 827 } 828 829 830 /* strip out the instance from a zsender's principal. Preserves the 831 * realm if present. daemon.webzephyr is a special case. The 832 * caller must free the return 833 */ 834 char *owl_zephyr_smartstripped_user(char *in) 835 { 836 char *ptr, *realm, *out; 837 838 out=owl_strdup(in); 839 840 /* bail immeaditly if we don't have to do any work */ 841 ptr=strchr(in, '.'); 842 if (!strchr(in, '/') && !ptr) { 843 /* no '/' and no '.' */ 844 return(out); 845 } 846 if (ptr && strchr(in, '@') && (ptr > strchr(in, '@'))) { 847 /* There's a '.' but it's in the realm */ 848 return(out); 849 } 850 if (!strncasecmp(in, OWL_WEBZEPHYR_PRINCIPAL, strlen(OWL_WEBZEPHYR_PRINCIPAL))) { 851 return(out); 852 } 853 854 /* remove the realm from ptr, but hold on to it */ 855 realm=strchr(out, '@'); 856 if (realm) realm[0]='\0'; 857 858 /* strip */ 859 ptr=strchr(out, '.'); 860 if (!ptr) ptr=strchr(out, '/'); 861 ptr[0]='\0'; 862 863 /* reattach the realm if we had one */ 864 if (realm) { 865 strcat(out, "@"); 866 strcat(out, realm+1); 867 } 868 869 return(out); 870 }
Note: See TracChangeset
for help on using the changeset viewer.