Ejemplo n.º 1
0
 def extractDomain(self):
     if self.cuaddr.startswith("mailto:"):
         self.domain = extractEmailDomain(self.cuaddr)
     elif self.cuaddr.startswith("http://") or self.cuaddr.startswith("https://"):
         splits = self.cuaddr.split(":")[1][2:].split("/")
         self.domain = splits[0]
     else:
         self.domain = ""
Ejemplo n.º 2
0
 def extractDomain(self):
     if self.cuaddr.startswith("mailto:"):
         self.domain = extractEmailDomain(self.cuaddr)
     elif self.cuaddr.startswith("http://") or self.cuaddr.startswith("https://"):
         splits = self.cuaddr.split(":")[1][2:].split("/")
         self.domain = splits[0]
     else:
         self.domain = ""
Ejemplo n.º 3
0
    def test_extractEmailDomain(self):
        """
        Test that L{extractEmailDomain} returns the expected results.
        """

        data = (
            ("mailto:[email protected]", "example.com"),
            ("mailto:[email protected]?subject=bar", "example.com"),
            ("mailto:foo", ""),
            ("mailto:foo@", ""),
            ("http://foobar.com", ""),
        )

        for mailto, domain in data:
            self.assertEqual(extractEmailDomain(mailto), domain)
Ejemplo n.º 4
0
    def test_extractEmailDomain(self):
        """
        Test that L{extractEmailDomain} returns the expected results.
        """

        data = (
            ("mailto:[email protected]", "example.com"),
            ("mailto:[email protected]?subject=bar", "example.com"),
            ("mailto:foo", ""),
            ("mailto:foo@", ""),
            ("http://foobar.com", ""),
        )

        for mailto, domain in data:
            self.assertEqual(extractEmailDomain(mailto), domain)
Ejemplo n.º 5
0
    def matchCalendarUserAddress(cls, cuaddr):

        # Check for local address matches first
        if cuaddr.startswith("mailto:") and config.Scheduling[cls.serviceType()]["EmailDomain"]:
            addrDomain = extractEmailDomain(cuaddr)
            domain = config.Scheduling[cls.serviceType()]["EmailDomain"]
            if addrDomain == domain:
                return succeed(True)

        elif (cuaddr.startswith("http://") or cuaddr.startswith("https://")) and config.Scheduling[cls.serviceType()]["HTTPDomain"]:
            splits = cuaddr.split(":")[0][2:].split("?")
            domain = config.Scheduling[cls.serviceType()]["HTTPDomain"]
            if splits[0].endswith(domain):
                return succeed(True)

        elif cuaddr.startswith("/"):
            # Assume relative HTTP URL - i.e. on this server
            return succeed(True)

        # Do default match
        return super(ScheduleViaCalDAV, cls).matchCalendarUserAddress(cuaddr)
Ejemplo n.º 6
0
    def matchCalendarUserAddress(cls, cuaddr):

        # Check for local address matches first
        if cuaddr.startswith("mailto:") and config.Scheduling[cls.serviceType()]["EmailDomain"]:
            addrDomain = extractEmailDomain(cuaddr)
            domain = config.Scheduling[cls.serviceType()]["EmailDomain"]
            if addrDomain == domain:
                return succeed(True)

        elif (cuaddr.startswith("http://") or cuaddr.startswith("https://")) and config.Scheduling[cls.serviceType()]["HTTPDomain"]:
            splits = cuaddr.split(":")[0][2:].split("?")
            domain = config.Scheduling[cls.serviceType()]["HTTPDomain"]
            if splits[0].endswith(domain):
                return succeed(True)

        elif cuaddr.startswith("/"):
            # Assume relative HTTP URL - i.e. on this server
            return succeed(True)

        # Do default match
        return super(ScheduleViaCalDAV, cls).matchCalendarUserAddress(cuaddr)