Software /
code /
prosody
Annotate
plugins/mod_muc_unique.lua @ 13114:025c38ee885d
util.dependencies: Print tables itself to reduce number of imports
Rationale: See diffstat
When this module is imported, it ends up calling stty via term_width()
in util.human.io.table(). When this happens outside of a terminal, the
following message is sent to stdout:
stty: 'standard input': Inappropriate ioctl for device
Not importing this module avoids that.
Furthermore three is value in this module having minimal dependencies as
they might not be available when it does the checks.
Ref a1fed82c44b9
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 26 May 2023 21:18:27 +0200 |
parent | 12977:74b9e05af71e |
rev | line source |
---|---|
6091
3a1c39b31497
plugins/muc/mod_muc: Move Xep-0307 MUC unique to seperate file
daurnimator <quae@daurnimator.com>
parents:
diff
changeset
|
1 -- XEP-0307: Unique Room Names for Multi-User Chat |
12977
74b9e05af71e
plugins: Prefix module imports with prosody namespace
Kim Alvefur <zash@zash.se>
parents:
8878
diff
changeset
|
2 local st = require "prosody.util.stanza"; |
74b9e05af71e
plugins: Prefix module imports with prosody namespace
Kim Alvefur <zash@zash.se>
parents:
8878
diff
changeset
|
3 local unique_name = require "prosody.util.id".medium; |
6091
3a1c39b31497
plugins/muc/mod_muc: Move Xep-0307 MUC unique to seperate file
daurnimator <quae@daurnimator.com>
parents:
diff
changeset
|
4 module:add_feature "http://jabber.org/protocol/muc#unique" |
6409
5fd6c739e9bf
plugins/mod_muc_unique: Fix undefined global access (thanks Lance)
Waqas Hussain <waqas20@gmail.com>
parents:
6091
diff
changeset
|
5 module:hook("iq-get/host/http://jabber.org/protocol/muc#unique:unique", function(event) |
6091
3a1c39b31497
plugins/muc/mod_muc: Move Xep-0307 MUC unique to seperate file
daurnimator <quae@daurnimator.com>
parents:
diff
changeset
|
6 local origin, stanza = event.origin, event.stanza; |
3a1c39b31497
plugins/muc/mod_muc: Move Xep-0307 MUC unique to seperate file
daurnimator <quae@daurnimator.com>
parents:
diff
changeset
|
7 origin.send(st.reply(stanza) |
3a1c39b31497
plugins/muc/mod_muc: Move Xep-0307 MUC unique to seperate file
daurnimator <quae@daurnimator.com>
parents:
diff
changeset
|
8 :tag("unique", {xmlns = "http://jabber.org/protocol/muc#unique"}) |
8878
7c3e16fdaf1d
mod_muc_unique: Use util.id for more compact identifiers
Kim Alvefur <zash@zash.se>
parents:
6409
diff
changeset
|
9 :text(unique_name():lower()) |
6091
3a1c39b31497
plugins/muc/mod_muc: Move Xep-0307 MUC unique to seperate file
daurnimator <quae@daurnimator.com>
parents:
diff
changeset
|
10 ); |
3a1c39b31497
plugins/muc/mod_muc: Move Xep-0307 MUC unique to seperate file
daurnimator <quae@daurnimator.com>
parents:
diff
changeset
|
11 return true; |
3a1c39b31497
plugins/muc/mod_muc: Move Xep-0307 MUC unique to seperate file
daurnimator <quae@daurnimator.com>
parents:
diff
changeset
|
12 end,-1); |