aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0060_pubsub.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2022-01-10 16:52:13 +0100
committerfiaxh <git@lightrise.org>2022-01-10 17:11:24 +0100
commitf2ef2bcfe7f3e5d1449285c1517df703af1221a4 (patch)
treea196c164a6a98bf1fc1c4f15b5d96077d1453802 /xmpp-vala/src/module/xep/0060_pubsub.vala
parent82a492b33f1232c26db75dbef2d94a800161d466 (diff)
downloaddino-f2ef2bcfe7f3e5d1449285c1517df703af1221a4.tar.gz
dino-f2ef2bcfe7f3e5d1449285c1517df703af1221a4.zip
Only process PEP messages from bare JIDs
Diffstat (limited to 'xmpp-vala/src/module/xep/0060_pubsub.vala')
-rw-r--r--xmpp-vala/src/module/xep/0060_pubsub.vala11
1 files changed, 10 insertions, 1 deletions
diff --git a/xmpp-vala/src/module/xep/0060_pubsub.vala b/xmpp-vala/src/module/xep/0060_pubsub.vala
index c8472576..02e35394 100644
--- a/xmpp-vala/src/module/xep/0060_pubsub.vala
+++ b/xmpp-vala/src/module/xep/0060_pubsub.vala
@@ -16,8 +16,9 @@ namespace Xmpp.Xep.Pubsub {
private HashMap<string, ItemListenerDelegate> item_listeners = new HashMap<string, ItemListenerDelegate>();
private HashMap<string, RetractListenerDelegate> retract_listeners = new HashMap<string, RetractListenerDelegate>();
+ private ArrayList<string> pep_subset_listeners = new ArrayList<string>();
- public void add_filtered_notification(XmppStream stream, string node,
+ public void add_filtered_notification(XmppStream stream, string node, bool pep_subset,
owned ItemListenerDelegate.ResultFunc? item_listener,
owned RetractListenerDelegate.ResultFunc? retract_listener) {
stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature_notify(stream, node);
@@ -27,6 +28,9 @@ namespace Xmpp.Xep.Pubsub {
if (retract_listener != null) {
retract_listeners[node] = new RetractListenerDelegate((owned)retract_listener);
}
+ if (pep_subset) {
+ pep_subset_listeners.add(node);
+ }
}
public void remove_filtered_notification(XmppStream stream, string node) {
@@ -166,6 +170,11 @@ namespace Xmpp.Xep.Pubsub {
if (items_node == null) return;
string node = items_node.get_attribute("node", NS_URI_EVENT);
+ if (!message.from.is_bare() && pep_subset_listeners.contains(node)) {
+ warning("Got a PEP message from a full JID (%s), ignoring:\n%s", message.from.to_string(), message.stanza.to_string());
+ return;
+ }
+
StanzaNode? item_node = items_node.get_subnode("item", NS_URI_EVENT);
if (item_node != null) {
string id = item_node.get_attribute("id", NS_URI_EVENT);