Only process PEP messages from bare JIDs
This commit is contained in:
parent
82a492b33f
commit
f2ef2bcfe7
|
@ -30,7 +30,8 @@ public class StreamModule : XmppStreamModule {
|
|||
}
|
||||
|
||||
public override void attach(XmppStream stream) {
|
||||
stream.get_module(Pubsub.Module.IDENTITY).add_filtered_notification(stream, NODE_DEVICELIST, (stream, jid, id, node) => parse_device_list(stream, jid, id, node), null);
|
||||
stream.get_module(Pubsub.Module.IDENTITY).add_filtered_notification(stream, NODE_DEVICELIST, true,
|
||||
(stream, jid, id, node) => parse_device_list(stream, jid, id, node), null);
|
||||
}
|
||||
|
||||
public override void detach(XmppStream stream) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace Xmpp.Xep.UserAvatars {
|
|||
public signal void received_avatar_hash(XmppStream stream, Jid jid, string id);
|
||||
|
||||
public override void attach(XmppStream stream) {
|
||||
stream.get_module(Pubsub.Module.IDENTITY).add_filtered_notification(stream, NS_URI_METADATA, on_pupsub_event, null);
|
||||
stream.get_module(Pubsub.Module.IDENTITY).add_filtered_notification(stream, NS_URI_METADATA, true, on_pupsub_event, null);
|
||||
}
|
||||
|
||||
public override void detach(XmppStream stream) {
|
||||
|
|
|
@ -98,7 +98,7 @@ public class Module : BookmarksProvider, XmppStreamModule {
|
|||
}
|
||||
|
||||
public override void attach(XmppStream stream) {
|
||||
stream.get_module(Pubsub.Module.IDENTITY).add_filtered_notification(stream, NS_URI, on_pupsub_item, on_pupsub_retract);
|
||||
stream.get_module(Pubsub.Module.IDENTITY).add_filtered_notification(stream, NS_URI, true, on_pupsub_item, on_pupsub_retract);
|
||||
}
|
||||
|
||||
public override void detach(XmppStream stream) {
|
||||
|
|
Loading…
Reference in a new issue