25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Fix Dialyzer reports

This commit is contained in:
Badlop 2010-08-13 17:01:08 +02:00
parent 6e65f0694e
commit dffb9cdaf9
11 changed files with 88 additions and 96 deletions

View File

@ -448,9 +448,7 @@ remove_user(User, Server, Password) ->
{atomic, ok} -> {atomic, ok} ->
ok; ok;
{atomic, Res} -> {atomic, Res} ->
Res; Res
_ ->
bad_request
end end
catch catch
_ -> _ ->

View File

@ -194,9 +194,19 @@ normalize_hosts([Host|Hosts], PrepHosts) ->
exit("invalid hostname") exit("invalid hostname")
end. end.
ensure_localhost_is_first(["localhost" | _] = Hosts) -> %% @spec (Hosts::[string()]) -> ["localhost" | string()]
Hosts;
ensure_localhost_is_first(Hosts) -> ensure_localhost_is_first(Hosts) ->
case lists:all(fun is_list/1, Hosts) of
true ->
ensure_localhost_is_first1(Hosts);
false ->
?ERROR_MSG("This list of hosts is bad formed:~n~p", [Hosts]),
ensure_localhost_is_first1([])
end.
ensure_localhost_is_first1(["localhost" | _] = Hosts) ->
Hosts;
ensure_localhost_is_first1(Hosts) ->
case lists:member("localhost", Hosts) of case lists:member("localhost", Hosts) of
true -> true ->
["localhost" | lists:delete("localhost", Hosts)]; ["localhost" | lists:delete("localhost", Hosts)];

View File

@ -84,13 +84,14 @@ register(Host, Config) when is_list(Host), is_list(Config) ->
true = exmpp_stringprep:is_node(Host), true = exmpp_stringprep:is_node(Host),
ID = get_clusterid(), ID = get_clusterid(),
H = #hosts{host = Host, clusterid = ID, config = Config}, H = #hosts{host = Host, clusterid = ID, config = Config},
ok = gen_storage:dirty_write(Host, H), HostB = list_to_binary(Host),
ok = gen_storage:dirty_write(HostB, H),
reload(), reload(),
ok. ok.
%% Updates host configuration %% Updates host configuration
update_host_conf(Host, Config) when is_list(Host), is_list(Config) -> update_host_conf(Host, Config) when is_list(Host), is_list(Config) ->
true = jlib:is_nodename(Host), true = exmpp_stringprep:is_node(Host),
case registered(Host) of case registered(Host) of
false -> {error, host_process_not_registered}; false -> {error, host_process_not_registered};
true -> true ->
@ -103,8 +104,9 @@ update_host_conf(Host, Config) when is_list(Host), is_list(Config) ->
remove(Host) when is_list(Host) -> remove(Host) when is_list(Host) ->
true = exmpp_stringprep:is_node(Host), true = exmpp_stringprep:is_node(Host),
ID = get_clusterid(), ID = get_clusterid(),
HostB = list_to_binary(Host),
gen_storage:dirty_delete_where( gen_storage:dirty_delete_where(
Host, hosts, HostB, hosts,
[{'andalso', [{'andalso',
{'==', clusterid, ID}, {'==', clusterid, ID},
{'==', host, Host}}]), {'==', host, Host}}]),
@ -207,7 +209,7 @@ handle_info(timeout, State = #state{state=wait_odbc,backend=Backend,odbc_wait_ti
{config, text}]}]), {config, text}]}]),
%% Now let's add the default vhost: "localhost" %% Now let's add the default vhost: "localhost"
gen_storage:dirty_write(Host, #hosts{host = Host, gen_storage:dirty_write(HostB, #hosts{host = Host,
clusterid = 1, clusterid = 1,
config = ""}), config = ""}),
@ -371,19 +373,10 @@ stop_host(Host) ->
get_hosts(ejabberd) -> ?MYHOSTS; get_hosts(ejabberd) -> ?MYHOSTS;
get_hosts(odbc) -> get_hosts(odbc) ->
ClusterID = get_clusterid(), ClusterID = get_clusterid(),
case gen_storage:dirty_select(?MYNAME, hosts, [{'=', clusterid, ClusterID}]) of Hosts = gen_storage:dirty_select(?MYNAME, hosts, [{'=', clusterid, ClusterID}]),
Hosts when is_list(Hosts) -> lists:map(fun (#hosts{host = Host}) ->
lists:map(fun (#hosts{host = Host}) -> exmpp_stringprep:nameprep(Host)
case exmpp_stringprep:nameprep(Host) of end, Hosts).
error ->
erlang:error({bad_vhost_name, Host});
Name ->
Name
end
end, Hosts);
E ->
erlang:error({get_hosts_error, E})
end.
%% Retreive the text format config for host Host from ODBC and covert %% Retreive the text format config for host Host from ODBC and covert
%% it into a {host, Host, Config} tuple. %% it into a {host, Host, Config} tuple.

View File

@ -205,24 +205,20 @@ delete_balanced_route(LDomain, Pid) ->
force_unregister_route(Domain) -> force_unregister_route(Domain) ->
case jlib:nameprep(Domain) of LDomain = exmpp_stringprep:nameprep(Domain),
error -> F = fun() ->
erlang:error({invalid_domain, Domain}); case mnesia:match_object(
LDomain -> #route{domain = LDomain,
F = fun() -> _ = '_'}) of
case mnesia:match_object( Rs when is_list(Rs) ->
#route{domain = LDomain, lists:foreach(fun(R) ->
_ = '_'}) of mnesia:delete_object(R)
Rs when is_list(Rs) -> end, Rs);
lists:foreach(fun(R) -> _ ->
mnesia:delete_object(R) ok
end, Rs); end
_ -> end,
ok mnesia:transaction(F).
end
end,
mnesia:transaction(F)
end.
unregister_routes(Domains) -> unregister_routes(Domains) ->
lists:foreach(fun(Domain) -> lists:foreach(fun(Domain) ->

View File

@ -61,10 +61,9 @@ behaviour_info(_) ->
-spec all_table_hosts(atom()) -> -spec all_table_hosts(atom()) ->
[storage_host()]. [storage_host()].
all_table_hosts(Tab) -> all_table_hosts(Tab) ->
mnesia:dirty_select(table, [{#table{host_name = '$1', mnesia:dirty_select(table, [{{table, {'$1', '$2'}, '_', '_'},
_ = '_'}, [{'=:=', '$2', {const, Tab}}],
[{'=:=', {element, 2, '$1'}, {const, Tab}}], ['$1']}]).
[{element, 1, '$1'}]}]).
-spec table_info(storage_host, storage_table, atom()) -> -spec table_info(storage_host, storage_table, atom()) ->
any(). any().
@ -110,7 +109,7 @@ table_info(Host, Tab, InfoKey) ->
%% columndef() defaults to text for all unspecified attributes %% columndef() defaults to text for all unspecified attributes
-spec create_table(atom(), storage_host(), storage_table(), #table{}) -> -spec create_table(atom(), storage_host(), storage_table(), #table{}) ->
{atomic, ok}. tuple().
create_table(mnesia, Host, Tab, Def) -> create_table(mnesia, Host, Tab, Def) ->
MDef = filter_mnesia_tabdef(Def), MDef = filter_mnesia_tabdef(Def),
@ -123,7 +122,7 @@ create_table(odbc, Host, Tab, Def) ->
define_table(gen_storage_odbc, Host, Tab, ODef), define_table(gen_storage_odbc, Host, Tab, ODef),
gen_storage_odbc:create_table(ODef). gen_storage_odbc:create_table(ODef).
-spec define_table(atom(), storage_host(), storage_table(), #table{}) -> -spec define_table(atom(), storage_host(), storage_table(), #mnesia_def{} | tuple()) ->
ok. ok.
define_table(Backend, Host, Name, Def) -> define_table(Backend, Host, Name, Def) ->
mnesia:create_table(table, [{attributes, record_info(fields, table)}]), mnesia:create_table(table, [{attributes, record_info(fields, table)}]),
@ -131,8 +130,10 @@ define_table(Backend, Host, Name, Def) ->
backend = Backend, backend = Backend,
def = Def}). def = Def}).
%% @spec (#table{}) -> [{atom(), any()}]
-spec filter_mnesia_tabdef(#table{}) -> -spec filter_mnesia_tabdef(#table{}) ->
[{atom(), any()}]. [any()].
filter_mnesia_tabdef(TabDef) -> filter_mnesia_tabdef(TabDef) ->
lists:filter(fun filter_mnesia_tabdef_/1, TabDef). lists:filter(fun filter_mnesia_tabdef_/1, TabDef).
@ -531,7 +532,7 @@ write_lock_table(Host, Tab) ->
-spec transaction(storage_host(), storage_table(), fun()) -> -spec transaction(storage_host(), storage_table(), fun()) ->
{atomic, any()}. {atomic, any()} | {aborted, string()}.
%% Warning: all tabs touched by the transaction must use the same %% Warning: all tabs touched by the transaction must use the same
%% storage backend! %% storage backend!
transaction(Host, Tab, Fun) -> transaction(Host, Tab, Fun) ->

View File

@ -4,7 +4,7 @@
-include("ejabberd.hrl"). -include("ejabberd.hrl").
%% @spec (Host, Table, Migrations) -> any() %% @spec (Host::storage_host(), Table::atom(), Migrations) -> any()
%% Migrations = [{OldTable, OldAttributes, MigrateFun}] %% Migrations = [{OldTable, OldAttributes, MigrateFun}]
migrate_mnesia(Host, Table, Migrations) -> migrate_mnesia(Host, Table, Migrations) ->
SameTableName = [Migration SameTableName = [Migration
@ -33,14 +33,15 @@ migrate_mnesia(Host, Table, Migrations) ->
end, DifferentTableName). end, DifferentTableName).
migrate_mnesia1(Host, Table, {OldTable, OldAttributes, MigrateFun}) -> migrate_mnesia1(Host, Table, {OldTable, OldAttributes, MigrateFun}) ->
HostB = list_to_binary(Host),
case (catch mnesia:table_info(OldTable, attributes)) of case (catch mnesia:table_info(OldTable, attributes)) of
OldAttributes -> OldAttributes ->
if if
Table =:= OldTable -> Table =:= OldTable ->
%% TODO: move into transaction %% TODO: move into transaction
TmpTable = list_to_atom(atom_to_list(Table) ++ "_tmp"), TmpTable = list_to_atom(atom_to_list(Table) ++ "_tmp"),
NewRecordName = gen_storage:table_info(Host, Table, record_name), NewRecordName = gen_storage:table_info(HostB, Table, record_name),
NewAttributes = gen_storage:table_info(Host, Table, attributes), NewAttributes = gen_storage:table_info(HostB, Table, attributes),
?INFO_MSG("Migrating mnesia table ~p via ~p~nfrom ~p~nto ~p", ?INFO_MSG("Migrating mnesia table ~p via ~p~nfrom ~p~nto ~p",
[Table, TmpTable, OldAttributes, NewAttributes]), [Table, TmpTable, OldAttributes, NewAttributes]),
@ -67,15 +68,15 @@ migrate_mnesia1(Host, Table, {OldTable, OldAttributes, MigrateFun}) ->
end, end,
{atomic, ok} = mnesia:transaction(F1), {atomic, ok} = mnesia:transaction(F1),
mnesia:delete_table(OldTable), mnesia:delete_table(OldTable),
TableInfo = gen_storage:table_info(Host, Table, all), TableInfo = gen_storage:table_info(HostB, Table, all),
{value, {_, Backend}} = lists:keysearch(backend, 1, TableInfo), {value, {_, Backend}} = lists:keysearch(backend, 1, TableInfo),
gen_storage:create_table(Backend, Host, Table, TableInfo), gen_storage:create_table(Backend, HostB, Table, TableInfo),
F2 = fun() -> F2 = fun() ->
mnesia:write_lock_table(Table), mnesia:write_lock_table(Table),
mnesia:foldl( mnesia:foldl(
fun(NewRecord, _) -> fun(NewRecord, _) ->
?DEBUG("~p-~p: ~p~n",[OldTable, Table, NewRecord]), ?DEBUG("~p-~p: ~p~n",[OldTable, Table, NewRecord]),
gen_storage:write(Host, Table, NewRecord, write) gen_storage:write(HostB, Table, NewRecord, write)
end, ok, TmpTable) end, ok, TmpTable)
end, end,
{atomic, ok} = mnesia:transaction(F2), {atomic, ok} = mnesia:transaction(F2),
@ -93,7 +94,7 @@ migrate_mnesia1(Host, Table, {OldTable, OldAttributes, MigrateFun}) ->
?DEBUG("~p-~p: ~p -> ~p~n",[OldTable, Table, OldRecord, NewRecord]), ?DEBUG("~p-~p: ~p -> ~p~n",[OldTable, Table, OldRecord, NewRecord]),
if if
is_tuple(NewRecord) -> is_tuple(NewRecord) ->
gen_storage:write(Host, Table, NewRecord, write); gen_storage:write(HostB, Table, NewRecord, write);
true -> true ->
ignored ignored
end end
@ -142,6 +143,7 @@ migrate_odbc1(Host, Tables, {OldTablesColumns, MigrateFun}) ->
migrate_odbc2(Host, Tables, OldTable, OldTables, OldColumns, OldColumnsAll, OldTablesA, ColumnsT, MigrateFun) migrate_odbc2(Host, Tables, OldTable, OldTables, OldColumns, OldColumnsAll, OldTablesA, ColumnsT, MigrateFun)
when ColumnsT == OldColumnsAll -> when ColumnsT == OldColumnsAll ->
?INFO_MSG("Migrating ODBC table ~p to gen_storage tables ~p", [OldTable, Tables]), ?INFO_MSG("Migrating ODBC table ~p to gen_storage tables ~p", [OldTable, Tables]),
HostB = list_to_binary(Host),
%% rename old tables to *_old %% rename old tables to *_old
lists:foreach(fun(OldTable1) -> lists:foreach(fun(OldTable1) ->
@ -149,13 +151,12 @@ migrate_odbc2(Host, Tables, OldTable, OldTables, OldColumns, OldColumnsAll, OldT
ejabberd_odbc:sql_query_t("alter table " ++ OldTable1 ++ ejabberd_odbc:sql_query_t("alter table " ++ OldTable1 ++
" rename to " ++ OldTable1 ++ "_old") " rename to " ++ OldTable1 ++ "_old")
end, OldTables), end, OldTables),
HostB = list_to_binary(Host),
%% recreate new tables %% recreate new tables
lists:foreach(fun(NewTable) -> lists:foreach(fun(NewTable) ->
case lists:member(NewTable, OldTablesA) of case lists:member(NewTable, OldTablesA) of
true -> true ->
TableInfo = TableInfo =
gen_storage:table_info(Host, NewTable, all), gen_storage:table_info(HostB, NewTable, all),
{value, {_, Backend}} = {value, {_, Backend}} =
lists:keysearch(backend, 1, TableInfo), lists:keysearch(backend, 1, TableInfo),
gen_storage:create_table(Backend, HostB, gen_storage:create_table(Backend, HostB,

View File

@ -325,11 +325,7 @@ find_x_expire(TimeStamp, [#xmlel{ns = ?NS_MESSAGE_EXPIRE} = El | _Els]) ->
{'EXIT', _} -> {'EXIT', _} ->
0; 0;
Int when Int > 0 -> Int when Int > 0 ->
{MegaSecs, Secs, MicroSecs} = TimeStamp, TimeStamp + Int;
S = MegaSecs * 1000000 + Secs + Int,
MegaSecs1 = S div 1000000,
Secs1 = S rem 1000000,
{MegaSecs1, Secs1, MicroSecs};
_ -> _ ->
0 0
end; end;
@ -450,11 +446,12 @@ remove_old_messages(Days) ->
Timestamp = make_timestamp() - 60 * 60 * 24 * Days, Timestamp = make_timestamp() - 60 * 60 * 24 * Days,
lists:foreach( lists:foreach(
fun(Host) -> fun(Host) ->
HostB = list_to_binary(Host),
F = fun() -> F = fun() ->
gen_storage:delete_where(Host, offline_msg, gen_storage:delete_where(HostB, offline_msg,
[{'<', timestamp, Timestamp}]) [{'<', timestamp, Timestamp}])
end, end,
{atomic, _} = gen_storage:transaction(Host, offline_msg, F) {atomic, _} = gen_storage:transaction(HostB, offline_msg, F)
end, gen_storage:all_table_hosts(offline_msg)). end, gen_storage:all_table_hosts(offline_msg)).
remove_user(User, Server) when is_binary(User), is_binary(Server) -> remove_user(User, Server) when is_binary(User), is_binary(Server) ->
@ -494,8 +491,8 @@ update_table(Host, mnesia) ->
Expire1 = case Expire of Expire1 = case Expire of
never -> never ->
0; 0;
{MegaSecs, Secs, _MicroSecs} -> Ts ->
MegaSecs * 1000000 + Secs Ts
end, end,
PacketXmlel = exmpp_xml:xmlelement_to_xmlel( PacketXmlel = exmpp_xml:xmlelement_to_xmlel(
Packet, [?DEFAULT_NS], ?PREFIXED_NS), Packet, [?DEFAULT_NS], ?PREFIXED_NS),
@ -680,8 +677,10 @@ user_queue_parse_query(US, Query) ->
us_to_list({User, Server}) -> us_to_list({User, Server}) ->
exmpp_jid:to_list(User, Server). exmpp_jid:to_list(User, Server).
%% @spec (User::string(), Host::string()) -> integer()
get_queue_length(User, Host) -> get_queue_length(User, Host) ->
gen_storage:dirty_count_records(Host, offline_msg, [{'=', user_host, {User, Host}}]). HostB = list_to_binary(Host),
gen_storage:dirty_count_records(HostB, offline_msg, [{'=', user_host, {User, Host}}]).
get_messages_subset(User, Host, MsgsAll) -> get_messages_subset(User, Host, MsgsAll) ->
Access = gen_mod:get_module_opt(Host, ?MODULE, access_max_user_messages, Access = gen_mod:get_module_opt(Host, ?MODULE, access_max_user_messages,

View File

@ -804,6 +804,7 @@ updated_list(_,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
update_tables(Host, mnesia) -> update_tables(Host, mnesia) ->
HostB = list_to_binary(Host),
gen_storage_migration:migrate_mnesia( gen_storage_migration:migrate_mnesia(
Host, privacy_default_list, Host, privacy_default_list,
[{privacy, [us, default, lists], [{privacy, [us, default, lists],
@ -821,7 +822,7 @@ update_tables(Host, mnesia) ->
match_presence_in = MatchPresenceIn, match_presence_in = MatchPresenceIn,
match_presence_out = MatchPresenceOut}) -> match_presence_out = MatchPresenceOut}) ->
ValueBin = convert_value_to_binary(Value), ValueBin = convert_value_to_binary(Value),
gen_storage:write(Host, gen_storage:write(HostB,
#privacy_list_data{user_host = US, #privacy_list_data{user_host = US,
name = Name, name = Name,
type = Type, type = Type,
@ -834,7 +835,7 @@ update_tables(Host, mnesia) ->
match_presence_in = MatchPresenceIn, match_presence_in = MatchPresenceIn,
match_presence_out = MatchPresenceOut}) match_presence_out = MatchPresenceOut})
end, List), end, List),
gen_storage:write(Host, gen_storage:write(HostB,
#privacy_list{user_host = US, #privacy_list{user_host = US,
name = Name}) name = Name})
end, Lists), end, Lists),

View File

@ -389,7 +389,7 @@ storageroster_to_roster(#rosteritem{user_host_jid = {U, S, JID} = USJ,
(_, R) -> (_, R) ->
R R
end, [], Rostergroups), end, [], Rostergroups),
#roster{usj = {US, JID}, #roster{usj = {U, S, JID},
us = US, us = US,
jid = JID, jid = JID,
name = convert_to_string(Name), name = convert_to_string(Name),
@ -695,12 +695,8 @@ get_subscription_lists(_, User, Server)
try try
LUser = exmpp_stringprep:nodeprep(User), LUser = exmpp_stringprep:nodeprep(User),
LServer = exmpp_stringprep:nameprep(Server), LServer = exmpp_stringprep:nameprep(Server),
case gen_storage:dirty_select(LServer, rosteritem, [{'=', user_host_jid, {LUser, LServer, '_'}}]) of Items = gen_storage:dirty_select(LServer, rosteritem, [{'=', user_host_jid, {LUser, LServer, '_'}}]),
Items when is_list(Items) -> fill_subscription_lists(Items, [], [])
fill_subscription_lists(Items, [], []);
_ ->
{[], []}
end
catch catch
_ -> _ ->
{[], []} {[], []}
@ -1142,8 +1138,7 @@ get_in_pending_subscriptions(Ls, User, Server)
JID = exmpp_jid:make(User, Server), JID = exmpp_jid:make(User, Server),
LUser = exmpp_stringprep:nodeprep(User), LUser = exmpp_stringprep:nodeprep(User),
LServer = exmpp_stringprep:nameprep(Server), LServer = exmpp_stringprep:nameprep(Server),
case gen_storage:dirty_select(LServer, rosteritem, [{'=', user_host_jid, {LUser, LServer, '_'}}]) of Result = gen_storage:dirty_select(LServer, rosteritem, [{'=', user_host_jid, {LUser, LServer, '_'}}]),
Result when is_list(Result) ->
Ls ++ lists:map( Ls ++ lists:map(
fun(#rosteritem{user_host_jid = {_, _, RJID}, fun(#rosteritem{user_host_jid = {_, _, RJID},
askmessage = Message}) -> askmessage = Message}) ->
@ -1169,10 +1164,7 @@ get_in_pending_subscriptions(Ls, User, Server)
_ -> false _ -> false
end end
end, end,
Result)); Result)).
_ ->
Ls
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -1235,6 +1227,7 @@ get_jid_info(_, User, Server, JID)
%% Only supports migration from ejabberd 1.1.2 or higher. %% Only supports migration from ejabberd 1.1.2 or higher.
update_table(Host, mnesia) -> update_table(Host, mnesia) ->
HostB = list_to_binary(Host),
gen_storage_migration:migrate_mnesia( gen_storage_migration:migrate_mnesia(
Host, rosteritem, Host, rosteritem,
[{roster, [usj, us, jid, name, subscription, ask, groups, askmessage, xs], [{roster, [usj, us, jid, name, subscription, ask, groups, askmessage, xs],
@ -1250,7 +1243,7 @@ update_table(Host, mnesia) ->
lists:foreach( lists:foreach(
fun(Group) -> fun(Group) ->
Group2 = list_to_binary(Group), Group2 = list_to_binary(Group),
gen_storage:write(Host, gen_storage:write(HostB,
#rostergroup{user_host_jid = USJ1, #rostergroup{user_host_jid = USJ1,
grp = Group2}) grp = Group2})
end, Groups), end, Groups),

View File

@ -106,18 +106,18 @@ start(Host, Opts) ->
{attributes, record_info(fields, vcard_search)}, {attributes, record_info(fields, vcard_search)},
{types, [{user_host, {text, text}}]}]), {types, [{user_host, {text, text}}]}]),
update_tables(Host, Backend), update_tables(Host, Backend),
gen_storage:add_table_index(Host, vcard_search, lusername), gen_storage:add_table_index(HostB, vcard_search, lusername),
gen_storage:add_table_index(Host, vcard_search, lfn), gen_storage:add_table_index(HostB, vcard_search, lfn),
gen_storage:add_table_index(Host, vcard_search, lfamily), gen_storage:add_table_index(HostB, vcard_search, lfamily),
gen_storage:add_table_index(Host, vcard_search, lgiven), gen_storage:add_table_index(HostB, vcard_search, lgiven),
gen_storage:add_table_index(Host, vcard_search, lmiddle), gen_storage:add_table_index(HostB, vcard_search, lmiddle),
gen_storage:add_table_index(Host, vcard_search, lnickname), gen_storage:add_table_index(HostB, vcard_search, lnickname),
gen_storage:add_table_index(Host, vcard_search, lbday), gen_storage:add_table_index(HostB, vcard_search, lbday),
gen_storage:add_table_index(Host, vcard_search, lctry), gen_storage:add_table_index(HostB, vcard_search, lctry),
gen_storage:add_table_index(Host, vcard_search, llocality), gen_storage:add_table_index(HostB, vcard_search, llocality),
gen_storage:add_table_index(Host, vcard_search, lemail), gen_storage:add_table_index(HostB, vcard_search, lemail),
gen_storage:add_table_index(Host, vcard_search, lorgname), gen_storage:add_table_index(HostB, vcard_search, lorgname),
gen_storage:add_table_index(Host, vcard_search, lorgunit), gen_storage:add_table_index(HostB, vcard_search, lorgunit),
ejabberd_hooks:add(remove_user, HostB, ejabberd_hooks:add(remove_user, HostB,
?MODULE, remove_user, 50), ?MODULE, remove_user, 50),

View File

@ -47,7 +47,7 @@ start() ->
end, end,
case Res of case Res of
ok -> ok ->
Port = open_port({spawn, ?DRIVER}, [binary]), Port = open_port({spawn, atom_to_list(?DRIVER)}, [binary]),
register(?DRIVER, Port); register(?DRIVER, Port);
{error, Reason} -> {error, Reason} ->
?CRITICAL_MSG("unable to load driver '~s': ~s", ?CRITICAL_MSG("unable to load driver '~s': ~s",