Copyright © 2006-2012 ProcessOne
Version: 3.0.0-alpha-5, May 23 2012 07:15:13
Behaviours: gen_mod, gen_server.
Authors: Christophe Romain (christophe.romain@process-one.net) [web site: http://www.process-one.net/].
References
See XEP-0060: Pubsub for the latest version of the PubSub specification. This module uses version 1.12 of the specification as a base. Most of the specification is implemented. Functions concerning configuration should be rewritten.
Support for subscription-options and multi-subscribe features was added by Brian Cully (bjc AT kublai.com). Subscriptions and options are stored in the pubsub_subscription table, with a link to them provided by the subscriptions field of pubsub_state. For information on subscription-options and mulit-subscribe see XEP-0060 sections 6.1.6, 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see XEP-0060 section 12.18.accessModel() = open | presence | roster | authorize | whitelist
affiliation() = none | owner | publisher | 'publish-only' | member | outcast
bareUsr() = {User, Server, Resource}
features() = [Feature]
fullUsr() = {User, Server, Resource}
host() = hostPubsub() | hostPEP()
hostPEP() = {User, Server, Resource}
hostPubsub() = binary()
hostPubsub is the name of the PubSub service. For example, it can be pubsub.localhost.
itemId() = binary()
An itemId is the name of an Item. It can be anything. For example: 38964 my-tune FD6SBE6a27d
jidComponent() = {jid, Raw, Node, Domain, Resource}
jidContact() = {jid, Raw, Node, Domain, Resource}
jidEntity() = {jid, Raw, Node, Domain, Resource}
ljid() = {User, Server, Resource}
nodeId() = binary()
A nodeId is the name of a Node. It can be anything and may represent some hierarchical tree depending of the node type. For example: /home/localhost/user/node princely_musings http://jabber.org/protocol/tune My-Own_Node
nodeIdx() = integer()
nodeOption() = {Option, Value}
Option = atom() Value = term().
Example: {deliver_payloads, true}
nodeType() = string()
The nodeType is a string containing the name of the PubSub plugin to use to manage a given node. For example, it can be "flat", "hometree" or "blog".
now() = {Megaseconds, Seconds, Microseconds}
payload() = [] | [#xmlel{}]
pubsubIQResponse() = #xmlel{}
Example:
#xmlel{name = 'pubsub',
ns = ?NS_PUBSUB,
children = [
#xmlel{name = 'affiliations'
ns = ?NS_PUBSUB
}
]
}
pubsubIndex() = {pubsub_index, Index, Last, Free}
Index = atom() Last = nodeIdx() Free = [nodeIdx()].
Internal pubsub index table.pubsubItem() = {pubsub_item, Id, NodeIdx, Creation, Modification, Payload}
This is the format of the published items table. The type of the table is: set,disc,fragmented.
pubsubLastItem() = {pubsub_last_item, NodeId, ItemId, Creation, Payload}
This is the format of the last items table. it stores last item payload for every node
pubsubNode() = {pubsub_node, Id, Idx, Parents, Type, Owners, Options}
This is the format of the nodes table. The type of the table is: set,ram/disc.
The parents and type fields are indexed.
idx is an integer.
pubsubState() = {pubsub_state, Id, NodeIdx, Items, Affiliation, Subscriptions}
This is the format of the affiliations table. The type of the table is: set,ram/disc.
pubsubSubscription() = {pubsub_subscription, SubId, Options}
This is the format of the subscriptions table. The type of the table is: set,ram/disc.
stanzaError() = #xmlel{}
Example:
#xmlel{name = 'error'
ns = ?NS_STANZAS,
attrs = [
#xmlattr{
name = 'code',
ns = ?NS_STANZAS,
value = Code
},
attrs = [
#xmlattr{
name = 'type',
ns = ?NS_STANZAS,
value = Type
}
]}
subId() = binary()
subOption() = {Option, Value}
Option = atom() Value = term().
subscription() = none | pending | unconfigured | subscribed
add_extended_headers(Stanza, HeaderEls) -> any()
add_headers(Xmlel, HeaderName, HeaderNS, HeaderEls) -> any()
add_message_type(Xmlel, Type) -> any()
add_opt(Key, Value, Opts) -> any()
add_shim_headers(Stanza, HeaderEls) -> any()
adhoc_request(Host, ServerHost, Owner, Adhoc_request, Access, Plugins) -> any()
Processes an Ad Hoc Command.
affiliation_to_string(X1::Affiliation) -> AffiliationStr
Convert an affiliation type from atom to string.
broadcast(Host, Node, NodeId, Type, NodeOptions, Notify, Stanzas) -> any()
broadcast(Host, Node, NodeId, Type, NodeOptions, Subscriptions, Stanza, SHIM) -> any()
broadcast(Host, Node, NodeId, Type, NodeOptions, Notify, Condition, Stanza, SHIM) -> any()
broadcast_config_notification(Host, Node, NodeId, Type, NodeOptions, Lang) -> any()
broadcast_created_node(Host, Node, NodeId, Type, NodeOptions) -> any()
broadcast_publish_item(Host, Node, NodeId, Type, NodeOptions, ItemId, Publisher, Payload, Removed) -> any()
broadcast_purge_node(Host, Node, NodeId, Type, NodeOptions) -> any()
broadcast_removed_node(Host, Node, NodeId, Type, NodeOptions) -> any()
broadcast_retract_items(Host, Node, NodeId, Type, NodeOptions, ItemIds) -> any()
broadcast_retract_items(Host, Node, NodeId, Type, NodeOptions, ItemIds, Notify) -> any()
caps_update(From, To, Features) -> any()
code_change(OldVsn, State, Extra) -> any()
collection_shim(Node) -> any()
command_disco_info(Host, NodeId, From) -> any()
create_node(Host::host(), ServerHost::host(), Node::pubsubNode(), Owner::jid(), NodeType::nodeType()) -> {error, Reason::stanzaError()} | {result, []}
Create new pubsub nodes
In addition to method-specific error conditions, there are several general reasons why the node creation request might fail:
ote: node creation is a particular case, error return code is evaluated at many places:
create_node(Host, ServerHost, Node, Owner, Type, Access, Configuration) -> any()
delete_item(Host::host(), JID::jid(), Node::pubsubNode(), ItemId::string()) -> {error, Reason::stanzaError()} | {result, []}
Delete item from a PubSub node.
The permission to delete an item must be verified by the plugin implementation.
There are several reasons why the item retraction request might fail:
delete_item(Host, Node, Publisher, ItemId, ForceNotify) -> any()
delete_node(Host, Node, Owner) -> {error, Reason} | {result, []}
Delete specified node and all childs.
There are several reasons why the node deletion request might fail:
disco_features(Host, NodeId, From) -> any()
disco_identity(Host, NodeId, From) -> any()
disco_items(Jid, NodeId, From) -> any()
disco_local_features(Acc, From, Jid, NodeId, Lang) -> any()
disco_local_identity(Acc, From, Jid, NodeId, Lang) -> any()
disco_local_items(Acc, From, To, Node, Lang) -> any()
disco_sm_features(Acc, From, To, NodeId, Lang) -> any()
disco_sm_identity(Acc, From, To, NodeId, Lang) -> any()
disco_sm_items(Acc, From, To, NodeId, Lang) -> any()
do_route(ServerHost, Access, Plugins, Host, From, To, Xmlel) -> any()
escape(JID) -> any()
Build pubsub event stanza
event_stanza(Event, EvAttr) -> any()
event_stanza(Event, EvAttr, Entries) -> any()
event_stanza(Event, EvAttr, Entry, EnAttr, Payload) -> any()
event_stanza(Event, EvAttr, Entry, EnAttr, Payload, Publisher) -> any()
event_stanza_with_delay(Els, ModifNow, X3) -> any()
event_stanza_withmoreels(Els, MoreEls) -> any()
extended_error(Error, Ext) -> any()
extended_error(Error, Ext, Feature) -> any()
extended_headers(JIDs) -> any()
features() -> any()
features(Type) -> any()
features(Host, NodeId) -> any()
find_authorization_response(Packet) -> any()
get_affiliations(Host, JID, Plugins) -> {error, Reason} | {result, Response}
Return the list of affiliations as an XMPP response.
get_allowed_items_call(Host, NodeIdx, From, Type, Options, Owners) -> any()
get_allowed_items_call(Host, NodeIdx, From, Type, Options, Owners, RSM) -> any()
get_cached_item(Host, NodeId) -> any()
get_configure(Host, ServerHost, Node, Jid, Lang) -> any()
get_configure_xfields(Type, Options, Lang, Groups) -> any()
get_default(Host, Node, From, Lang) -> any()
get_item(Host, NodeId, ItemId) -> any()
get_items(Host, NodeId) -> any()
get_items(Host, Node, From, SubId, SMaxItems, ItemIds, Rsm) -> any()
Return the items of a given node.
The number of items to return is limited by MaxItems.
The permission are not checked in this function.
To do
get_max_items_node(Host) -> any()
get_option(Options, Key) -> any()
get_option(Options, Key, Default) -> any()
get_options(Host, Node, JID, SubId, Lang) -> any()
get_options_helper(JID, Lang, Node, NodeId, SubId, Type) -> any()
get_pending_nodes(Host, Owner, Plugins) -> any()
get_presence_and_roster_permissions(Host, From, Owners, AccessModel, AllowedGroups) -> any()
get_resource_state(X1, ShowValues, JIDs) -> any()
get_roster_info(OwnerUser, OwnerServer, JID, AllowedGroups) -> any()
get_subscriptions(Host, Node, JID) -> any()
get_subscriptions(Host, Node, JID, Plugins) -> {error, Reason} | {result, Response}
Return the list of subscriptions as an XMPP response.
handle_authorization_response(Host, From, To, Packet, XFields) -> any()
handle_call(X1, From, State) -> any()
handle_cast(Msg, State) -> any()
handle_info(Info, State) -> any()
host(ServerHost) -> any()
in_subscription(X1, User, Server, Owner, X5, X6) -> any()
init(X1) -> any()
init_nodes(Host, ServerHost, NodeTree, Plugins) -> any()
init_plugins(Host, ServerHost, Opts) -> Plugins
Call the init/1 function for each plugin declared in the config file. The default plugin module is implicit.
The Erlang code for the plugin is located in a module called node_plugin. The 'node_' prefix is mandatory.
The modules are initialized in alphetical order and the list is checked and sorted to ensure that each module is initialized only once.
See node_flat:init/1 for an example implementation.
init_send_loop(ServerHost, State) -> any()
iq_command(Host, ServerHost, From, IQ, Access, Plugins) -> any()
iq_disco_info(Host, NodeId, From, Lang) -> any()
iq_disco_items(Host, NodeId, From, Rsm) -> any()
iq_get_vcard(Lang) -> any()
iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang) -> any()
iq_pubsub(Host, ServerHost, From, IQType, Xmlel, Lang, Access, Plugins) -> any()
iq_pubsub_owner(Host, ServerHost, From, IQType, Xmlel, Lang) -> any()
iq_sm(From, Jid, Iq) -> any()
is_last_item_cache_enabled(Host) -> any()
is_to_deliver(LJID, NotifyType, Depth, NodeOptions, SubOptions) -> boolean()
Check if a notification must be delivered or not based on node and subscription options.
itemAttr(ItemId) -> any()
itemsEls(PubsubItems) -> any()
max_items(Host, Options) -> MaxItems
Return the maximum number of items for a given node.
Unlimited means that there is no limit in the number of items that can be stored.
To do
nodeAttr(Node) -> any()
node_action(Host, Type, Function, Args) -> any()
node_call(Type, Function, Args) -> any()
node plugin call.
node_disco_info(Host, NodeId, From) -> any()
node_options(Type) -> any()
node_owners(Host, Type, NodeId) -> [ljid()]
Return list of node owners.
node_owners_call(Type, NodeId) -> any()
node_subscriptions(Host, Node, NodeId, Type, NodeOptions, Notify) -> any()
node_subscriptions_bare(Host, Node, NodeId, Type) -> any()
node_subscriptions_full(Host, Node, NotifyType) -> any()
node_to_deliver(LJID, NodeOptions) -> any()
node_to_string(Node) -> NodeStr
Convert a node type from pubsubNode to string.
notify_owners(X1, JID, Host, Node, Owners, State) -> any()
odbc_conn(Host) -> any()
on_user_offline(X1, JID, X3) -> any()
out_subscription(User, Server, JID, X4) -> any()
payload_els_ns(Payload) -> int()
Count occurence of XML elements in payload.
payload_els_ns(Tail, Count, NS) -> any()
plugins(Host) -> any()
presence(ServerHost, Presence) -> any()
presence_can_deliver(X1, X2) -> any()
presence_probe(Jid, JID, Pid) -> any()
publish_item(Host::host(), ServerHost::host(), JID::jid(), Node::pubsubNode(), ItemId::string(), Payload::term()) -> {error, Reason::stanzaError()} | {result, []}
Publish item to a PubSub node.
The permission to publish an item must be verified by the plugin implementation.
There are several reasons why the publish request might fail:
purge_node(Host, Node::JID, Owner::Node) -> {error, Reason} | {result, []}
Delete all items of specified node owned by JID.
There are several reasons why the node purge request might fail:
purge_offline(LJID) -> any()
read_sub(Subscriber, Node, NodeId, SubId, Lang) -> any()
remove_user(UserB, ServerB) -> any()
select_type(ServerHost, Host, NodeId) -> any()
select_type(ServerHost, Host, NodeId, Type) -> any()
send_authorization_approval(Host, JID, SNode::Node, Subscription) -> void
Send a message to JID with the supplied Subscription
send_authorization_request(Pubsub_node, Subscriber) -> any()
send_items(Host, Node, NodeId, Type, LJID, Number) -> any()
Resend the items of a node to the user.
To do
send_loop(State) -> any()
send_pending_auth_events(Host, Node, Owner) -> iqRes()
Send a subscription approval form to Owner for all pending subscriptions on Host and Node.
send_pending_node_form(Host, Owner, Lang, Plugins) -> iqRes()
Sends the process pending subscriptions XForm for Host to Owner.
Generate pubsub service JID.
set_affiliations(Host, Node, From, EntitiesEls) -> any()
set_cached_item(Host, NodeId, ItemId, Publisher, Payload) -> any()
set_configure(Host, Node, From, Els, Lang) -> any()
set_options(Host, Node, JID, SubId, Configuration) -> any()
set_options_helper(Configuration, JID, NodeId, SubId, Type) -> any()
set_subscriptions(Host, Node, From, EntitiesEls) -> any()
set_xoption(Host, Opts, NewOpts) -> any()
start(Host, Opts) -> any()
start_link(Host, Opts) -> any()
state_can_deliver(X1, SubOptions) -> any()
stop(Host) -> any()
string_to_affiliation(X1::AffiliationStr) -> Affiliation
Convert an affiliation type from string to atom.
string_to_node(SNode) -> any()
string_to_subscription(X1::SubscriptionStr) -> Subscription
Convert a subscription type from string to atom.
sub_option_can_deliver(X1, Depth, X3) -> any()
sub_to_deliver(LJID, NotifyType, Depth, SubOptions) -> any()
sub_with_options(Pubsub_node) -> any()
sub_with_options(JID, NodeId, SubId) -> any()
subid_shim(SubIds) -> any()
subscribe_node(Host, Node, From, JID, Configuration) -> {error, Reason::stanzaError()} | {result, []}
Accepts or rejects subcription requests on a PubSub node.
There are several reasons why the subscription request might fail:
See also: node_flat:subscribe_node/5.
subscribed_nodes_by_jid(NotifyType, SubsByDepth) -> any()
subscription_to_string(X1::Subscription) -> SubscriptionStr
Convert a subscription type from atom to string.
terminate(Reason, State) -> any()
terminate_plugins(Host, ServerHost, Plugins, TreePlugin) -> any()
transaction(Host, Fun, Trans) -> any()
transaction(Host, NodeId, Action, Trans) -> any()
plugin transaction handling.
transaction_on_nodes(Host, Action, Trans) -> any()
transaction_retry(Host, Fun, Trans, Count) -> any()
tree_action(Host, Function, Args) -> any()
tree_call(Host, Function, Args) -> any()
node tree plugin call.
uniqid() -> any()
unset_cached_item(Host, NodeId) -> any()
unsubscribe_node(Host, Node::Noce, From, JID, SubId) -> {error, Reason} | {result, []}
Unsubscribe JID from the Node.
There are several reasons why the unsubscribe request might fail:
unsubscribe_user(Entity, Owner) -> any()
update_auth(Host, Node, Type, Nidx, Subscriber, Allow, Subscriptions) -> any()
user_resource(User, Server, Resource) -> any()
user_resources(User, Server) -> any()
write_sub(Subscriber, NodeId, SubId, Options) -> any()
Generated by EDoc, May 23 2012, 07:15:13.