webXMPP

Check-in [951cf42e72]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Stop scanning when you get an answer. Don't flag default fall-through as error.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:951cf42e72a90a0be384264fc943dec887bdce68e9b877c900f27fc083593a38
User & Date: vandys 2018-12-08 16:14:30
Context
2019-02-20
17:51
Initial work, accepting Mastodon pushes (can't get the d*mn server to hand us one, though). check-in: 9a029a23ed user: web tags: master, trunk
2018-12-08
16:14
Stop scanning when you get an answer. Don't flag default fall-through as error. check-in: 951cf42e72 user: vandys tags: master, trunk
15:23
Add time constraint and whitelist check-in: 3c0e84363c user: vandys tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tools/blacklist.py.

31
32
33
34
35
36
37

38
39
40
41
42
43
44
..
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
        obdict = args[1]
        callerid = str(obdict["LineIdentification"])
        for tup in self.constraints:
            if self.applies(tup, callerid):
                sys.stderr.write("%s Rejecting call from %s\n" %
                    (time.strftime("%m/%d %H:%M"), callerid))
                self.hangup(call)


    # See if a constraint applies
    def applies(self, tup, callerid):
        op = tup[0]

        # Always reject
        if op == "reject":
................................................................................
        if op == "after":
            if tm.tm_hour >= int(tup[1]):
                return True
        elif op == "before":
            if tm.tm_hour < int(tup[1]):
                return True

        sys.stderr.write("Unknown constraint: %s\n" % (tup,))
        # Default, don't bounce
        return False

    # (re-)Load blacklist/whitelist
    def reload(self):

        # Reload when needed







>







 







<







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
..
56
57
58
59
60
61
62

63
64
65
66
67
68
69
        obdict = args[1]
        callerid = str(obdict["LineIdentification"])
        for tup in self.constraints:
            if self.applies(tup, callerid):
                sys.stderr.write("%s Rejecting call from %s\n" %
                    (time.strftime("%m/%d %H:%M"), callerid))
                self.hangup(call)
                return

    # See if a constraint applies
    def applies(self, tup, callerid):
        op = tup[0]

        # Always reject
        if op == "reject":
................................................................................
        if op == "after":
            if tm.tm_hour >= int(tup[1]):
                return True
        elif op == "before":
            if tm.tm_hour < int(tup[1]):
                return True


        # Default, don't bounce
        return False

    # (re-)Load blacklist/whitelist
    def reload(self):

        # Reload when needed