From 6bb00e3481a6dfb2d98454998ce57f4153b99b07 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 29 Oct 2018 21:04:32 +0100 Subject: CHANGES: Mention mod_csi --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index d43d316f..4d3f5d43 100644 --- a/CHANGES +++ b/CHANGES @@ -22,6 +22,7 @@ New features - mod\_muc\_mam (XEP-0313 in groupchats) - mod\_vcard\_legacy (XEP-0398) - mod\_vcard4 (XEP-0292) +- mod\_csi (XEP-0352) - New experimental network backend "epoll" 0.10.0 -- cgit v1.2.3 From 61151d4d82bbb8dbcd3103e8cae04afa20bf6fd7 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 29 Oct 2018 21:15:38 +0100 Subject: mod_csi_simple: Import modified version of mod_csi_pump from prosody-modules --- CHANGES | 2 +- plugins/mod_csi_simple.lua | 100 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 plugins/mod_csi_simple.lua diff --git a/CHANGES b/CHANGES index 4d3f5d43..a5c185cc 100644 --- a/CHANGES +++ b/CHANGES @@ -22,7 +22,7 @@ New features - mod\_muc\_mam (XEP-0313 in groupchats) - mod\_vcard\_legacy (XEP-0398) - mod\_vcard4 (XEP-0292) -- mod\_csi (XEP-0352) +- mod\_csi, mod\_csi\_simple (XEP-0352) - New experimental network backend "epoll" 0.10.0 diff --git a/plugins/mod_csi_simple.lua b/plugins/mod_csi_simple.lua new file mode 100644 index 00000000..1535edae --- /dev/null +++ b/plugins/mod_csi_simple.lua @@ -0,0 +1,100 @@ +-- Copyright (C) 2016-2018 Kim Alvefur +-- +-- This project is MIT/X11 licensed. Please see the +-- COPYING file in the source package for more information. +-- + +module:depends"csi" + +local jid = require "util.jid"; +local st = require "util.stanza"; +local dt = require "util.datetime"; +local new_queue = require "util.queue".new; + +local function new_pump(output, ...) + -- luacheck: ignore 212/self + local q = new_queue(...); + local flush = true; + function q:pause() + flush = false; + end + function q:resume() + flush = true; + return q:flush(); + end + local push = q.push; + function q:push(item) + local ok = push(self, item); + if not ok then + q:flush(); + output(item, self); + elseif flush then + return q:flush(); + end + return true; + end + function q:flush() + local item = self:pop(); + while item do + output(item, self); + item = self:pop(); + end + return true; + end + return q; +end + +local queue_size = module:get_option_number("csi_queue_size", 256); + +module:hook("csi-is-stanza-important", function (event) + local stanza = event.stanza; + local st_name = stanza.name; + if not st_name then return false; end + local st_type = stanza.attr.type; + if st_name == "presence" then + if st_type == nil or st_type == "unavailable" then + return false; + end + return true; + elseif st_name == "message" then + if st_type == "headline" then + return false; + end + local body = stanza:get_child_text("body"); + return body; + end + return true; +end, -1); + +module:hook("csi-client-inactive", function (event) + local session = event.origin; + if session.pump then + session.pump:pause(); + else + local bare_jid = jid.join(session.username, session.host); + local send = session.send; + session._orig_send = send; + local pump = new_pump(session.send, queue_size); + pump:pause(); + session.pump = pump; + function session.send(stanza) + if module:fire_event("csi-stanza-is-important", { stanza = stanza, session = session }) then + pump:flush(); + send(stanza); + else + stanza = st.clone(stanza); + stanza:add_direct_child(st.stanza("delay", {xmlns = "urn:xmpp:delay", from = bare_jid, stamp = dt.datetime()})); + pump:push(stanza); + end + return true; + end + end +end); + +module:hook("csi-client-active", function (event) + local session = event.origin; + if session.pump then + session.pump:resume(); + end +end); + -- cgit v1.2.3 From 8bc951e8e2145ef85418ab0c745a4cbe45be10bb Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 29 Oct 2018 21:50:40 +0100 Subject: prosody.cfg.lua.dist: Add mod_csi_simple --- prosody.cfg.lua.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/prosody.cfg.lua.dist b/prosody.cfg.lua.dist index a0fc6c9e..f3affc97 100644 --- a/prosody.cfg.lua.dist +++ b/prosody.cfg.lua.dist @@ -58,6 +58,7 @@ modules_enabled = { "ping"; -- Replies to XMPP pings with pongs "register"; -- Allow users to register on this server using a client and change passwords --"mam"; -- Store messages in an archive and allow users to access it + --"csi_simple"; -- Simple Mobile optimizations -- Admin interfaces "admin_adhoc"; -- Allows administration via an XMPP client that supports ad-hoc commands -- cgit v1.2.3 From 0a684bdf335335012a268a696efe4fd8c3c40f46 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 29 Oct 2018 21:33:01 +0100 Subject: prosody.cfg.lua.dist: Mention that mod_pep handles avatars --- prosody.cfg.lua.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prosody.cfg.lua.dist b/prosody.cfg.lua.dist index f3affc97..7c620d10 100644 --- a/prosody.cfg.lua.dist +++ b/prosody.cfg.lua.dist @@ -46,7 +46,7 @@ modules_enabled = { -- Not essential, but recommended "carbons"; -- Keep multiple clients in sync - "pep"; -- Enables users to publish their mood, activity, playing music and more + "pep"; -- Enables users to publish their avatar, mood, activity, playing music and more "private"; -- Private XML storage (for room bookmarks, etc.) "blocklist"; -- Allow users to block communications with other users "vcard"; -- Allow users to set vCards -- cgit v1.2.3 From e9458e4c875b892b6b1e8221d1339a57ed5f8b65 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 29 Oct 2018 16:07:42 +0100 Subject: prosody.cfg.lua.dist: Add mod_muc_mam to example MUC section --- prosody.cfg.lua.dist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/prosody.cfg.lua.dist b/prosody.cfg.lua.dist index 7c620d10..c888ac8b 100644 --- a/prosody.cfg.lua.dist +++ b/prosody.cfg.lua.dist @@ -198,6 +198,8 @@ VirtualHost "localhost" ---Set up a MUC (multi-user chat) room server on conference.example.com: --Component "conference.example.com" "muc" +--- Store MUC messages in an archive and allow users to access it +--modules_enabled = { "muc_mam" } ---Set up an external component (default component port is 5347) -- -- cgit v1.2.3 From f8eb580c6b958251d779ef60cd0548fd76fc131c Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 29 Oct 2018 22:04:58 +0100 Subject: prosody.cfg.lua.dist: Replace old vcard module with new ones --- prosody.cfg.lua.dist | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/prosody.cfg.lua.dist b/prosody.cfg.lua.dist index c888ac8b..b6ea2ecb 100644 --- a/prosody.cfg.lua.dist +++ b/prosody.cfg.lua.dist @@ -49,7 +49,8 @@ modules_enabled = { "pep"; -- Enables users to publish their avatar, mood, activity, playing music and more "private"; -- Private XML storage (for room bookmarks, etc.) "blocklist"; -- Allow users to block communications with other users - "vcard"; -- Allow users to set vCards + "vcard4"; -- User profiles (stored in PEP) + "vcard_legacy"; -- Conversion between legacy vCard and PEP Avatar, vcard -- Nice to have "version"; -- Replies to server version requests -- cgit v1.2.3 From 0ec2f1debd094977213c4fdb3f1cd75b3402176b Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 30 Oct 2018 12:24:48 +0000 Subject: spec/scansion: Add pep_publish_subscribe (fixes #1222) --- spec/scansion/pep_publish_subscribe.scs | 210 ++++++++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 spec/scansion/pep_publish_subscribe.scs diff --git a/spec/scansion/pep_publish_subscribe.scs b/spec/scansion/pep_publish_subscribe.scs new file mode 100644 index 00000000..e8080134 --- /dev/null +++ b/spec/scansion/pep_publish_subscribe.scs @@ -0,0 +1,210 @@ +# PEP publish, subscribe and publish-options + +[Client] Romeo + jid: pep-test-wjebo4kg@localhost + password: password + +[Client] Juliet + jid: pep-test-tqvqu_pv@localhost + password: password + +----- + +Romeo connects + +Romeo sends: + + + + +Romeo receives: + + + + +Romeo receives: + + + + +Romeo sends: + + + + +Romeo receives: + + + + +Juliet connects + +Juliet sends: + + + + +Juliet receives: + + + + +Juliet receives: + + + + +Juliet sends: + + + + +Juliet receives: + + + + +Romeo sends: + + +Romeo sends: + + +Romeo receives: + + +Romeo receives: + + +Juliet receives: + + +Juliet sends: + + +Juliet sends: + + +Juliet receives: + + +Juliet receives: + + +Romeo receives: + + +Romeo sends: + + +Romeo sends: + + +Romeo receives: + + +Juliet receives: + + +Juliet receives: + + +Juliet receives: + + +Juliet sends: + + +Juliet receives: + + +Juliet receives: + + +Romeo receives: + + +Romeo receives: + + +Romeo receives: + + +Juliet sends: + + +Romeo sends: + + +Romeo sends: + + +Romeo sends: + + +Romeo receives: + + +Romeo receives: + + +Romeo receives: + + +Juliet receives: + + +Romeo sends: + + +Romeo receives: + + +Romeo receives: + + +Romeo receives: + + +Romeo sends: + + +Romeo sends: + + +Romeo sends: + + +Juliet receives: + + +Juliet sends: + + +Juliet sends: + Beautiful CedarsThe SpinnersNot Quite Folk4 + +Juliet receives: + + +Juliet sends: + http://jabber.org/protocol/pubsub#publish-optionstruewhitelist + +Juliet receives: + + +Juliet sends: + + +Romeo receives: + Beautiful CedarsThe SpinnersNot Quite Folk4 + +Romeo sends: + + +Romeo receives: + Beautiful CedarsThe SpinnersNot Quite Folk4 + +Juliet disconnects + +Romeo disconnects -- cgit v1.2.3