aboutsummaryrefslogtreecommitdiffstats
path: root/util/stanza.lua
diff options
context:
space:
mode:
authorJonas Schäfer <jonas@wielicki.name>2021-05-08 16:31:48 +0200
committerJonas Schäfer <jonas@wielicki.name>2021-05-08 16:31:48 +0200
commitb3ec594dd44727296266a7d97c0899ad07a35efb (patch)
tree3f7c01f15b2f9a175e4eaaed7d67a5c6b837c3b2 /util/stanza.lua
parent93a2f1559d35edda4ccecc1682d3ee68645d2d50 (diff)
downloadprosody-b3ec594dd44727296266a7d97c0899ad07a35efb.tar.gz
prosody-b3ec594dd44727296266a7d97c0899ad07a35efb.zip
util.stanza: add at_top helper
This allows the user to detect whether the cursor is currently at the top of the stanza. This will be used by util.xmppstream to be able to port it over.
Diffstat (limited to 'util/stanza.lua')
-rw-r--r--util/stanza.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/util/stanza.lua b/util/stanza.lua
index 3d4e9e5a..8ec49a39 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -136,6 +136,10 @@ function stanza_mt:up()
return self;
end
+function stanza_mt:at_top()
+ return self.last_add == nil or #self.last_add == 0
+end
+
function stanza_mt:reset()
self.last_add = nil;
return self;