Mercurial > prosody-hg
annotate tools/tb2err @ 13903:4af7d00a2966
MUC: occupant: refactor to allow storing more than just presence for a session
Previously a "session" (i.e. a full JID joined to a MUC) was stored as simply
a mapping of full JIDs->presence, contained within occupant objects (an
occupant object groups all sessions behind a certain nick in the MUC).
To enable developing GC3 and other features, it would be helpful if we can
store additional metadata when a client joins a room, for example, whether it
has opted out of receiving presence stanzas (a GC3 feature).
This changes the internal data structure, which shouldn't be used outside this
module, it adds a new :get_session() method, and modifies the :each_session()
iterator to return the session as an additional result (which should be
backwards compatible with code that just consumes the existing two results).
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 11 Nov 2024 12:47:01 +0000 |
| parents | 4aa4a51a7a77 |
| children |
| rev | line source |
|---|---|
|
13063
414952def2d3
tools/tb2err: Drop use of lua-any since it should run fine on any Lua
Kim Alvefur <zash@zash.se>
parents:
11191
diff
changeset
|
1 #!/usr/bin/env lua |
|
11191
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 -- traceback to errors.err for vim -q |
|
13064
b172db27ffed
tools/tb2err: Add some example usage in a comment
Kim Alvefur <zash@zash.se>
parents:
13063
diff
changeset
|
3 -- e.g. curl https://prosody.im/paste/xxx | tb2err > errors.err && vim -q |
|
b172db27ffed
tools/tb2err: Add some example usage in a comment
Kim Alvefur <zash@zash.se>
parents:
13063
diff
changeset
|
4 |
|
11191
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 local path_sep = package.config:sub(1,1); |
|
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 for line in io.lines() do |
|
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 local src, err = line:match("%s*(%S+)(:%d+: .*)") |
|
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 if src then |
|
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 src = src:gsub("\\", path_sep); |
|
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 local cut = src:match("/()core/") |
|
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 or src:match("/()net/") |
|
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 or src:match("/()util/") |
|
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 or src:match("/()modules/") |
|
13065
ab546c5977ed
tools/tb2err: Rewrite prosody-modules paths to ../modules
Kim Alvefur <zash@zash.se>
parents:
13064
diff
changeset
|
14 or src:match("/()prosody%-modules/") |
|
11191
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 or src:match("/()plugins/") |
|
13066
4aa4a51a7a77
tools/tb2err: Trim trailing whitespace
Kim Alvefur <zash@zash.se>
parents:
13065
diff
changeset
|
16 or src:match("/()prosody[ctl]*$") |
|
11191
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 if cut then |
|
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 src = src:sub(cut); |
|
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 end |
|
13065
ab546c5977ed
tools/tb2err: Rewrite prosody-modules paths to ../modules
Kim Alvefur <zash@zash.se>
parents:
13064
diff
changeset
|
20 src = src:gsub("prosody%-modules/", "../modules/") |
|
11191
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 src = src:gsub("^modules/", "plugins/") |
|
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 io.write(src, err, "\n"); |
|
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 end |
|
13e2ac7b5798
tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 end |
