Software /
code /
prosody
Annotate
util/bit53.lua @ 12525:8087f5357f53 0.12
mod_smacks: Fix bounce of stanzas directed to full JID on unclean disconnect
Fixes #1758
Introduced in 1ea01660c79a
In e62025f949f9 to and from was inverted since it changed from acting on
a reply to acting on the original stanza (or a clone thereof)
Unsure of the purpose of this check, you don't usually send stanzas to
your own full JID. Perhaps guarding against routing loops?
The check was present in the original commit of mod_smacks,
prosody-modules rev 9a7671720dec
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 27 May 2022 12:05:47 +0200 |
parent | 12365:af02b033bd7f |
rev | line source |
---|---|
10241
48f7cda4174d
util.bitops: Library to find appropriate bitwise library (closes #1395)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 -- Only the operators needed by net.websocket.frames are provided at this point |
48f7cda4174d
util.bitops: Library to find appropriate bitwise library (closes #1395)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 return { |
12365
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
3 band = function (a, b, ...) |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
4 local ret = a & b; |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
5 if ... then |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
6 for i = 1, select("#", ...) do |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
7 ret = ret & (select(i, ...)); |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
8 end |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
9 end |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
10 return ret; |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
11 end; |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
12 bor = function (a, b, ...) |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
13 local ret = a | b; |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
14 if ... then |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
15 for i = 1, select("#", ...) do |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
16 ret = ret | (select(i, ...)); |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
17 end |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
18 end |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
19 return ret; |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
20 end; |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
21 bxor = function (a, b, ...) |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
22 local ret = a ~ b; |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
23 if ... then |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
24 for i = 1, select("#", ...) do |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
25 ret = ret ~ (select(i, ...)); |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
26 end |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
27 end |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
28 return ret; |
af02b033bd7f
util.bit53: Support for more than 2 arguments, for compat with bit32
Matthew Wild <mwild1@gmail.com>
parents:
12358
diff
changeset
|
29 end; |
12358
d77d8fba44ad
util.bit53: Add left- and right shift operations
Kim Alvefur <zash@zash.se>
parents:
10241
diff
changeset
|
30 rshift = function (a, n) return a >> n end; |
d77d8fba44ad
util.bit53: Add left- and right shift operations
Kim Alvefur <zash@zash.se>
parents:
10241
diff
changeset
|
31 lshift = function (a, n) return a << n end; |
10241
48f7cda4174d
util.bitops: Library to find appropriate bitwise library (closes #1395)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
32 }; |
48f7cda4174d
util.bitops: Library to find appropriate bitwise library (closes #1395)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
33 |