- Timestamp:
- Dec 1, 2021, 2:57:54 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/user.go
r724 r731 783 783 784 784 func (u *user) checkNetwork(record *Network) error { 785 url, err := record.URL() 786 if err != nil { 787 return err 788 } 789 if url.User != nil { 790 return fmt.Errorf("%v:// URL must not have username and password information", url.Scheme) 791 } 792 if url.RawQuery != "" { 793 return fmt.Errorf("%v:// URL must not have query values", url.Scheme) 794 } 795 if url.Fragment != "" { 796 return fmt.Errorf("%v:// URL must not have a fragment", url.Scheme) 797 } 798 switch url.Scheme { 799 case "ircs", "irc+insecure": 800 if url.Host == "" { 801 return fmt.Errorf("%v:// URL must have a host", url.Scheme) 802 } 803 if url.Path != "" { 804 return fmt.Errorf("%v:// URL must not have a path", url.Scheme) 805 } 806 case "irc+unix", "unix": 807 if url.Host != "" { 808 return fmt.Errorf("%v:// URL must not have a host", url.Scheme) 809 } 810 if url.Path == "" { 811 return fmt.Errorf("%v:// URL must have a path", url.Scheme) 812 } 813 default: 814 return fmt.Errorf("unknown URL scheme %q", url.Scheme) 815 } 816 785 817 for _, net := range u.networks { 786 818 if net.GetName() == record.GetName() && net.ID != record.ID { … … 788 820 } 789 821 } 822 790 823 return nil 791 824 }
Note:
See TracChangeset
for help on using the changeset viewer.