diff options
Diffstat (limited to 'src/mod_pubsub_odbc.erl')
-rw-r--r-- | src/mod_pubsub_odbc.erl | 73 |
1 files changed, 20 insertions, 53 deletions
diff --git a/src/mod_pubsub_odbc.erl b/src/mod_pubsub_odbc.erl index d9f1b71be..153287b74 100644 --- a/src/mod_pubsub_odbc.erl +++ b/src/mod_pubsub_odbc.erl @@ -931,17 +931,6 @@ remove_user(User, Server) -> LServer = jlib:nameprep(Server), Entity = jlib:make_jid(LUser, LServer, <<"">>), Host = host(LServer), -%%-------------------------------------------------------------------- -%% Function: -%% handle_call(Request, From, State) -> {reply, Reply, State} | -%% {reply, Reply, State, Timeout} | -%% {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, Reply, State} | -%% {stop, Reason, State} -%% Description: Handling call messages -%%-------------------------------------------------------------------- -%% @private HomeTreeBase = <<"/home/", LServer/binary, "/", LUser/binary>>, spawn(fun () -> lists:foreach(fun (PType) -> @@ -1020,13 +1009,6 @@ handle_call(stop, _From, State) -> %% Description: Handling cast messages %%-------------------------------------------------------------------- %% @private -%%-------------------------------------------------------------------- -%% Function: handle_info(Info, State) -> {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, State} -%% Description: Handling all non call/cast messages -%%-------------------------------------------------------------------- -%% @private handle_cast(_Msg, State) -> {noreply, State}. -spec(handle_info/2 :: @@ -1036,6 +1018,13 @@ handle_cast(_Msg, State) -> {noreply, State}. -> {noreply, state()} ). +%%-------------------------------------------------------------------- +%% Function: handle_info(Info, State) -> {noreply, State} | +%% {noreply, State, Timeout} | +%% {stop, Reason, State} +%% Description: Handling all non call/cast messages +%%-------------------------------------------------------------------- +%% @private handle_info({route, From, To, Packet}, #state{server_host = ServerHost, access = Access, plugins = Plugins} = @@ -1047,6 +1036,9 @@ handle_info({route, From, To, Packet}, _ -> ok end, {noreply, State}; +handle_info(_Info, State) -> + {noreply, State}. + %%-------------------------------------------------------------------- %% Function: terminate(Reason, State) -> void() %% Description: This function is called by a gen_server when it is about to @@ -1055,8 +1047,6 @@ handle_info({route, From, To, Packet}, %% The return value is ignored. %%-------------------------------------------------------------------- %% @private -handle_info(_Info, State) -> {noreply, State}. - terminate(_Reason, #state{host = Host, server_host = ServerHost, nodetree = TreePlugin, plugins = Plugins}) -> @@ -1097,14 +1087,14 @@ terminate(_Reason, ?MODULE, remove_user, 50), mod_disco:unregister_feature(ServerHost, ?NS_PUBSUB), gen_mod:get_module_proc(ServerHost, ?LOOPNAME) ! stop, + terminate_plugins(Host, ServerHost, Plugins, + TreePlugin). + %%-------------------------------------------------------------------- %% Func: code_change(OldVsn, State, Extra) -> {ok, NewState} %% Description: Convert process state when code is changed %%-------------------------------------------------------------------- %% @private - terminate_plugins(Host, ServerHost, Plugins, - TreePlugin). - code_change(_OldVsn, State, _Extra) -> {ok, State}. -spec(do_route/7 :: @@ -3684,10 +3674,6 @@ get_roster_info(OwnerUser, OwnerServer, end, Groups), {PresenceSubscription, RosterGroup}; -%% @spec (AffiliationStr) -> Affiliation -%% AffiliationStr = string() -%% Affiliation = atom() -%% @doc <p>Convert an affiliation type from string to atom.</p> get_roster_info(OwnerUser, OwnerServer, JID, AllowedGroups) -> get_roster_info(OwnerUser, OwnerServer, @@ -3700,10 +3686,6 @@ string_to_affiliation(<<"outcast">>) -> outcast; string_to_affiliation(<<"none">>) -> none; string_to_affiliation(_) -> false. -%% @spec (SubscriptionStr) -> Subscription -%% SubscriptionStr = string() -%% Subscription = atom() -%% @doc <p>Convert a subscription type from string to atom.</p> string_to_subscription(<<"subscribed">>) -> subscribed; string_to_subscription(<<"pending">>) -> pending; string_to_subscription(<<"unconfigured">>) -> @@ -3711,21 +3693,6 @@ string_to_subscription(<<"unconfigured">>) -> string_to_subscription(<<"none">>) -> none; string_to_subscription(_) -> false. -%% @spec (Affiliation) -> AffiliationStr -%% Affiliation = atom() -%% AffiliationStr = string() -%% @doc <p>Convert an affiliation type from atom to string.</p> -%% @spec (Subscription) -> SubscriptionStr -%% Subscription = atom() -%% SubscriptionStr = string() -%% @doc <p>Convert a subscription type from atom to string.</p> -%% @spec (Node) -> NodeStr -%% Node = pubsubNode() -%% NodeStr = string() -%% @doc <p>Convert a node type from pubsubNode to string.</p> -%% @spec (Host) -> jid() -%% Host = host() -%% @doc <p>Generate pubsub service JID.</p> affiliation_to_string(owner) -> <<"owner">>; affiliation_to_string(publisher) -> <<"publisher">>; affiliation_to_string(member) -> <<"member">>; @@ -3743,6 +3710,11 @@ subscription_to_string(_) -> <<"none">>. -> jid() ). service_jid(Host) -> + case Host of + {U, S, _} -> {jid, U, S, <<"">>, U, S, <<"">>}; + _ -> {jid, <<"">>, Host, <<"">>, <<"">>, Host, <<"">>} + end. + %% @spec (LJID, NotifyType, Depth, NodeOptions, SubOptions) -> boolean() %% LJID = jid() %% NotifyType = items | nodes @@ -3751,11 +3723,6 @@ service_jid(Host) -> %% SubOptions = [{atom(), term()}] %% @doc <p>Check if a notification must be delivered or not based on %% node and subscription options.</p> - case Host of - {U, S, _} -> {jid, U, S, <<"">>, U, S, <<"">>}; - _ -> {jid, <<"">>, Host, <<"">>, <<"">>, Host, <<"">>} - end. - is_to_deliver(LJID, NotifyType, Depth, NodeOptions, SubOptions) -> sub_to_deliver(LJID, NotifyType, Depth, SubOptions) @@ -3858,13 +3825,13 @@ get_resource_state({U, S, R}, ShowValues, JIDs) -> end end. -%% @spec (Payload) -> int() -%% Payload = term() -spec(payload_xmlelements/1 :: ( Payload :: mod_pubsub:payload()) -> Count :: non_neg_integer() ). +%% @spec (Payload) -> int() +%% Payload = term() %% @doc <p>Count occurence of XML elements in payload.</p> payload_xmlelements(Payload) -> payload_xmlelements(Payload, 0). payload_xmlelements([], Count) -> Count; |